[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
Thu May 19 16:11:40 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-19 16:11 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)


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

---------------------------------------------------------------------- 
 (0135177) luckman212 (reporter) - 2011-05-19 16:11
 https://issues.asterisk.org/view.php?id=19297#c135177 
---------------------------------------------------------------------- 
Yes, this sounds really great for softphones on a 3g device -- would like
to test the patch as well !! 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-05-19 16:11 luckman212     Note Added: 0135177                          
======================================================================




More information about the asterisk-bugs mailing list