summaryrefslogtreecommitdiff
path: root/channels/chan_unistim.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2010-07-08 22:08:07 +0000
committerMark Michelson <mmichelson@digium.com>2010-07-08 22:08:07 +0000
commitcd4ebd336f6fdd1fe5d2ad57f06654a9678d88d4 (patch)
treec05335b563c3f7cb9a3edbf3e101d8e1b80e0be4 /channels/chan_unistim.c
parent816f26c16ce6cf03cf97b7d0e7af64837283e79d (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: https://origsvn.digium.com/svn/asterisk/trunk@274783 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_unistim.c')
-rw-r--r--channels/chan_unistim.c12
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];