[asterisk-users] Difference of outbound SDP offer behavior between 1.8.X and 11.X ?

Florent Krieg fkrieg at sewan.eu
Wed Feb 6 12:32:29 CST 2013


Hi all,

I'm new to this mailing-list (and new to Asterisk in general) so please 
don't blame me if this has already been posted here in the past (I tried 
to check the archives but hey, they're quite big).

While testing a specific environment involving 2 Asterisks hosts, I 
found different behaviors when using an Asterisk 1.8.X or an 11.2.1 
(same on 11.1.2).
Here is the SIP case:
Friend1 -------> Asterisk --------> OutboundTrunk1
Everywhere, codecs allowed are: g722, g729, g711a, g711u.
Friend1 calls a pstn number for instance. It offers in the SDP included 
with the INVITE g722/g711a/g711u (9 8 0).
The extensions.conf is configured as following:
exten => _XXXXXXXXXX,1,Dial(SIP/${EXTEN}@OutboundTrunk1)

The outbound SDP will be (these are real tcpdump captures):
A) Asterisk 1.8.15 cert1:
[...]
CSeq: 102 INVITE
User-Agent: "SewanAstetrunk1"
Date: Tue, 05 Feb 2013 14:16:28 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, 
INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 322

v=0
s=Asterisk PBX 1.8.15-cert1
c=IN IP4 X.X.X.X
t=0 0
m=audio 33728 RTP/AVP 9 8 0 101
a=rtpmap:9 G722/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

B) Asterisk 11.1.2:
[...]
CSeq: 102 INVITE
User-Agent: "SewanAstetrunk1"
Date: Tue, 05 Feb 2013 13:10:15 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, 
INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 363

v=0
s=Asterisk PBX 11.1.2
c=IN IP4 X.X.X.X
t=0 0
m=audio 39102 RTP/AVP 9 18 8 0 101
a=rtpmap:9 G722/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv


Imagine the remote trunk in this case isn't G722 capable, then 
negotiates G729 with the Asterisk... Transcoding will be forced to G711a!
I reckon this difference in the offer is expected. May this be a bugfix 
for Asterisk newer version?
Does anybody confirm this is not a bug?

I mean, in some terms, I really prefer the behavior of old Asterisk 
1.8.15 because it will avoid transcoding in many many cases (Asterisk 
11.X offers 18/g729 but he already knows Friend1 can't do g729 at the 
time of initiating the outbound call). Moreover (and quite important), 
it will avoid unnecessary usage of paid g729 transcoding in many cases 
(meaning, cost savings).

Is there a way to make Asterisk 11.X behaves as 1.8.15? I.e. can we 
restrict the SDP offer of the outbound call of at least what inbound leg 
offered?
I tried to play with extensions.conf and SIP_OUTBOUND_CODEC (and 
INBOUND), without luck.

Has anybody else wanted (I guess so) or even achieved this use case? 
(And if yes, how?)


I have another question as well (which is related in a way):
is it possible to achieve this:
Friend1 invites Asterisk (offers for instance 9 8 0)
Asterisk invites OutboundTrunk1 (SDP: 8 0)
Asterisk got reply from OutboundTrunk1 (SDP: 8)
Asterisk then replies 200 OK with SDP 8 to Friend1 (and not 9, even if 
capable, to avoid transcoding of course)

<=> Even if Asterisk behaves like a B2B should, is it possible to reply 
the inbound considering the reply of the outbound leg?
I really think this should be achievable because Asterisk waits for the 
outbound 200 to reply 200 at the inbound leg...

Is that the eventual purpose of this patch: 
http://www.b2bua.org/wiki/AsteriskCodecNegotiationPatch ?
If so, do you know an equivalent for recent Asterisk version?



Thanks a lot in avance for giving the best practices around those points!
Cheers,
Florent



More information about the asterisk-users mailing list