[asterisk-users] Re: Dynamic Codec Selection

Martin Joseph ast at stillnewt.org
Wed Oct 25 09:36:13 MST 2006


>> On 2006-10-24 06:44:01 -0700, "Wildheart"
>> <asterisk-users at php-systems.com> said:
>> 
>>> Hi,
>>> 
>>> Does anyone know a what to use a different codec for calls which a
> re
>>> handset to handset (eg, G711) then when we have calls to the out side
>>> world (via an asterisk server) to use a different codec(eg, G729)?
>>> <snip>

>> I responded:
>> yes, this is simple,  just make it so the extensions allow both g729
>> and ulaw, and set your "outside world" is g729.
On 2006-10-25 03:31:39 -0700, "Wildheart" 
<asterisk-users at php-systems.com> said:

> Hi Marty,
> 
>    By the outside world, I mean the PSTN connection. I am still intereste d
> in how you would set this up. Can you paste in a sample config?

One internal phone from SIP.conf:

;
; SIP entry for users test rig
[2004]
type=friend
secret=footest
dtmfmode=inband  ; my stupid PSTN gateway doesn't like rfc2833
auth=md5
host=dynamic
nat=yes
canreinvite=no
disallow=all
allow=ulaw
allow=g729
context=autocontext
callerid="Alton Wireless Phone "<2004>

Another "internal" extension

; IAX entry for user karma
[3000]
type=friend
secret=testfoo
auth=md5
host=dynamic
disallow=all
allow=ulaw
allow=g729
context=karma
callerid="Karma"<2065555500>

Ok, now these two extensions when one calls the other should use uLaw.

Now here is my extension for my PSTN gateway:


;
; SIP entry for user (FXO)
[2003]
type=friend
secret=testPSTN
dtmfmode=inband
auth=md5
host=dynamic
nat=yes
canreinvite=no
disallow=all
allow=g729
context=autocontext
callerid="Alton Qwest Line"<2065551183>

Depending how your PSTN is setup the last bit could be quite different, 
but the premise is the same.  Since the PSTN only allows g729, this 
will force other connections to that also.  Of course you need to be 
sure your devices support this, or else you will need to buy licenses 
for G729 to transcode, which is also a significant hit for CPU.

Further more, this only makes sense to do if your "PSTN" calls are 
being terminated by someone OFF your local network.  If your PSTN calls 
(like mine) are being routed to a local gateway, then using ulaw should 
be ok also (it's your network, make it work!).


Marty





More information about the asterisk-users mailing list