[asterisk-users] Re-Invite to Native Bridge

Sebastian Kemper sebastian_ml at gmx.net
Fri Nov 6 02:34:15 CST 2015


Hello all,

My Asterisk is between my ITSP and a SIP phone. I cannot do direct media
between the provider and the SIP phone, but I would like Asterisk to
locally RTP bridge the two channels using native_rtp.

Example:

> Bridge cfb56606-6b40-4da7-a6fa-6499e183cdbb: switching from simple_bridge technology to native_rtp
> Locally RTP bridged 'PJSIP/5iwrlBee9oKCMAs-00000000' and 'PJSIP/ekiga_outbound-00000001' in stack
> Locally RTP bridged 'PJSIP/5iwrlBee9oKCMAs-00000000' and 'PJSIP/ekiga_outbound-00000001' in stack

My SIP phone supports G722 and PCMA, as does the ITSP provider.  But
depending on the other party in a call, the ITSP may only offer PCMA.

So with my current setting (allow=!all,g722,alaw) I run into this
situation when the ITSP doesn't offer G722:

ITSP <- PCMA -> Asterisk <- G722 -> SIP phone

Obviously that's not optimal. Transcoding needs to take place.

I'm looking for a way to get Asterisk to re-INVITE/UPDATE the SIP phone,
to renegotiate the codec, to avoid transcoding.

I searched the web and found that there are pre-bridge handlers. But
they are executed on the called party channel. So that wouldn't help
when doing an outbound call, plus I'm not sure how I could extract
enough information from the other channel to know if a reinvite is
needed (e.g. the codec the other channel is using).

I also found the Media Format Rewrite article on the wiki:
https://wiki.asterisk.org/wiki/display/AST/Media+Format+Rewrite

In the General Rules paragraph point 3 states (quote):

Prior to entering a bridge, a dialplan function can be used to set
whether or not that channel will attempt to make itself compatible with
whatever is in the bridge with it. If a channel enters a bridge that has
another channel in it with a format it supports, it will attempt to
switch the channel to the bridged channel's format to facilitate native
bridging. Note that this has no bearing in multi-party bridges, where
everyone is transcoded.

There's another paragraph called "Re-Invite to Native Bridge" with an
example where Alice and Bob have a differently ordered set of codecs and
Alice's channel is set to re-INVITE back to native bridging if possible.
After the re-INVITE Asterisk switches to a native bridge.

Well, that is exactly what I want :)

I installed Asterisk 13.6.0 hoping that I could get it to do this. But
until now I haven't found out how.

Does anybody know if this feature from the Media Format Rewrite article
is already available?

Kind regards,
Sebastian



More information about the asterisk-users mailing list