diff options
author | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-08-14 15:32:16 +0000 |
---|---|---|
committer | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-08-14 15:32:16 +0000 |
commit | db461279722f5036fecb057beb22526c2fbe9d3a (patch) | |
tree | 0882ba95c9767c63a4780e55c219f95873be5d34 /channels/chan_sip.c | |
parent | 1a0b3cb4c4d0185789ed54ca2bc6e200c113e75a (diff) |
Make sure we set the socket port, so we don't try to use <ip address>:0.
(closes issue #13255)
Reported by: falves11
Patches:
13255-socketport.diff uploaded by qwell (license 4)
Tested by: falves11
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@137812 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 65f45b3c2..9c6351998 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -4343,7 +4343,7 @@ static int create_addr(struct sip_pvt *dialog, const char *opeer, struct sockadd memcpy(&dialog->sa.sin_addr, &sin->sin_addr, sizeof(dialog->sa.sin_addr)); if (!sin->sin_port) { if (ast_strlen_zero(port) || sscanf(port, "%u", &portno) != 1) { - portno = dialog->socket.type & SIP_TRANSPORT_TLS ? + portno = (dialog->socket.type & SIP_TRANSPORT_TLS) ? STANDARD_TLS_PORT : STANDARD_SIP_PORT; } } else { @@ -4380,6 +4380,8 @@ static int create_addr(struct sip_pvt *dialog, const char *opeer, struct sockadd if (!dialog->socket.type) dialog->socket.type = SIP_TRANSPORT_UDP; + if (!dialog->socket.port) + dialog->socket.port = bindaddr.sin_port; dialog->sa.sin_port = htons(portno); dialog->recv = dialog->sa; return 0; |