diff options
author | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-01-17 16:53:25 +0000 |
---|---|---|
committer | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-01-17 16:53:25 +0000 |
commit | 55b8c65fbb3b01b8acca58acbdcb85a11e161685 (patch) | |
tree | 53abcc729aae185740d1419217a44895c6476de6 /channels | |
parent | b99400801ee99479e01b656d16779f50316a787e (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/ [^]
........
Backporting a bugfix that should have been included.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@302049 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 238421ecc..c1be361e8 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -10193,6 +10193,7 @@ static void get_our_media_address(struct sip_pvt *p, int needvideo, static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int oldsdp, int add_audio, int add_t38) { int alreadysent = 0; + int doing_directmedia = FALSE; struct sockaddr_in sin; struct sockaddr_in vsin; @@ -10254,6 +10255,7 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int } if (add_audio) { + doing_directmedia = (p->redirip.sin_addr.s_addr && p->redircodecs) ? TRUE : FALSE; /* Check if we need video in this call */ if ((p->jointcapability & AST_FORMAT_VIDEO_MASK) && !p->novideo) { if (p->vrtp) { @@ -10284,6 +10286,16 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int snprintf(connection, sizeof(connection), "c=IN IP4 %s\r\n", ast_inet_ntoa(dest.sin_addr)); if (add_audio) { + if (ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD) == SIP_PAGE2_CALL_ONHOLD_ONEDIR) { + hold = "a=recvonly\r\n"; + doing_directmedia = FALSE; + } else if (ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD) == SIP_PAGE2_CALL_ONHOLD_INACTIVE) { + hold = "a=inactive\r\n"; + doing_directmedia = FALSE; + } else { + hold = "a=sendrecv\r\n"; + } + capability = p->jointcapability; /* XXX note, Video and Text are negated - 'true' means 'no' */ @@ -10291,6 +10303,11 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int p->novideo ? "True" : "False", p->notext ? "True" : "False"); ast_debug(1, "** Our prefcodec: %s \n", ast_getformatname_multiple(codecbuf, sizeof(codecbuf), p->prefcodec)); + if (doing_directmedia) { + capability &= p->redircodecs; + ast_debug(1, "** Our native-bridge filtered capablity: %s\n", ast_getformatname_multiple(codecbuf, sizeof(codecbuf), capability)); + } + /* Check if we need audio */ if (capability & AST_FORMAT_AUDIO_MASK) needaudio = TRUE; @@ -10336,13 +10353,6 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int ast_str_append(&m_audio, 0, "m=audio %d RTP/AVP", ntohs(dest.sin_port)); - if (ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD) == SIP_PAGE2_CALL_ONHOLD_ONEDIR) - hold = "a=recvonly\r\n"; - else if (ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD) == SIP_PAGE2_CALL_ONHOLD_INACTIVE) - hold = "a=inactive\r\n"; - else - hold = "a=sendrecv\r\n"; - /* Now, start adding audio codecs. These are added in this order: - First what was requested by the calling channel - Then preferences in order from sip.conf device config for this peer/user |