Francois Marier
2011-Mar-06 02:51 UTC
[asterisk-users] Early codec selection / negotiation
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
If you dialout call without answering and allow all codec for both peers then codec negotiation will be direct between endpoints and asterisk will only do media pass-through. -----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Francois Marier Sent: Sunday, March 06, 2011 7:52 AM To: asterisk-users at lists.digium.com Subject: [asterisk-users] Early codec selection / negotiation 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-sele ction-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 -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users