[asterisk-bugs] [Asterisk 0019297]: [patch] Auto detect NAT if the same device can be used in several natted/unnated scenarios

Asterisk Bug Tracker noreply at bugs.digium.com
Mon May 23 16:03:41 CDT 2011


The following issue is now READY FOR TESTING. 
====================================================================== 
https://issues.asterisk.org/view.php?id=19297 
====================================================================== 
Reported By:                pedro-garcia
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   19297
Category:                   Channels/chan_sip/Interoperability
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     ready for testing
Asterisk Version:           1.8.4 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2011-05-14 15:39 CDT
Last Modified:              2011-05-23 16:03 CDT
====================================================================== 
Summary:                    [patch] Auto detect NAT if the same device can be
used in several natted/unnated scenarios
Description: 
I have some devices in the following scenario:

- Asterisk server with public IP address

Mobile devices (clients):

- When in internal network, no NAT between the client and the server
- When in "roaming" (i.e. a Hotel with WiFi), the client is behing a NAT
- When in 3G, operator transparent sip proxy so it looks as no NAT, but
does not support symmetric RTP.
- Sometime, the device gets a public IP with no NAT at all.

No NAT setting available in asterisk works for all these scenarios at the
same time, and I can not request the user to activate different accounts
depending on its location.

I have added a new NAT setting (nat=auto) to the current ones. When set,
chan_sip auto detects from the Via header, the recv sockaddr, and the rport
setting if the client is behind a NAT.

It also adds to cli interface results (sip show peer/s) info on this (so
now you could see "N" for NAT and nothing for no NAT as before, "a" for
auto detect no NAT, and "A" for autodetect NAT.

I include the two patches involved, one to sip.h to add the flag to
"SIP_PAGE3", and the patch itself to chan_sip.c

They apply cleanly on 1.8.4 and work with TCP and UDP, but also on 1.8.3.2
with TCP, UDP and TLS (from 1.8.3.3 there is a reported bug in TLS that has
nothing to do with this patch but that prevents me from using TLS)


====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-05-23 16:03 ebroad         Status                   needs license => ready
for testing
======================================================================




More information about the asterisk-bugs mailing list