diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-07-08 22:08:07 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-07-08 22:08:07 +0000 |
commit | c3c2e5edfd715b3a99aac1567623a0b1b7d49de0 (patch) | |
tree | c05335b563c3f7cb9a3edbf3e101d8e1b80e0be4 /channels/chan_unistim.c | |
parent | af344f1a5be5b43f1d10b95ea6e57ebfa761cf50 (diff) |
Add IPv6 to Asterisk.
This adds a generic API for accommodating IPv6 and IPv4 addresses
within Asterisk. While many files have been updated to make use of the
API, chan_sip and the RTP code are the files which actually support
IPv6 addresses at the time of this commit. The way has been paved for
easier upgrading for other files in the near future, though.
Big thanks go to Simon Perrault, Marc Blanchet, and Jean-Philippe Dionne
for their hard work on this.
(closes issue #17565)
Reported by: russell
Patches:
asteriskv6-test-report.pdf uploaded by russell (license 2)
Review: https://reviewboard.asterisk.org/r/743
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@274783 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_unistim.c')
-rw-r--r-- | channels/chan_unistim.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c index 0ebf879a1..18b76c5e8 100644 --- a/channels/chan_unistim.c +++ b/channels/chan_unistim.c @@ -2038,6 +2038,9 @@ static void start_rtp(struct unistim_subchannel *sub) struct sockaddr_in sin = { 0, }; format_t codec; struct sockaddr_in sout = { 0, }; + struct ast_sockaddr us_tmp; + struct ast_sockaddr sin_tmp; + struct ast_sockaddr sout_tmp; /* Sanity checks */ if (!sub) { @@ -2062,7 +2065,8 @@ static void start_rtp(struct unistim_subchannel *sub) /* Allocate the RTP */ if (unistimdebug) ast_verb(0, "Starting RTP. Bind on %s\n", ast_inet_ntoa(sout.sin_addr)); - sub->rtp = ast_rtp_instance_new("asterisk", sched, &sout, NULL); + ast_sockaddr_from_sin(&sout_tmp, &sout); + sub->rtp = ast_rtp_instance_new("asterisk", sched, &sout_tmp, NULL); if (!sub->rtp) { ast_log(LOG_WARNING, "Unable to create RTP session: %s binaddr=%s\n", strerror(errno), ast_inet_ntoa(sout.sin_addr)); @@ -2078,13 +2082,15 @@ static void start_rtp(struct unistim_subchannel *sub) ast_rtp_instance_set_prop(sub->rtp, AST_RTP_PROPERTY_NAT, sub->parent->parent->nat); /* Create the RTP connection */ - ast_rtp_instance_get_local_address(sub->rtp, &us); + ast_rtp_instance_get_local_address(sub->rtp, &us_tmp); + ast_sockaddr_to_sin(&us_tmp, &us); sin.sin_family = AF_INET; /* Setting up RTP for our side */ memcpy(&sin.sin_addr, &sub->parent->parent->session->sin.sin_addr, sizeof(sin.sin_addr)); sin.sin_port = htons(sub->parent->parent->rtp_port); - ast_rtp_instance_set_remote_address(sub->rtp, &sin); + ast_sockaddr_from_sin(&sin_tmp, &sin); + ast_rtp_instance_set_remote_address(sub->rtp, &sin_tmp); if (!(sub->owner->nativeformats & sub->owner->readformat)) { format_t fmt; char tmp[256]; |