[Asterisk-Users] FWD<->NAT<->* config info

William J Mandra william.mandra at us.army.mil
Sat Apr 17 22:46:26 MST 2004


Here is my sip.conf and extensions.conf which allow me inbound and outbound
calling between * and Freeworld Dialup, with * behind a NAT.

;
; SIP Configuration for Asterisk
;

[general]
disallow=all
allow=ulaw
port=5060			; Port to bind to
bindaddr=0.0.0.0		; Address to bind SIP channel to
externip=xxx.xxx.xxx.xxx
localnet=172.16.1.0
localmask=255.255.255.0
context=inbound-sip		; Default context for incoming calls
maxexpirey=180
defaultexpirey=160
tos=reliability
srvlookup=yes
register => 290805:secret at fwd.pulver.com/290805
register => 293440:secret at fwd.pulver.com/293440

[fwd1]
type=friend
secret=secret
username=293440
fromuser=293440
fromdomain=fwd.pulver.com
host=fwd.pulver.com
dtmfmode=inband
nat=yes
canreinvite=no

[fwd2]
type=friend
secret=secret
username=290805
fromuser=290805
fromdomain=fwd.pulver.com
host=fwd.pulver.com
dtmfmode=inband
nat=yes
canreinvite=no

[phone17]
disallow=all
allow=ulaw
type=friend
host=dynamic
defaultip=172.16.1.17
dtmfmode=inband
secret=voip17
mailbox=2206
context=home
callerid="Bill Mandra" <2206>
nat=no

[phone18]
disallow=all
allow=ulaw
type=friend
host=dynamic
defaultip=172.16.1.18
dtmfmode=inband
secret=voip18
mailbox=2201
context=home
callerid="Kitchen" <2204>
nat=no

;
; Static extension configuration file, used by
; the pbx_config module. This is where you configure all your
; inbound and outbound calls in Asterisk.
;

[general]
static=yes
writeprotect=no

[globals]
DIALOUTANALOG=Zap/1
MAINPHONE=Zap/2
JESSICA=Zap/3
CHRISTOPHER=Zap/4
PORCH=Zap/5
KITCHEN=SIP/phone18
BILL=SIP/phone17

FWDUSERID1=290805
FWD1USERNAME=William Mandra
FWDUSERID2=293440
FWD2USERNAME=Donna Mandra
FWDPREFIX=*

HOMENUMBER=XXXXXXXXXX

BILLCELLPHONE=9XXXXXXXXXX
MOMCELLPHONE=1XXXXXXXXXX
;JESSCELLPHONE=1XXXXXXXXXX

;
; Macros
;

[macro-fastbusy]
exten => s,1,Answer
exten => s,2,Wait,1
exten => s,3,Playback(ss-noservice)
exten => s,4,Wait(30)
exten => s,5,Hangup

[macro-dialoutsip]
exten => s,1,SetCallerID(${FWDUSERID2})
exten => s,2,SetCIDName(${FWD2USERNAME})
exten => s,3,Dial(SIP/${FWDPREFIX}${ARG1}@fwd1,70)
exten => s,4,Macro(fastbusy)
exten => s,5,Hangup
exten => s,104,Macro(fastbusy)
exten => s,105,Wait,3
exten => s,106,Playtones(congestion)
exten => s,107,Wait,30
exten => s,108,Hangup

