summaryrefslogtreecommitdiff
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authorVitezslav Novy <a1@vnovy.net>2017-09-06 12:23:25 +0200
committerVitezslav Novy <a1@vnovy.net>2017-09-06 10:08:06 -0500
commit67a2ca31f5ce21a55695c07901d9229e086a70e8 (patch)
tree1d1591e29682adacef8e3ed017dbfbffaaf63932 /channels/chan_sip.c
parent3025b47e8f54169d8fe0bc26203a0b7ecaf4ff31 (diff)
chan_sip: Do not change IP address in SDP origin line (o=) in SIP reINVITE
If directmedia=yes is configured, when call is answered, Asterisk sends reINVITE to both parties to set up media path directly between the endpoints. In this reINVITE msg SDP origin line (o=) contains IP address of endpoint instead of IP of asterisk. This behavior violates RFC3264, sec 8: "When issuing an offer that modifies the session, the "o=" line of the new SDP MUST be identical to that in the previous SDP, except that the version in the origin field MUST increment by one from the previous SDP." This patch assures IP address of Asterisk is always sent in SDP origin line. ASTERISK-17540 Reported by: saghul Change-Id: I533a047490c43dcff32eeca8378b2ba02345b64e
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index dcfadf4a8..8a73738f0 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -13570,12 +13570,13 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int
get_our_media_address(p, needvideo, needtext, &addr, &vaddr, &taddr, &dest, &vdest, &tdest);
+ /* We don't use dest here but p->ourip because address in o= field must not change in reINVITE */
snprintf(owner, sizeof(owner), "o=%s %d %d IN %s %s\r\n",
ast_strlen_zero(global_sdpowner) ? "-" : global_sdpowner,
p->sessionid, p->sessionversion,
- (ast_sockaddr_is_ipv6(&dest) && !ast_sockaddr_is_ipv4_mapped(&dest)) ?
+ (ast_sockaddr_is_ipv6(&p->ourip) && !ast_sockaddr_is_ipv4_mapped(&p->ourip)) ?
"IP6" : "IP4",
- ast_sockaddr_stringify_addr_remote(&dest));
+ ast_sockaddr_stringify_addr_remote(&p->ourip));
snprintf(connection, sizeof(connection), "c=IN %s %s\r\n",
(ast_sockaddr_is_ipv6(&dest) && !ast_sockaddr_is_ipv4_mapped(&dest)) ?