SIP_CODEC on asterisk-1.6.2.1

I have configured my ATA devices + asterisk-1.6.2.1 to use G729 as the default CoDec with no problems. However, I need to write a dialplan context to switch to a G711 CoDec to deal with some VoSPs that only support G711 CoDec. So, I wrote a simple dialplan context as shown below to achieve this, but it doesn’t seem to work. Can anyone please help?

exten => _X.,1,NoOP(G711 CoDec) exten => _X.,n,Set(SIP_CODEC=g711) exten => _X.,n,Dial(...)

I think it should be enough to configure the peers for the vosps that can use only g711 to use only ulaw/alaw codecs, so the call leg from/to Asterisk and the ATA should use g729 only and the leg from/to Asterisk and the vosp should use only alaw/ulaw; the vosp codecs configuration can be done in the vosp peer/friend section of sip.conf, so no need for a special dialplan, did you try this way ?

Cheers.

Marco Bruni
www.marcobruni.net

No and I tried to avoid transcodings for at least two reasons, namely to avoid paying for a G729 license and my Asterisk PBX system is hosted on a mediocre FON2100 device. IIRC, the SetVar(SIP_CODEC=g711) used to work on asterisk-1.2.x. At the time, I had no need to use this until now.

Bumped up.

G711/ulaw must be configured as a codec on the peer and the remote end must also support it as well, or asterisk will fail back to the normal codec preference. You will see a message in the logs/on the console about this. I cannot remember the exact message.

Also have you tried SIP_CODEC=ulaw ?

Definitely. I have allowed several CoDecs in the following order g729, g723, ulaw, and alaw on the peer as well as the remote ends. Yet, it doesn’t seem to work.

Yes and it doesn’t work. :frowning:

EDIT: I haven’t made any changes to my settings since my last post on 2/17/10 and just successfully tested the call with ulaw CoDec. AFAICR, this didn’t work two days ago. Oh well, it definitely needs more testings.