[asterisk-users] SIP server behind NAT
Guillaume Yziquel
guillaume.yziquel at citycable.ch
Tue Aug 4 05:11:55 CDT 2009
Hello.
I have an Asterisk server (ViciDialNow) set up behind NAT. I can manage
to make outbound calls, but the communication drops off after 30 seconds
or so.
I'd really appreciate having some assistance from the mailing list on
this issue.
So, I'm having an Asterisk server behind a firewall and Zoiper
softphones on SIP connecting to Asterisk on the same local area network.
The Asterisk server connects to a remote VoIP provider via SIP.
The extensions.conf and sip.conf follow below.
I contacted the provider to see if there was a specific problem, and I
was advised that my asterisk was not using standard ports for the
transit of voice (I assume they mean RTP on UDP). They're telling me
that, normally, the port 5004 should be used, or ports above 10000.
However for one of my outbound calls, they see me using port 3030.
Could someone advise me on the steps to follow, or to documentation on
this issue? Does this sound like a NAT issue?
All the best,
Guillaume Yziquel.
Here's the beginning of the sip.conf file:
> [general]
> context=default ; Default context for incoming calls
> ;allowguest=no ; Allow or reject guest calls (default is yes, this can also be set to 'osp'
> ;realm=mydomain.tld ; Realm for digest authentication
> bindport=5060 ; UDP Port to bind to (SIP standard port is 5060)
> bindaddr=0.0.0.0 ; IP address to bind to (0.0.0.0 binds to all)
> srvlookup=yes ; Enable DNS SRV lookups on outbound calls
> ;domain=mydomain.tld ; Set default domain for this host
> ;domain=mydomain.tld,mydomain-incoming
> ;domain=1.2.3.4 ; Add IP address as local domain
> ;allowexternalinvites=no ; Disable INVITE and REFER to non-local domains
> ;autodomain=yes ; Turn this on to have Asterisk add local host
> ;pedantic=yes ; Enable slow, pedantic checking for Pingtel
> ;tos=184 ; Set IP QoS to either a keyword or numeric val
> tos=lowdelay ; lowdelay,throughput,reliability,mincost,none
> maxexpiry=3600 ; Max length of incoming registration we allow
> defaultexpiry=120 ; Default length of incoming/outgoing registration
> ;notifymimetype=text/plain ; Allow overriding of mime type in MWI NOTIFY
> ;checkmwi=10 ; Default time between mailbox checks for peers
> ;vmexten=voicemail ; dialplan extension to reach mailbox sets the
> ;videosupport=yes ; Turn on support for SIP video
> ;recordhistory=yes ; Record SIP history by default
> disallow=all ; First disallow all codecs
> allow=ulaw ; Allow codecs in order of preference
> allow=gsm ;
> musicclass=default ; Sets the default music on hold class for all SIP calls
> language=en ; Default language setting for all users/peers
> relaxdtmf=yes ; Relax dtmf handling
> rtptimeout=60 ; Terminate call if 60 seconds of no RTP activity
> ;rtpholdtimeout=300 ; Terminate call if 300 seconds of no RTP activity
> trustrpid = no ; If Remote-Party-ID should be trusted
> sendrpid = yes ; If Remote-Party-ID should be sent
> progressinband=no ; If we should generate in-band ringing always
> useragent=My Asterisk ; Allows you to change the user agent string
> promiscredir = no ; If yes, allows 302 or REDIR to non-local SIP address
> ;usereqphone = no ; If yes, ";user=phone" is added to uri that contains
> dtmfmode = rfc2833 ; Set default dtmfmode for sending DTMF. Default: rfc2833
> ;compactheaders = yes ; send compact sip headers.
> ;sipdebug = yes ; Turn on SIP debugging by default, from
> ;subscribecontext = default ; Set a specific context for SUBSCRIBE requests
> ;notifyringing = yes ; Notify subscriptions on RINGING state
> ;alwaysauthreject = yes ; When an incoming INVITE or REGISTER is to be rejected,
> ;regcontext=sipregistrations
> ;registertimeout=20 ; retry registration calls every 20 seconds (default)
> ;registerattempts=10 ; Number of registration attempts before we give up
> callevents=no ; generate manager events when sip ua performs events (e.g. hold)
> externip=The_IP_of_my_router ; Address that we're going to put in outbound SIP messages
> ;externhost=foo.dyndns.net ; Alternatively you can specify an
> ;externrefresh=10 ; How often to refresh externhost if
> localnet=192.168.0.0/255.255.0.0; All RFC 1918 addresses are local networks
> localnet=10.0.0.0/255.0.0.0 ; Also RFC1918
> localnet=172.16.0.0/12 ; Another RFC1918 with CIDR notation
> localnet=169.254.0.0/255.255.0.0 ;Zero conf local network
> nat=yes ; Global NAT settings (Affects all peers and users)
> canreinvite=no
> ;rtcachefriends=yes ; Cache realtime friends by adding them to the internal list
> ;rtupdate=yes ; Send registry updates to database using realtime? (yes|no)
> ;rtautoclear=yes ; Auto-Expire friends created on the fly on the same schedule
> ;ignoreregexpire=yes ; Enabling this setting has two functions:
> ; domain=myasterisk.dom
> ; domain=customer.com,customer-context
> ; autodomain=yes
> ; fromdomain=mydomain.tld ; When making outbound SIP INVITEs to
>
> #include sip-vicidial.conf
>
> ; register SIP account on remote machine if using SIP trunks
> ; register => testSIPtrunk:test at 10.10.10.16:5060
> ;
> ; setup account for SIP trunking:
> ; [SIPtrunk]
> ; disallow=all
> ; allow=ulaw
> ; allow=alaw
> ; type=friend
> ; username=testSIPtrunk
> ; secret=test
> ; host=10.10.10.16
> ; dtmfmode=inband
> ; qualify=1000
Here's the beginning of the sip-vicidial.conf file:
> ; WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST
> register => my_username:my_secret:my_username at myvoipprovider
>
> ; VICIDIAL Carrier: My VOIP provider
> [myvoipprovider]
> type=peer
> host=adress.of.my.sip.server
> fromuser=my_username
> username=my_secret
> secret=my_secret
> context=default
> dtmfmode=rfc2833
> disallow=all
> allow=alaw
> allow=ulaw
> allow=g729
> allow=g723
> insecure=invite,port
> nat=yes
> canreinvite=no
>
>
>
> [100]
> username=100
> secret=100
> mailbox=100
> context=default
> type=friend
> host=dynamic
>
> [101]
> username=101
> secret=101
> mailbox=101
> context=default
> type=friend
> host=dynamic
Here's the beginning of the extensions.conf file:
> [general]
> static=yes
> writeprotect=no
>
> [globals]
> CONSOLE=Console/dsp ; Console interface for demo
> ;TRUNK=Zap/g1 ; Trunk interface
> ;TRUNKX=Zap/g2 ; 2nd trunk interface
> ;TRUNKIAX=IAX2/ASTtest1:test at 10.10.10.16:4569 ; IAX trunk interface
> ;TRUNKIAX1=IAX2/ASTtest1:test at 10.10.10.16:4569 ; IAX trunk interface
> ;TRUNKBINFONE=IAX2/1112223333:PASSWORD at iax.binfone.com ; IAX trunk interface
> ;SIPtrunk=SIP/1234:PASSWORD at sip.provider.net ; SIP trunk
> TRUNKloop = IAX2/ASTloop:test at 127.0.0.1:40569 ; used for blind monitoring
> TRUNKblind = IAX2/ASTblind:test at 127.0.0.1:41569 ; used for testing
>
> #include extensions-vicidial.conf
>
> [trunkinbound]
> ; agent dial-in:
> exten => 2345,1,Answer ; Answer the line
> exten => 2345,2,AGI(agi-AGENT_dial_in.agi)
> exten => 2345,3,Hangup
>
> ; DID call routing process
> exten => _X.,1,AGI(agi-DID_route.agi)
>
> ; FastAGI for VICIDIAL/astGUIclient call logging
> exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME})
>
>
>
> [default]
> include => vicidial-auto
>
> ; Local agent alert extensions
> exten => _8600XXX*.,1,AGI(agi-VDADfixCXFER.agi)
> exten => _78600XXX*.,1,AGI(agi-VDADfixCXFER.agi)
> ; Local blind monitoring
> exten => _08600XXX,1,Dial(${TRUNKblind}/6${EXTEN:1},55,To)
>
>
> ;;;;;;;;;; BEGIN Voicemail and Prompts Section ;;;;;;;;;;;;;;;;;;;;;;;
> ; Give voicemail at extension 8500
> exten => 8500,1,VoicemailMain
> exten => 8500,2,Goto(s,6)
>
> [...]
Here's the beginning of extensions-vicidial.conf:
> WARNING- THIS FILE IS AUTO-GENERATED BY VICIDIAL, ANY EDITS YOU MAKE WILL BE LOST
>
>
> [vicidial-auto]
> exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG--------------------)
>
> ; Local Server: 192.168.XX.XX
> exten => _192*168*XXX*XXX*.,1,Goto(default,${EXTEN:16},1)
> ; VICIDIAL Carrier: My VOIP provider
> exten => _X.,1,NoOp()
> exten => _X.,n,Answer()
> exten => _X.,n,Dial(SIP/myvoipprovider/${EXTEN})
>
> exten => 100,1,Dial(SIP/100)
> exten => 100,2,Voicemail,u100
> exten => 101,1,Dial(SIP/101)
> exten => 101,2,Voicemail,u101
More information about the asterisk-users
mailing list