Summary: | ASTERISK-06401: SIP_CODEC not working for 182 Session Progress / Early media | ||
Reporter: | George Papadopoulos (gpapadop73) | Labels: | |
Date Opened: | 2006-02-23 07:00:05.000-0600 | Date Closed: | 2008-01-15 17:21:46.000-0600 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Channels/chan_sip/CodecHandling |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) fix_sip_codec_variable.patch ( 1) sipcodecearlymedia.txt ( 2) trunk-sip-codec-in-early-media.txt | |
Description: | exten => s,1,Set(SIP_CODEC=g729) exten => s,2,Playback(the-party-you-are-calling|noanswer) exten => s,3,Playback(is-curntly-unavail|noanswer) In the above case, the g729 is not used. -- Executing Set("SIP/213.5.1.6-40a2ae68", "SIP_CODEC=g729") in new stack -- Executing Playback("SIP/213.5.1.6-40a2ae68", "the-party-you-are-calling|noanswer") in new stack -- Playing 'the-party-you-are-calling' (language 'gr') However, the same dialplan without the noanswer option in the Playback, works fine. Here is the output that shows that g729 is used. -- Executing Set("SIP/213.5.1.6-40a2ae68", "SIP_CODEC=g729") in new stack -- Executing Playback("SIP/213.5.1.6-40a2ae68", "the-party-you-are-calling") in new stack Feb 23 15:47:00 NOTICE[8095]: chan_sip.c:2506 sip_answer: Changing codec to 'g729' for this call because of ${SIP_CODEC) variable -- Playing 'the-party-you-are-calling' (language 'gr') -- Executing Playback("SIP/213.5.1.6-40a2ae68", "is-curntly-unavail") in new stack -- Playing 'is-curntly-unavail' (language 'gr') ****** ADDITIONAL INFORMATION ****** I am using the Asterisk-1.2.1 and I have applied the patch rtp-packetization-v2.diff.txt from http://bugs.digium.com/view.php?id=5162 Trying to solve the issue I created my own patch. I believe it solves the problem. However I am not 100% sure if there are any issues. Here is the patch: --- chan_sip.c 2006-02-13 14:58:52.768542984 +0200 +++ chan_sip.c.geop 2006-02-23 15:34:55.723163288 +0200 @@ -4521,6 +4521,22 @@ respprep(&resp, p, msg, req); if (p->rtp) { ast_rtp_offered_from_local(p->rtp, 0); + +////////////////////////////////////////////////////////////////// + char *codec=pbx_builtin_getvar_helper(p->owner,"SIP_CODEC"); + if (codec) { + int fmt=ast_getformatbyname(codec); + if (fmt) { + ast_log(LOG_NOTICE, "Changing codec to '%s' for this call because of ${SIP_CODEC) variable\n",codec); + if (p->jointcapability & fmt) { + p->jointcapability &= fmt; + p->capability &= fmt; + } else + ast_log(LOG_NOTICE, "Ignoring ${SIP_CODEC} variable because it is not shared by both ends.\n"); + } else ast_log(LOG_NOTICE, "Ignoring ${SIP_CODEC} variable because of unrecognized/not configured codec (check allow/disallow in sip.conf): %s\n",codec); + } +///////////////////////////////////////////////////////////////// + add_sdp(&resp, p); } else { ast_log(LOG_ERROR, "Can't add SDP to response, since we have no RTP session allocated. Call-ID %s\n", p->callid); | ||
Comments: | By: Olle Johansson (oej) 2006-03-02 11:44:34.000-0600 You are right, we are not supporting SIP_CODEC for early media. I need a disclaimer for your patch proposal, it would be nice to have that on file - even not required since you're simply copying existing code to another place... :-) By: George Papadopoulos (gpapadop73) 2006-03-03 01:38:20.000-0600 Do you mean it would be nice to have the patch on a file? I will upload it. Again, I am new to the "patching" business so I don't know if it is the right format. I created the patch in the channels directory, should I do it one directory up? As for the disclaimer, I am not sure what you need from me. As you said, it is obvious that I just copied existing code. By: Olle Johansson (oej) 2006-03-05 04:10:53.000-0600 Please try this patch that doesn't duplicate the code. Thanks for contributing and finding this. By: Olle Johansson (oej) 2006-03-05 04:21:48.000-0600 Uploaded separate patch for svn trunk. By: George Papadopoulos (gpapadop73) 2006-03-09 05:49:03.000-0600 I tried your patch and it works fine. Thank you. Is this going to be in the next release, or will I have to apply the patch again? By: Olle Johansson (oej) 2006-03-09 11:10:28.000-0600 Committed to Asterisk 1.2, revision 12477 and svn trunk (with a small modification for const char). By: Olle Johansson (oej) 2006-03-09 11:10:56.000-0600 Thanks for a good and detailed error report, plus your testing! By: Digium Subversion (svnbot) 2008-01-15 17:12:31.000-0600 Repository: asterisk Revision: 11845 U team/oej/test-this-branch/README.test-this-branch U team/oej/test-this-branch/channels/chan_sip.c ------------------------------------------------------------------------ r11845 | oej | 2008-01-15 17:12:31 -0600 (Tue, 15 Jan 2008) | 2 lines Issue ASTERISK-6401 - Support SIP_CODEC for early media too ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=11845 By: Digium Subversion (svnbot) 2008-01-15 17:21:46.000-0600 Repository: asterisk Revision: 12477 U branches/1.2/channels/chan_sip.c ------------------------------------------------------------------------ r12477 | oej | 2008-01-15 17:21:46 -0600 (Tue, 15 Jan 2008) | 2 lines Issue ASTERISK-6401 - SIP_CODEC not used for early media (reported by gpapadop73) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=12477 |