aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2009-04-06 16:15:30 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2009-04-06 16:15:30 +0000
commitf3f7095a51c721febf03a0457a6df5f71ee0da7e (patch)
treecd16891b76adcf35c4f5f6fceb8c05d5dcdc42ac /channels/chan_sip.c
parent85bd9cd2bf3f7ae30e5da1fb145708da4a9bcf63 (diff)
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) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@186624 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 10883c5f3..17b7c8cbb 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -5836,7 +5836,12 @@ static void try_suggested_sip_codec(struct sip_pvt *p)
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 @@ static int transmit_reinvite_with_sdp(struct sip_pvt *p, int t38version, int old
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 @@ static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init)
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);