Asterisk 11 codec order

I’ve done some search on the web, it seems there were patch for how asterisk wasn’t following the codec order specified in the SIP.conf. But I would think on version 11, it would been fixed or do I need to do “patch” also? Becuase here is my peer config:


and when I use the command “SIP SHOW PEER PeerXYZ” it show the peer order to be g729,ulaw

But then when I wireshark the INVITE and also used the “sip set debug on” CLI, I see in the SDP, it still puts ULAW in first and then g729 second.

Why is that?

thank you!

If it is the outgoing leg, it will put the incoming codec first, if it is an allowable outgoing leg codec.

wow, ok so asterisk would actually “know” that there is a replation between 2 leg call and it would say that if inbound is G711, I’ll try to make outbound G711? But what about if I don’t want to do G729, then thus on the outbound leg I have to make G729 only and thus force the inbound be G711 and outbound be G729 (to save bandwidth) and have Asterisk do transcoding?

And that if this is the case, then I guess I need opensip to do more manipulation. Because if the only way to force a outbound leg is to narrow down to single codec and that the remote carrier do not accept g729, then the call fails. Thus I need to have asterisk still go out as g711,g729 and then use opensips to flip that order then sent to carrier?

Don’t allow G.711 for the outbound device.

There are also variable you can set, before Dial, to force the codec selection.