diff options
author | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-01-17 17:45:39 +0000 |
---|---|---|
committer | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-01-17 17:45:39 +0000 |
commit | 65b603e4ad976ac52ef7ec68e50fc7535417fa91 (patch) | |
tree | b125ce34c1f5192010ed3f44960d2cb04f1ed99c /channels | |
parent | a744dc6e90f1414a2945adff73dd1680d19a6027 (diff) |
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: http://svn.digium.com/svn/asterisk/branches/1.4@302087 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 993ae5ae9..4ec0a5176 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); |