diff options
author | Joshua Colp <jcolp@digium.com> | 2017-05-03 11:05:35 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-05-03 11:05:35 -0500 |
commit | bdec0852b96a9475a013f88949ad162511fd8404 (patch) | |
tree | b9bb6b87d4fee4bf1c4266f6d5df4bcb0da055e6 /channels/chan_sip.c | |
parent | 675e058e7794f15a4729093a165a0a66abb5d9f9 (diff) | |
parent | 585f9405b11da980d7ffb2f71b90ccd4d5842383 (diff) |
Merge "channels/chan_sip.c: use binding IP address for outgoing TCP SIP connections"
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index d0900fb3c..e7c15bcbd 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -29275,6 +29275,17 @@ static int sip_prepare_socket(struct sip_pvt *p) } } + /* If a bind address has been specified, use it */ + if ((s->type == AST_TRANSPORT_TLS) && !ast_sockaddr_isnull(&sip_tls_desc.local_address)) { + ca->local_address = sip_tls_desc.local_address; + } + else if ((s->type == AST_TRANSPORT_TCP) && !ast_sockaddr_isnull(&sip_tcp_desc.local_address)) { + ca->local_address = sip_tcp_desc.local_address; + } + /* Reset tcp source port to zero to let system pick a random one */ + if (!ast_sockaddr_isnull(&ca->local_address)) { + ast_sockaddr_set_port(&ca->local_address, 0); + } /* Create a client connection for address, this does not start the connection, just sets it up. */ if (!(s->tcptls_session = ast_tcptls_client_create(ca))) { goto create_tcptls_session_fail; |