Sip.conf, problems with NAT and externip


#1

Hello everybody.

I installed my asterisk with sip_conntrack module on my LAN / WAN gateway.

My big problem is with NAT, when I connect a phone from LAN to a phone on the WAN side, my local IP address is sent with SIP/SDP, so the phone fgrom wan can’t reply.

I’we read a lots of documentation and done a lots of tests but always the same problem…

I paste the content of my sip.conf, if someone have an idea :confused:

Thanks a lot in advance.


; Useful CLI commands to check peers/users:
; sip show peers Show all SIP peers (including friends)
; sip show users Show all SIP users (including friends)
; sip show registry Show all SIP servers
;
;
[general]
;
;
;
; -=[SIP proxies]=-
;
;
register => 719703:************@fwd.pulver.com/719703
register => xen:***************@prox1.n3network.ch/xen
;
externip=x3n.dyndns.org
;externhost=x3n.dyndns.org
localnet=192.168.0.0
localmask=255.255.255.0
;
port=5060
bindaddr=0.0.0.0
srvlookup=yes
;
;
;
;
;recordhistory=yes ; Record SIP history by default
; (see sip history / sip no history)
;realm=mydomain.tld ; Realm for digest authentication
; defaults to “asterisk”
; Realms MUST be globally unique according to RFC 3261
; Set this to your host name or domain name

;videosupport=yes ; Turn on support for SIP video
;
; -=[Codecs]=-
;musicclass=default ; Sets the default music on hold class for all SIP calls
; This may also be set for individual users/peers
language=fr ; Default language setting for all users/peers
; This may also be set for individual users/peers
;relaxdtmf=yes ; Relax dtmf handling
;rtptimeout=60 ; Terminate call if 60 seconds of no RTP activity
; when we’re not on hold
;rtpholdtimeout=300 ; Terminate call if 300 seconds of no RTP activity
; when we’re on hold (must be > rtptimeout)
;trustrpid = no ; If Remote-Party-ID should be trusted
;videosupport=yes ; Turn on support for SIP video
;
; -=[Codecs]=-
;musicclass=default ; Sets the default music on hold class for all SIP calls
; This may also be set for individual users/peers
language=fr ; Default language setting for all users/peers
; This may also be set for individual users/peers
;relaxdtmf=yes ; Relax dtmf handling
;rtptimeout=60 ; Terminate call if 60 seconds of no RTP activity
; when we’re not on hold
;rtpholdtimeout=300 ; Terminate call if 300 seconds of no RTP activity
; when we’re on hold (must be > rtptimeout)
;trustrpid = no ; If Remote-Party-ID should be trusted
;progressinband=no ; If we should generate in-band ringing always

;promiscredir = no ; If yes, allows 302 or REDIR to non-local SIP address
; ; Note that promiscredir when redirects are made to the
; ; local system will cause loops since SIP is incapable
; ; of performing a “hairpin” call.
;
; If regcontext is specified, Asterisk will dynamically
; create and destroy a NoOp priority 1 extension for a given
; peer who registers or unregisters with us. The actual extension
; is the ‘regexten’ parameter of the registering peer or its
; name if ‘regexten’ is not provided. More than one regexten may be supplied
; if they are separated by ‘&’. Patterns may be used in regexten.
;
; Asterisk can register as a SIP user agent to a SIP proxy (provider)
; Format for the register statement is:
; register => user[:secret[]]@host[:port][/extension]
;
; If no extension is given, the ‘s’ extension is used. The extension
; needs to be defined in extensions.conf to be able to accept calls
; from this SIP proxy (provider)
;
; host is either a host name defined in DNS or the name of a
; section defined below.
;
; Examples:
;
;register => 1234:password@mysipprovider.com
;
; This will pass incoming calls to the ‘s’ extension
;
;
;register => 2345:password@sip_proxy/1234
;
; Register 2345 at sip provider ‘sip_proxy’. Calls from this provider connect to local
; extension 1234 in extensions.conf default context, unless you define
; unless you configure a [sip_proxy] section below, and configure a context.
; Tip 1: Avoid assigning hostname to a sip.conf section like [provider.com]
; Tip 2: Use separate type=peer and type=user sections for SIP providers
; (instead of type=friend) if you have calls in both directions
;
;
[pstn01]
username=pstn01
secret=**************
type=friend
host=dynamic
allow=all
context=local
;
[xlite]
username=xlite
secret=**************
type=friend
host=dynamic
allow=all
context=local
nat=no
;
[xlite2]
username=xlite2
secret=****************
type=friend
host=dynamic
allow=all
context=local
nat=yes
;
[n3net]
type=friend
host=prox1.n3network.ch
username=xen
password=*****************
nat=yes
context=local
allow=all


Cya, Xen


#2

try adding nat=yes to your general configuration. also, i had problems when using the “localnet” line in my conf. i ended up commenting it out.


#3

See this thread for lots of good info on dealing with Sip/Nat configuration issues. You need to deal with forwarding ports, and making sure your sip.conf gets reloaded whenever your dynamic dns changes.

voxilla.com/index.php?name=PNphp … 0331#30331