[Asterisk-Users] Codec control

Eric Wieling eric at fnords.org
Wed Nov 24 06:18:45 MST 2004


Damian Minkov wrote:
> How can i control the codec for the calls. For example I have 3 SIP 
> phones registered to asterisk
> The firs two are in the local area network (behind nat)- I want to use 
> g711 between them and to connect directly (canreinvite=yes)
> and the third is in internet - want all calls to it and from it to use 
> g729 and media to go through asterisk.
> So if Phone 1 calls Phone 2 the codec to be g711, but when Phone 1 calls 
> Phone 3 to use g729 ?

Because of the problem with disallow= in sip.conf peer sections this may 
not work the way you expect.  This is what I do.

[general]
diallow=all
allow=ulaw
allow=g729

[phone1]
disallow=all
allow=ulaw

[phone2]
disallow=all
allow=ulaw

[phone3]
disallow=all
allow=g729

Now for the trick.  Make the PHONE only support the codec you want. 
i.e. diallow all the codecs on phone1 and phone 2 except for ulaw.  On 
phone 3 disallow all the codecs except for g729.  Because of the 
problems with disallow= in the [happypeer] parts of sip.conf this won't 
work unless the codecs are specified on the phone.  Do NOT allow both 
ulaw and alaw.  I've seen problems with this reported on #asterisk

--Eric

-- 
I am seeking part or full time employment in Toronto, The Netherlands,
or Belgium.  My preference is part time employment in Toronto with
some telecommuting. Currently located in New Orleans, Louisiana and am
happy to relocate. Contact eric at fnords.org.




More information about the asterisk-users mailing list