[asterisk-users] Early codec selection / negotiation
Francois Marier
fmarier at gmail.com
Sat Mar 5 20:51:34 CST 2011
Hi,
This seems to be a fairly common question, but I have Googled for this quite
a bit and looked at the Asterisk documentation/book and haven't been able to
find an answer.
My question is:
Can I get my IP phone to select a different codec depending on the final
destination of each call?
I've got these things connected to my Asterisk box:
- Snom 300 phone (supports g729 and ulaw)
- PSTN Peer (supports g729 and ulaw)
- Remote Asterisk Peer (supports speex and ulaw)
Currently, it's configured like this:
[snom300]
disallow=all
allow=ulaw
[pstnpeer]
disallow=all
allow=ulaw
[asteriskpeer]
disallow=all
allow=speex
which translates to this:
Snom300 ---ulaw---> (pass-thru) ---ulaw----> PSTNPeer
Snom300 ---ulaw---> (transcode) ---speex---> AsteriskPeer
In other words, my Snom phone always talks to my Asterisk box using the ulaw
codec. My Asterisk box then makes PSTN calls using ulaw and Asterisk calls
using speex (transcoding in the case of speex).
What I'd like to get is this:
(1) Snom300 ---g729---> (pass-thru) ---g729----> PSTNPeer
(2) Snom300 ---ulaw---> (transcode) ---speex---> AsteriskPeer
I can get (1) by using this config:
[snom300]
disallow=all
allow=g729 ; only allow g729
[pstnpeer]
disallow=all
allow=g729
and I can get (2) by using this config:
[snom300]
disallow=all
allow=ulaw ; only allow ulaw
[asteriskpeer]
disallow=all
allow=speex
but I can't get both of them to work at the same time since the Snom phone
always connects to my Asterisk box using its prefferred codec.
If I configure the phone like this:
[snom300]
disallow=all
allow=g729 ; preferred codec
allow=ulaw
then (2) will fail because it's trying to do this:
Snom300 ---g729---> (transcode) ---speex---> AsteriskPeer
and it can't transcode g729 to speex without a patent license.
If I configure the phone like this:
[snom300]
disallow=all
allow=ulaw ; preferred codec
allow=g729
then (1) will fail because it's trying to do this:
Snom300 ---ulaw---> (transcode) ---g729----> PSTNPeer
This is the best description of the problem I've found online:
http://fonality.com/trixbox/forums/trixbox-forums/open-discussion/codec-selection-negotiation-and-tweaking
but unfortunately it doesn't come with a solution.
Is there a way to prevent my IP phone from always connecting to my Asterisk
box using its preferred codec or is that simply impossible?
Cheers,
Francois
--
Francois Marier identi.ca/fmarier
http://feeding.cloud.geek.nz twitter.com/fmarier
More information about the asterisk-users
mailing list