diff options
author | Joshua Colp <jcolp@digium.com> | 2016-09-19 11:13:21 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2016-10-23 13:51:42 +0000 |
commit | bb982480d815fb0d5059fbfa86682cd30846556c (patch) | |
tree | 00214eca5494c3383caf89797fd6e98733d1307d /res/res_rtp_asterisk.c | |
parent | c2036c827cb22e2fbf509d4318b6f177d516c033 (diff) |
pjsip: Support dual stack automatically.
This change adds support for dual stack automatically. No
configuration is required and the IP address and version
in the SIP messages and SDP will be automatically changed
based on the transport over which the message is being
sent. RTP usage has also been changed to listen on both
IPv4 and IPv6 simultaneously to allow media to flow, and
to allow ICE support on both simultaneously. This also
allows failover between IPv6 and IPv4 to work as expected.
ASTERISK-26309 #close
Change-Id: I235a421d8f9a326606d861b449fa6fe3a030572d
Diffstat (limited to 'res/res_rtp_asterisk.c')
-rw-r--r-- | res/res_rtp_asterisk.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index 9b35301f9..6dc0d3abe 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -4972,6 +4972,15 @@ static int ast_rtp_fd(struct ast_rtp_instance *instance, int rtcp) static void ast_rtp_remote_address_set(struct ast_rtp_instance *instance, struct ast_sockaddr *addr) { struct ast_rtp *rtp = ast_rtp_instance_get_data(instance); + struct ast_sockaddr local, us; + + if (!ast_sockaddr_isnull(addr)) { + /* Update the local RTP address with what is being used */ + ast_ouraddrfor(addr, &us); + ast_rtp_instance_get_local_address(instance, &local); + ast_sockaddr_set_port(&us, ast_sockaddr_port(&local)); + ast_rtp_instance_set_local_address(instance, &us); + } if (rtp->rtcp) { ast_debug(1, "Setting RTCP address on RTP instance '%p'\n", instance); @@ -4980,6 +4989,15 @@ static void ast_rtp_remote_address_set(struct ast_rtp_instance *instance, struct ast_sockaddr_set_port(&rtp->rtcp->them, ast_sockaddr_port(addr) + 1); } + + if (!ast_sockaddr_isnull(addr)) { + /* Update the local RTCP address with what is being used */ + ast_sockaddr_set_port(&us, ast_sockaddr_port(&local) + 1); + ast_sockaddr_copy(&rtp->rtcp->us, &us); + + ast_free(rtp->rtcp->local_addr_str); + rtp->rtcp->local_addr_str = ast_strdup(ast_sockaddr_stringify(&us)); + } } rtp->rxseqno = 0; |