[Home]

Summary:ASTERISK-02525: SIP_CODEC variable not working in 1.0.0 and 1.0.1
Reporter:klaymen (klaymen)Labels:
Date Opened:2004-10-04 01:45:36Date Closed:2008-01-15 15:09:12.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/CodecHandling
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) fix-sipcodec.diff.txt
( 1) SIPCODEC.txt
( 2) sipgate_patch1.txt
Description:Setting the SIP_CODEC variable in extensions.conf doesn't seem to work anymore in 1.0.0 and 1.0.1 (it does work in 1.0-RC2 though). Problem also reported in mailing list (2004-September/006501.html).

****** ADDITIONAL INFORMATION ******

relevant config:

sip.conf:
 [general]
 ...
 context=sip
 port=5060
 bindaddr=0.0.0.0
 srvlookup=yes

 [GSIn] ; local phone
 type=friend
 defaultip=10.1.41.188
 context=intern
 ...

 [Sipgate] ; provider
 type=friend
 host=sipgate.de
 disallow=all ; Disallow all codecs
 allow=ilbc
 ...

extensions.conf:
 [intern]
 exten => h,1,Hangup
 exten => _X.,1,SetCallerID(${SIPGATEID})
 exten => _X.,2,SetVar(SIP_CODEC=ilbc) ; <<<< that's what it's about!!
 exten => _X.,3,Dial(SIP/${EXTEN}@Sipgate,60,)

Comments:By: klaymen (klaymen) 2004-10-04 08:35:16

Note: Just an idea, in source code (channnels/chan_sip.c), function add_sdp (Add session description protocol), p->capability is used in 1.0.1, where 1.0-RC2 still used p->jointcapability. Didn't try out if this would work, but might be source of the problem? I don't know the source well enough to decide though.

release 1.0-RC2, around line 3321:
...
               ast_log(LOG_WARNING, "No way to add SDP without an RTP structure\n");
               return -1;
       }
       capability = p->jointcapability;

       if (!p->sessionid) {
               p->sessionid = getpid();
...

Release 1.0.1, line 3382, has:
...
               ast_log(LOG_WARNING, "No way to add SDP without an RTP structure\n");
               return -1;
       }
       capability = p->capability;

       if (!p->sessionid) {
               p->sessionid = getpid();
...

By: Mark Spencer (markster) 2004-10-04 08:57:20

Note that SIP_CODEC=foo is only used on the answer side not on the outgoing side.

By: Mark Spencer (markster) 2004-10-04 09:03:08

Try this patch and let me know if that helps.

By: klaymen (klaymen) 2004-10-04 09:04:13

Yes, that's what I mean, the answering side... when I call out with my local phone, SIP_CODEC should change the codec with my local phone (because I call different providers using an outgoing dialplan that also support different codecs, so Asterisk must re-set the codec of the calling phone in order to prevent codec translation).

Sorry, your patch still doesn't work for me (I reported earlier it worked, but must have meddes something up). Actually it reports "Oct  4 16:51:49 NOTICE[229390]: chan_sip.c:1858 sip_answer: Ignoring ${SIP_CODEC} variable because it is not shared by both ends." - but ilbc is shared by both ends, as my sip debug reports shows (I'll mail it to you ot attach it to the report if that's possible)

Actually I just tried changing back the line in chan_sip.c (line 3382) to:
...
               ast_log(LOG_WARNING, "No way to add SDP without an RTP structure\n");
               return -1;
       }
       /* capability = p->capability; */
       capability = p->jointcapability;

       if (!p->sessionid) {
               p->sessionid = getpid();
...

And it seems to work now. I'm not sure if I messed up with something else now (precisely, I don't know why "..jointcapabilitiy" was changed to "...capability" from 1.0-RC2 to 1.0.0/1.0.1), as I'm not sure about the defference between "capability" and "jointcapability".




edited on: 10-04-04 09:22

edited on: 10-04-04 09:27

edited on: 10-04-04 09:55

By: klaymen (klaymen) 2004-10-04 10:05:19

hmm sorry for that... I guess it was my fault, your patch (still a good one I think) brought me to it... I had to add "allow=ilbc" into sip.conf's [general] section, I didn't have any codec settings in there, and obviously Asterisk only has ulaw/alaw/gsm activated:

[general]
...
allow=ilbc

now it seems to work. Obviously 1.0-RC2's SIP_CODEC overwrote it. Sorry again, looks like a beginners problem (which I actually am.. I assumed asterisk has all codecs on if nothing else was said). Your patch still imporves output I think!

edited on: 10-04-04 10:06

By: Mark Spencer (markster) 2004-10-04 10:17:09

The patch probably still make sense to merge into head and stable since it makes the SIP_CODEC variable act as it suggests (to force a particular codec on an answer) although the option itself is generally unnecessary with proper sip.conf settings.

By: Russell Bryant (russell) 2004-10-04 22:12:00

applied to 1.0 branch

By: Digium Subversion (svnbot) 2008-01-15 15:09:08.000-0600

Repository: asterisk
Revision: 3909

U   trunk/channels/chan_sip.c

------------------------------------------------------------------------
r3909 | markster | 2008-01-15 15:09:08 -0600 (Tue, 15 Jan 2008) | 2 lines

Have SIP_CODEC variable override replace all other codecs (bug ASTERISK-2525)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=3909

By: Digium Subversion (svnbot) 2008-01-15 15:09:11.000-0600

Repository: asterisk
Revision: 3912

U   branches/v1-0/cdr/cdr_odbc.c

------------------------------------------------------------------------
r3912 | russell | 2008-01-15 15:09:10 -0600 (Tue, 15 Jan 2008) | 2 lines

change to use ast_true in cdr_odbc (bug ASTERISK-2525)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=3912

By: Digium Subversion (svnbot) 2008-01-15 15:09:12.000-0600

Repository: asterisk
Revision: 3913

U   branches/v1-0/channels/chan_sip.c

------------------------------------------------------------------------
r3913 | russell | 2008-01-15 15:09:11 -0600 (Tue, 15 Jan 2008) | 3 lines

make SIP_CODEC behave as it suggests (bug ASTERISK-2525)
Correction: The last commit for cdr_odbc.c was actually bug ASTERISK-2528.

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=3913