From a78825a181e3f2fc71b7d9df7a09fca88f3f2f2b Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Wed, 10 Dec 2008 15:28:02 +0000 Subject: [PATCH] Merged revisions 162619 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ........ r162619 | file | 2008-12-10 11:22:26 -0400 (Wed, 10 Dec 2008) | 4 lines When transmitting a register set the socket port to the local one for the transport being used, not the port for the remote server. (closes issue #13633) Reported by: performer ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@162622 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 4f7cddf46f..f25153ff6c 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -9911,7 +9911,9 @@ static int transmit_register(struct sip_registry *r, int sipmethod, const char * /* Set transport and port so the correct contact is built */ p->socket.type = r->transport; - p->socket.port = htons(r->portno); + if (r->transport == SIP_TRANSPORT_TLS || r->transport == SIP_TRANSPORT_TCP) { + p->socket.port = sip_tcp_desc.local_address.sin_port; + } /* check which address we should use in our contact header