[Asterisk-Users] Asterisk behind NAT to SIP provider
Jan Janak
jan at iptel.org
Sat Oct 25 03:07:12 MST 2003
I experimented a little bit and Asterisk behind NAT with SIP works. I created
an account at iptel.org and use that account for outbound SIP traffic from
Asterisk.
I am using asterisk at iptel.org, all the SIP traffic will be sent to
iptel.org proxy and the proxy will take care of NAT traversal. Currently
I forward all numbers begining with 3 to iptel.org beucase I don't know
how to create "fall-back" rule that will match when there are no other
rules (neither i nor _. works for me).
In the other direction, calls to asterisk at iptel.org get translated to
jan at my_asterisk_box and user jan registered at the asterisk box will
receive them.
To able able to call anywhere through iptel.org, From header field must
contain iptel.org so fromdomain parameter is necesarry in [iptel]
section.
Testing scenario was as follows:
[Caller]----[*]---[NAT]----[iptel.org (public inet)]----[NAT]---[Callee]
and vice versa.
sip.conf and extensions.conf follow. I have no previous experience in
configuriing asterisk so maybe the config files are not the best ones, I
simply took John Todd's config files and tweaked them a bit, it seems to
work for me.
To iptel.org proxy asterisk looks like a normal SIP user agent behind
NAT. iptel.org is running SER with extended nathelper and RTP proxy.
Jan.
;
; SIP Configuration for Asterisk
;
[general]
port = 5060 ; Port to bind to
bindaddr = 0.0.0.0 ; Address to bind to
context = from-sip ; Default for incoming calls
;
register => asterisk:password at iptel.org/jan ; Register with a SIP
provider
[iptel]
type=friend
username=asterisk
secret=password
fromdomain=iptel.org
host=iptel.org
[jan]
type=friend
username=jan
host=dynamic
canreinvite=no
extensions.conf:
[from-sip]
exten => jan,1,Dial(SIP/jan)
exten => jan,2,Hangup
exten => _3.,1,SetCallerID(jan)
exten => _3.,2,SetCIDName(Jan Janak)
exten => _3.,3,Dial(SIP/${EXTEN:1}@iptel)
exten => _3.,4,Playback(invalid)
exten => _3.,5,Hangup
More information about the asterisk-users
mailing list