Summary:ASTERISK-14817: [patch] Contact header port ignores transport when using externip
Reporter:Elazar Broad (ebroad)Labels:
Date Opened:2009-09-10 23:23:00Date Closed:2009-10-06 17:43:12
Versions:Frequency of
Environment:Attachments:( 0) externtXXport_v2.patch
( 1) portmap.patch
Description:Port is always 5060, unless specify a port for externip.


SIP debug forthcoming.
This causes an issue with static NAT or PAT(port redirection). For example, a user has 5060 tcp/udp and 5061 tcp mapped to Asterisk, externip is set without a port, the port specified will always be 5060 because we set externip.sin_port to bindaddr.sin_port in reload_config. The attached patch leaves externip.sin_port empty if it is not set and sets the port later on in ast_ouraddrfor() per transport using the local ports specified in the config. Ultimately, this raises the bigger issue of handling externally mapped ports in Asterisk. My humble suggestion would be to implement externudpport/externtcpport/externtlsport options.
Comments:By: Elazar Broad (ebroad) 2009-09-12 23:10:01

The second patch I uploaded adds support for externtcpport and externtlsport options in sip.conf.

By: Elazar Broad (ebroad) 2009-10-05 14:07:30

review board: https://reviewboard.asterisk.org/r/392/

By: Elazar Broad (ebroad) 2009-10-06 17:36:06

Please use the diff from review board and not the attached patches.

By: Digium Subversion (svnbot) 2009-10-06 17:43:12

Repository: asterisk
Revision: 222398

U   trunk/channels/chan_sip.c
U   trunk/configs/sip.conf.sample

r222398 | dvossel | 2009-10-06 17:43:11 -0500 (Tue, 06 Oct 2009) | 21 lines

contact header port ignored transport when using externip

This patch adds support for TCP/TLS in the Contact header when using
NAT, specifically externip or externhost. The original issue was that
Asterisk sent 5060 as the port in the contact header whether TLS was
used or not. Additionally, this patch adds 2 config options to sip.conf,
specifically externtcpport and externtlsport. This allows a user to
specify different external ports for TCP and TLS other than those used
internally, this is especially useful in in a PAT/port redirection setup.
Thanks to ebroad for reporting the issue and providing the patch!

(closes issue ASTERISK-14817)
Reported by: ebroad
     portmap.patch uploaded by ebroad (license 878)
     externtXXport_v2.patch uploaded by ebroad (license 878)
Tested by: ebroad

Review: https://reviewboard.asterisk.org/r/392/