[Asterisk-Dev] setvar(SIP_CODEC) bug?

John Todd jtodd at loligo.com
Tue Oct 28 13:34:25 MST 2003


>On Mon, 2003-10-27 at 20:48, John Todd wrote:
>>  >	I've posted this problem a week ago in the users list, I apologize for
>>  >bringing it back, but I'm still stuck on it.
>>  >
>>  >	I have a 7960 phone that is using g729 as preferred codec, I want to
>>  >change the codec to g711 when the call is going out through the zaptel
>>  >interface.
>>  >
>>  >	These are my config files:
>>  >
>>  >== sip.conf ==
>>  >[7601]
>>  >type=friend
>>  >username=7601
>>  >secret=7601
>>  >host=dynamic
>>  >canreinvite=yes
>>  >context=intern
>>  >mailbox=301
>>  >disallow=all
>>  >allow=g729
>>  >allow=ulaw
>>  >
>>  >== extensions.conf ==
>>  >exten => 17862862222,1,setvar(SIP_CODEC=g711)
>>  >exten => 17862862222,2,Dial(${TRUNK}/${EXTEN})
>>  >
>>  >	The following debug shows that the setvar application is executed, and
>>  >looking at the code in chan_sip.c, * will send an answer with the proper
>>  >codec (g711), but the call never gets answered because when * executes
>>  >ast_set_read_format and ast_set_write_format in channel.c, it seems that
>>  >the variable has not been updated there. Asterisk doesn't find a way to
>>  >translate from/to g729 and drops the call.
>>  >
>>  >	I don't know if this could be a bug or simply I'm missing something
>>  >here.
>>  >
>>  >	Thank you for any help you can provide.
>>  [snip]
>>
>>  Luis -
>>     Try:
>>
>>  exten => 17862862222,1,setvar(SIP_CODEC=alaw)
>>
>Oops! I'm sorry, It was a fat finger copying from the file to the 
>mail. I've tried the new config with no luck.
>
>Any ideas?
>
>Luis

No, I'm afraid not.  This does seem not to function as I had 
remembered it to work.  Looking at chan_sip.c at around line 1125, it 
seems pretty obvious as to how it's _supposed_ to work, and the 
LOG_NOTICE messages say the right thing, but the call does not get 
generated with the right codec - as you can see from the notes below, 
it's ULAW and not g729.


[iconnect]
type=friend
secret=1234
username=12345678
host=213.137.73.177                                         
dtmfmode=inband                                             
canreinvite=no                                              
disallow=all                                                
allow=ulaw
allow=alaw                                                  
allow=g729                                                  
allow=gsm


Here's the console log:

     -- Executing SetVar("SIP/2203-8fa8", "SIP_CODEC=g729") in new stack
     -- Executing Dial("SIP/2203-8fa8", "SIP/14102241145 at iconnect|70") 
in new stack
     -- Called 14102241145 at iconnect
     -- SIP/iconnect-f818 is making progress passing it to SIP/2203-8fa8
     -- SIP/iconnect-f818 answered SIP/2203-8fa8
     -- Attempting native bridge of SIP/2203-8fa8 and SIP/iconnect-f818
ms1*CLI> sip show channels
Peer             User/ANR    Call ID      Seq (Tx/Rx)  Lag      Jitter  Format
213.137.73.177   1410224114  110cb6c20cf  00103/00000  00000ms  0000ms  ULAW
204.92.126.4     2203        0002b9eb-0e  00101/00103  00000ms  0000ms  ULAW
2 active SIP channel(s)


Here is the messages file for the relevant parts of the call:

Oct 28 20:27:37 NOTICE[27665]: File chan_sip.c, Line 1129 
(sip_answer): Changing codec to 'g729' for this call because of 
${SIP_CODEC) variable


I've created a bugnote: 
http://bugs.digium.com/bug_view_page.php?bug_id=0000450


JT



More information about the asterisk-dev mailing list