From: Terry Wilson Date: Mon, 17 Jan 2011 17:45:39 +0000 (+0000) Subject: Merged revisions 293493 via svnmerge from X-Git-Tag: 1.4.41-rc1~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59bd4a2ba3a2f18bb105635de27167a977849609;p=thirdparty%2Fasterisk.git Merged revisions 293493 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 [^] ........ r293493 | twilson | 2010-11-01 09:58:00 -0500 (Mon, 01 Nov 2010) | 14 lines Only offer codecs both sides support for directmedia When using directmedia, Asterisk needs to limit the codecs offered to just the ones that both sides recognize, otherwise they may end up sending audio that the other side doesn't understand. (closes issue 0017403) Reported by: one47 Patches: sip_codecs_simplified4 uploaded by one47 (license 23) Tested by: one47, falves11 Review: https://reviewboard.asterisk.org/r/967/ [^] ........ Back port a fix that should have been included git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@302087 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 993ae5ae9b..4ec0a51765 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -7027,6 +7027,7 @@ static void add_noncodec_to_sdp(const struct sip_pvt *p, int format, int sample_ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int add_audio, int add_t38) { int alreadysent = 0; + int doing_directmedia = FALSE; struct sockaddr_in sin; struct sockaddr_in vsin; @@ -7092,6 +7093,7 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int if (p->redirip.sin_addr.s_addr) { dest.sin_port = p->redirip.sin_port; dest.sin_addr = p->redirip.sin_addr; + doing_directmedia = p->redircodecs ? TRUE : FALSE; } else { dest.sin_addr = p->ourip; dest.sin_port = sin.sin_port; @@ -7108,15 +7110,21 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int hold = "a=sendrecv\r\n"; if (add_audio) { + char codecbuf[SIPBUFSIZE]; capability = p->jointcapability; - if (option_debug > 1) { - char codecbuf[SIPBUFSIZE]; ast_log(LOG_DEBUG, "** Our capability: %s Video flag: %s\n", ast_getformatname_multiple(codecbuf, sizeof(codecbuf), capability), ast_test_flag(&p->flags[0], SIP_NOVIDEO) ? "True" : "False"); ast_log(LOG_DEBUG, "** Our prefcodec: %s \n", ast_getformatname_multiple(codecbuf, sizeof(codecbuf), p->prefcodec)); } + if (doing_directmedia) { + capability &= p->redircodecs; + if (option_debug > 1) { + ast_log(LOG_NOTICE, "** Our native-bridge filtered capablity: %s\n", ast_getformatname_multiple(codecbuf, sizeof(codecbuf), capability)); + } + } + #ifdef WHEN_WE_HAVE_T38_FOR_OTHER_TRANSPORTS if (ast_test_flag(&p->t38.t38support, SIP_PAGE2_T38SUPPORT_RTP)) { ast_build_string(&m_audio_next, &m_audio_left, " %d", 191);