[Asterisk-Users] How to force G729

Manuel Wenger manuel.wenger at ticinocom.com
Thu Jun 24 01:22:50 MST 2004


We want some of our users to use G729, and some others to use ULAW. Our PSTN gateway provider supports both, so that's not a problem, and if I force him (the PSTN gateway) to allow G729 only, the outgoing call will take place with G729.

The problem is that I want to have my PSTN provider configured to allow ULAW as a first priority, then G729. I did it like that:

[mypstngate]
type=friend
host=192.168.0.100
port=5060
context=pstn-in
canreinvite=no
disallow=all
allow=ulaw
allow=g729

Then, in the outgoing context for our G729 SIP customers, I've put something like that:
exten => _0NXXXXXXXX,1,setvar(SIP_CODEC=g729)
exten => _0NXXXXXXXX,2,Dial(SIP/0041${EXTEN:1}@mypstngate,90)


What happens now when placing a call is very interesting. As you can see, Asterisk wants to change the codec to g729, but on the outgoing call to the PSTN gateway it remains ULAW. Like this, I'm using up one of my G729 licenses, and Asterisk is doing the transcoding between G729 and ULAW. That's definitely not what I want. Any ideas about how to force both channels to G729? By the way, if I use a client which doesn't support G729, this call doesn't even take place, it hangs up, because Asterisk tries to force G729 on the client's channel (but not on the PSTN gateway's channel).

In other words, the "setvar(SIP_CODEC=g729)" only forces the codec on the "calling channel", not on the "called channel". How can I change that?

Another interesting thing, the "show g729" after the call hangs up: I have "-1/-2 encoders/decoders in use". Maybe a bug?

Thanks
-Manuel



*CLI>     -- Executing SetVar("SIP/2016-b119", "SIP_CODEC=g729") in new stack
    -- Executing Dial("SIP/2016-b119", "SIP/0041911234567 at mypstngate|90") in new stack
    -- Called 0041911234567 at mypstngate
    -- SIP/mypstngate-caed is making progress passing it to SIP/2016-b119
    -- SIP/mypstngate-caed is ringing
    -- SIP/mypstngate-caed answered SIP/2016-b119
Jun 24 09:49:23 NOTICE[1094450096]: chan_sip.c:1314 sip_answer: Changing codec to 'g729' for this call because of ${SIP_CODEC) variable
    -- Attempting native bridge of SIP/2016-b119 and SIP/mypstngate-caed

*CLI> sip show channels
Peer             User/ANR    Call ID      Seq (Tx/Rx)  Lag      Jitter  Format
192.168.0.100    0041911234  1f7d34e3642  00102/00000  00000ms  0000ms  ULAW  
192.168.0.2      2016        4977-4F41-7  00101/00003  00000ms  0000ms  G729A 
2 active SIP channel(s)

[... after hangup ...]

  == Spawn extension (auth-out, 0911234567, 2) exited non-zero on 'SIP/2016-b119'
    -- Executing Hangup("SIP/2016-b119", "") in new stack
  == Spawn extension (auth-out, h, 1) exited non-zero on 'SIP/2016-b119'
       > cdr_odbc: Query Successful!

*CLI> show g729
-1/-2 encoders/decoders of 30 licensed channels are currently in use
*CLI> 


___________________________________________________
Ticinocom SA - Via Stazione 5 - 6600 Muralto
Tel 0844 007070 - Fax 0844 007071
http://www.ticinocom.com




More information about the asterisk-users mailing list