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
This commit is contained in:
Joshua Colp
2016-09-19 11:13:21 +00:00
parent e03364c40a
commit 403c4f5833
9 changed files with 194 additions and 82 deletions

View File

@@ -4971,6 +4971,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);
@@ -4979,6 +4988,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;