Codec Priorities

Home » Asterisk Users » Codec Priorities
Asterisk Users No Comments


I am about to start playing with wideband codecs in our lab, and was hoping to get some clarification on a few things.

To date I’ve pretty much forced the use of G.711 on all legs of all calls, and life has been grand. Now we are distributing phones with G.722 and speex capability, and I would like to use those codecs if it can somehow be determined that the end legs have the capability. There may be several Asterisk servers in between, however.

My first question is – is the order in which I specify “allow” in the sip.conf entry the priority order asterisk will negotiate with the phone?

Assuming the above is true, will it *always* negotiate G.722 if I make it first, even if the call, within the same asterisk server, ends up going out a dahdi trunk? How about if, again in the same asterisk server, it ends up going to a SIP endpoint that *cannot* do G.722?

What about a different scenario involving two asterisk servers, SIP
trunked together with the ability to do G.722 or G.711. If a SIP
endpoint on one asterisk server can only do G.711, will the the call to and endpoint on the other side (lets say that can also only do G.711)
get transcoded “up” to G.722 to cross the trunk, then back “down” to G.711 on the other side?

I vaguely recall a conversation about this some time ago but couldn’t find it in the archives. I’m afraid I know the answer – that asterisk doesn’t try to find the most efficient codec for the call and that if I
decide to let my fancy new phones do G.722 or speex, then transcoding will often be involved. I’d love to understand the complications in this better… seems like it would be a fantastic feature to be able to negotiate end to end and pick the most efficient codec.