[macro-billcellfwdoutsip2]
exten => s,1,SetCallerID(${ARG2})
exten => s,2,Dial(SIP/${FWDPREFIX}${ARG1}@fwd2,20)
exten => s,3,Goto(local,2206,4)
exten => s,102,Goto(local,2206,4

;
; Outbound
;

[operator]
exten => 0,1,Dial(${DIALOUTANALOG}/${EXTEN},70)
exten => 0,2,Macro(fastbusy)
exten => 0,102,Playback(ss-noservice)
exten => 0,103,Macro(fastbusy)

[e911]
exten => 911,1,Dial(${DIALOUTANALOG}/${EXTEN})
exten => 911,2,Macro(fastbusy)
exten => 911,102,Playback(ss-noservice)
exten => 911,103,Macro(fastbusy)

[forced-analog]
exten => _9.,1,Dial(${DIALOUTANALOG}/${EXTEN:1},70)
exten => _9.,2,Macro(fastbusy)
exten => _9.,102,Macro(fastbusy)

[fwd1-out]
exten => _8.,1,SetCallerID(${FWDUSERID2})
exten => _8.,2,SetCIDName(${FWD2USERNAME})
exten => _8.,3,Dial(SIP/${EXTEN:1}@fwd1,70)
exten => _8.,4,Macro(fastbusy)
exten => _8.,5,Hangup

[fwd2-out-pvt]
exten => _7.,1,SetCallerID(${FWDUSERID1})
exten => _7.,2,SetCIDName(${FWD1USERNAME})
exten => _7.,3,Dial(SIP/${EXTEN:1}@fwd2,70)
exten => _7.,4,Macro(fastbusy)
exten => _7.,5,Hangup

[information]
exten => 411,1,Dial(${DIALOUTANALOG}/${EXTEN},70)
exten => 411,2,Macro(fastbusy)
exten => 411,102,Playback(ss-noservice)
exten => 411,103,Macro(fastbusy)

[pstn-local]
exten => _1973.,1,Dial(${DIALOUTANALOG}/${EXTEN:1})
exten => _1973.,2,Macro(fastbusy)
exten => _1973.,102,Macro(dialoutsip,${EXTEN})

exten => _1201.,1,Dial(${DIALOUTANALOG}/${EXTEN})
exten => _1201.,2,Macro(fastbusy)
exten => _1201.,102,Macro(dialoutsip,${EXTEN})

[pstn-local-toll]
exten => _11973.,1,Dial(${DIALOUTANALOG}/${EXTEN:1})
exten => _11973.,2,Marco(fastbusy)
exten => _11973.,102,Macro(dialoutsip,${EXTEN:1})

exten => _11201.,1,Dial(${DIALOUTANALOG}/$EXTEN:1})
exten => _11201.,2,Macro(fastbusy)
exten => _11201.,102,Macro(dialoutsip,${EXTEN:1})

[toll-free]
exten => _1888.,1,Dial(${DIALOUTANALOG}/${EXTEN})
exten => _1888.,2,Macro(fastbusy)
exten => _1888.,102,Macro(dialoutsip,${EXTEN})

exten => _1877.,1,Dial(${DIALOUTANALOG}/$EXTEN})
exten => _1877.,2,Macro(fastbusy)
exten => _1877.,102,Macro(dialoutsip,${EXTEN})

