[asterisk-commits] file: trunk r186624 - in /trunk: ./ channels/ doc/tex/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 6 11:15:38 CDT 2009


Author: file
Date: Mon Apr  6 11:15:30 2009
New Revision: 186624

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=186624
Log:
Add support for changing the outbound codec on a SIP call using
a dialplan variable.

This adds a dialplan variable (SIP_CODEC_OUTBOUND) which controls
the codec offered for an outgoing SIP call. This is much like the
SIP_CODEC dialplan variable and has the same restrictions. The codec
set must be one that is configured for the call.

(closes issue #13243)
Reported by: samdell3
Patches:
      13243.diff uploaded by file (license 11)

Modified:
    trunk/CHANGES
    trunk/channels/chan_sip.c
    trunk/doc/tex/channelvariables.tex

Modified: trunk/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/trunk/CHANGES?view=diff&rev=186624&r1=186623&r2=186624
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Mon Apr  6 11:15:30 2009
@@ -15,6 +15,9 @@
 -----------
  * Added preferred_codec_only option in sip.conf. This feature limits the joint
    codecs sent in response to an INVITE to the single most preferred codec.
+ * Added SIP_CODEC_OUTBOUND dialplan variable which can be used to set the codec
+   to be used for the outgoing call. It must be one of the codecs configured
+   for the device.
 
 Applications
 ------------

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=186624&r1=186623&r2=186624
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon Apr  6 11:15:30 2009
@@ -5836,7 +5836,12 @@
 	int fmt;
 	const char *codec;
 
-	codec = pbx_builtin_getvar_helper(p->owner, "SIP_CODEC");
+	if (p->outgoing_call) {
+		codec = pbx_builtin_getvar_helper(p->owner, "SIP_CODEC_OUTBOUND");
+	} else if (!(codec = pbx_builtin_getvar_helper(p->owner, "SIP_CODEC_INBOUND"))) {
+		codec = pbx_builtin_getvar_helper(p->owner, "SIP_CODEC");
+	}
+
 	if (!codec) 
 		return;
 
@@ -9838,6 +9843,7 @@
 
 	if (p->do_history)
 		append_history(p, "ReInv", "Re-invite sent");
+	try_suggested_sip_codec(p);
 	if (t38version)
 		add_sdp(&req, p, oldsdp, FALSE, TRUE);
 	else
@@ -10199,8 +10205,10 @@
 			ast_udptl_offered_from_local(p->udptl, 1);
 			ast_debug(1, "T38 is in state %d on channel %s\n", p->t38.state, p->owner ? p->owner->name : "<none>");
 			add_sdp(&req, p, FALSE, FALSE, TRUE);
-		} else if (p->rtp) 
+		} else if (p->rtp) {
+			try_suggested_sip_codec(p);
 			add_sdp(&req, p, FALSE, TRUE, FALSE);
+		}
 	} else {
 		if (!p->notify_headers) {
 			add_header_contentLength(&req, 0);

Modified: trunk/doc/tex/channelvariables.tex
URL: http://svn.digium.com/svn-view/asterisk/trunk/doc/tex/channelvariables.tex?view=diff&rev=186624&r1=186623&r2=186624
==============================================================================
--- trunk/doc/tex/channelvariables.tex (original)
+++ trunk/doc/tex/channelvariables.tex Mon Apr  6 11:15:30 2009
@@ -925,7 +925,9 @@
 ${SIPFROMDOMAIN}       Set SIP domain on outbound calls
 ${SIPUSERAGENT}      * SIP user agent (deprecated)
 ${SIPURI}            * SIP uri
-${SIP_CODEC}           Set the SIP codec for a call
+${SIP_CODEC}           Set the SIP codec for an inbound call
+${SIP_CODEC_INBOUND}   Set the SIP codec for an inbound call
+${SIP_CODEC_OUTBOUND}  Set the SIP codec for an outbound call
 ${SIP_URI_OPTIONS}   * additional options to add to the URI for an outgoing call
 ${RTPAUDIOQOS}         RTCP QoS report for the audio of this call
 ${RTPVIDEOQOS}         RTCP QoS report for the video of this call




More information about the asterisk-commits mailing list