From 76172327f89ba4f4c1b6094af671fb885360f0ea Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Mon, 4 Oct 2004 13:03:53 +0000 Subject: [PATCH] Have SIP_CODEC variable override replace all other codecs (bug #2566) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3909 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 591e306f72..cb077a0333 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1853,7 +1853,11 @@ static int sip_answer(struct ast_channel *ast) fmt=ast_getformatbyname(codec); if (fmt) { ast_log(LOG_NOTICE, "Changing codec to '%s' for this call because of ${SIP_CODEC) variable\n",codec); - p->jointcapability=fmt; + 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); }