exten => _1855.,1,Dial(${DIALOUTANALOG}/{${EXTEN})
exten => _1855.,2,Macro(fastbusy)
exten => _1855.,102,Macro(dialoutsip,${EXTEN})

exten => _1800.,1,Dial(${DIALOUTANALOG}/${EXTEN})
exten => _1800.,2,Macro(fastbusy)
exten => _1800.,102,Macro(dialoutsip,${EXTEN})

[long-distance]
exten => _1XXXXXXXXXX,1,Macro(dialoutsip,${EXTEN})
exten => _1XXXXXXXXXX,2,Macro(fastbusy)
exten => _1XXXXXXXXXX,102,Dial(${DIALOUTANALOG}/${EXTEN})
exten => _1XXXXXXXXXX,103,Macro(fastbusy)

[home]
include => operator
include => e911
include => forced-analog
include => fwd1-out
include => fwd2-out-pvt
include => information
include => local
include => pstn-local
include => pstn-local-toll
include => toll-free
include => long-distance

;
; Inbound
;   analog line

[nighttime-analog]
exten => s,1,Wait(2)
exten => s,2,Background(nighttime)
exten => 1,1,Goto(daytime-analog,s,1)
exten => 2,1,Voicemail(u2201)
exten => 3,1,Voicemail(u2206)
exten => 4,1,Voicemail(u2202)
exten => 9,1,Playback(transfer)
exten => 9,2,Ringing(1)
exten => 9,3,Goto(local,2206,1)

[daytime-analog]
exten => s,1,Zapateller(answer|nocallerid)
exten => s,2,PrivacyManager
exten => s,3,Ringing(1)
exten => s,4,Dial(${MAINPHONE}&${KITCHEN},15)
exten => s,5,Dial(${JESSICA},6)
exten => s,6,Dial(${BILL},6)
exten => s,7,Voicemail(u2201)
exten => s,8,Hangup

[inbound-analog]
include => daytime-analog|9:00-21:00|*|*
include => nighttime-analog|21:00-09:00|*|*

;   sip lines

[nighttime-fwd1]
exten => s,1,Wait(2)
exten => s,2,Background(nighttime)
exten => 1,1,Goto(daytime-sip1,s,1)
exten => 2,1,Voicemail(u2201)
exten => 3,1,Voicemail(u2206)
exten => 4,1,Voicemail(u2202)
exten => 9,1,Playback(transfer)
exten => 9,2,Goto(local,2206,1)

[daytime-fwd1]
exten => s,1,Dial(${MAINPHONE}&${KITCHEN},15)
exten => s,2,Dial(${JESSICA},6)
exten => s,3,Dial(${BILL},6)
exten => s,4,Voicemail(u2201)
exten => s,5,Hangup

[inbound-fwd1]
include => daytime-fwd1|9:00-21:00|*|*
include => nighttime-fwd1|21:00-9:00|*|*

[inbound-sip]
exten => 293440,1,Goto(inbound-fwd1,s,1)
exten => 290805,1,Goto(local,2206,1)

;
; Internal Extensions
;

[local]
exten => 2201,1,Dial(${MAINPHONE},20,Tt)
exten => 2201,2,Voicemail(u2201)
exten => 2201,3,Hangup
exten => 2201,102,Voicemail(b2201)
exten => 2201,103,Hangup

exten => 2202,1,Dial(${JESSICA},20,Tt)
exten => 2202,2,Voicemail(u2202)
exten => 2202,3,Hangup
exten => 2202,102,Voicemail(b2202)
exten => 2202,103,Hangup

exten => 2203,1,Dial(${CHRISTOPHER},20,Tt)
exten => 2203,2,Playback(vm-nobodyavail)
exten => 2203,3,Hangup

exten => 2204,1,Dial(${KITCHEN},20,Tt)
exten => 2204,2,Playback(vm-nobodyavail)
exten => 2204,3,Hangup

exten => 2205,1,Dial(${PORCH},20,Tt)
exten => 2205,2,Playback(vm-nobodyavail)
exten => 2205,3,Hangup

exten => 2206,1,Dial(${BILL},20,Tt)
exten => 2206,2,Playback(transfer)
exten => 2206,3,Macro(billcellfwdoutsip2,${BILLCELLPHONE},${CALLERIDNUM})
exten => 2206,4,Voicemail(u2206)
exten => 2206,5,Hangup
exten => 2206,102,Voicemail(b2206)
exten => 2206,103,Hangup

exten => 2500,1,Wait,2
exten => 2500,2,VoicemailMain
exten => 2500,3,Hangup

;Test extensions
exten => 2001,1,Answer
exten => 2001,2,Playback(demo-echotest)
exten => 2001,3,Echo
exten => 2001,4,Playback(demo-echodone)
exten => 2001,5,Hangup

exten => 2002,1,Answer
exten => 2002,2,WaitMusicOnHold(30)
exten => 2002,3,Hangup

exten => 2003,1,Answer
exten => 2003,2,Wait(1)
exten => 2003,3,SayUnixTime( | | k)
exten => 2003,4,SayUnixTime( | | M)
exten => 2003,5,Playback(vm-and)
exten => 2003,6,SayUnixTime( | | S)
exten => 2003,7,Wait(2)
exten => 2003,8,Hangup

exten => 2004,1,Answer
exten => 2004,2,Wait(1)
exten => 2004,3,Playback(vm-extension)
exten => 2004,4,SayDigits(${CALLERIDNUM})
exten => 2004,5,Wait(2)
exten => 2004,6,Hangup

exten => 2005,1,Goto(nighttime-analog,s,1)
;exten => 2005,2,Playback(ss-noservice)
;exten => 2005,3,Playback(vm-nobodyavail)
;exten => 2005,4,Playback(agent-incorrect)
;exten => 2005,5,Playback(agent-user)
;exten => 2005,6,Playback(pbx-invalid)
;exten => 2005,7,Playback(tt-somethingwrong)
;exten => 2005,8,Playback(vm-extension)
;exten => 2005,9,Playback(vm-isunavail)
;exten => 2005,10,Playback(vm-isonphone)
;exten => 2005,11,Playback(vm-sorry)
exten => 2005,2,Hangup

William Mandra




More information about the asterisk-users mailing list