[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
Tue May 17 09:05:02 CDT 2011


A NOTE has been added to this issue. 
====================================================================== 
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:                     needs license
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-17 09:05 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)


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

---------------------------------------------------------------------- 
 (0135043) hydrolife (reporter) - 2011-05-17 09:05
 https://issues.asterisk.org/view.php?id=19297#c135043 
---------------------------------------------------------------------- 
could we test the patch ? 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-05-17 09:05 hydrolife      Note Added: 0135043                          
======================================================================




More information about the asterisk-bugs mailing list