[asterisk-dev] Codec selection on calls
stephen.l.davies at gmail.com
Wed Aug 15 03:24:38 CDT 2007
I want to ask for comments on IAX's codec selection approach; I think
there is a simple change that would be good:
First my proposition: in a multi-hop VOIP call, its almost always
best, as far as possible, to keep the codec being used the same all
the way through the call. So if you get a call from a SIP phone in
say ILBC, then keep the call ILBC all the way to the far end. This
has two benefits: first you avoid the degradation of tandem-coding the
call using different codecs, and second you save CPU on your boxes.
Unfortunately, IAX can't be configured to behave this way.
We set "codecpriority=caller" to try to "push" the selected codec down
the line. But the way that IAX offers the allowed codec messes up the
Here's an example of the problem.
Here's a peer:
Now if we have a call from a phone using IAX, and dial it to this
peer, have a look at the IAX2 NEW that is sent:
Tx-Frame Retry -- OSeqno: 000 ISeqno: 000 Type: IAX Subclass: NEW
Timestamp: 00017ms SCall: 00001 DCall: 00000 [A.B.C.D:4569]
VERSION : 2
CALLED NUMBER : 082XXXXXXX
CODEC_PREFS : (alaw|ulaw|g729|ilbc|gsm|speex)
CALLING NUMBER : 021XXXXXXX
CALLING PRESNTN : 35
CALLING TYPEOFN : 0
CALLING TRANSIT : 0
CALLING NAME : Steve Davies
LANGUAGE : en
USERNAME : us
FORMAT : 1024
CAPABILITY : 59150
ADSICPE : 2
DATE TIME : 2007-08-15 10:18:02
You see here that the FORMAT is 1024, ie ILBC. But the codec_prefs
are just in the order of the allows.
The receiving side pays attention to the codec prefs and ignores the
FORMAT, so alaw is selected for this call.
Now I'd like to fix this. But which is the best way:
1) Have the caller rearrange the codec_prefs so that the current codec
(ilbc) is moved to the top
2) Have the callee note the format and use that if its anywhere in the
allow as first option.
I think I like (1) better for better backward compatibility, but what
do people think?
More information about the asterisk-dev