VoIP Cookbook: Example of /etc/sip.conf
Jump to navigation
Jump to search
; ; SIP configuration for Asterisk ; [general] disallow=all allow=ulaw port=5060 ; the SIP port which has to be bind (attach). bindaddr=0.0.0.0 ; Address in the SIP bind externip=xxx.xxx.xxx.xxx ; if we know the public IP address that we use localnet=192.168.0.0 localmask=255.255.255.0 context=inbound-sip ; Default context for incoming calls maxexpirey=180 defaultexpirey=160 tos=reliability srvlookup=yes
; IMPORTANT! Registration to SIP Server register => 2012345:abcdef@voiprakyat.or.id/2012345 ; username 2012345 password abcdef register => 2055555:123456@voiprakyat.or.id/2055555 ; username 2055555 passwd 123456
; We need to establish a SIP account in our place in order to receive calls from ; voiprakyat through our PABX ; [fwd1] type=friend secret=secret username=2055555 fromuser=2055555 fromdomain=voiprakyat.or.id host=voiprakyat.or.id dtmfmode=inband nat=yes canreinvite=no
[fwd2] type=friend secret=secret username=2012345 fromuser=2012345 fromdomain=voiprakyat.or.id host=voiprakyat.or.id dtmfmode=inband nat=yes canreinvite=no
; The following is a SIP account for IP phone in house / office ; [phone17] disallow=all allow=ulaw type=friend host=dynamic defaultip=192.168.0.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=192.168.0.18 dtmfmode=inband secret=voip18 mailbox=2204 context=home callerid="Kitchen" <2204> nat=no extensions.conf
; ; Static extension file configuration used by pbx_config module ; In this module we configure all incoming calls and outgoing 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 ; ; For this example the card used is ZAPTEL ; We can replace Zap/1, Zap/2, Zap/3 s/d Zap/5 ; with SIP account in Asterisk for IP Phone or WiFi Phone ; for example SIP/2000 to IP Phone with extension 2000 etc.
FWDUSERID1=2012345 FWD1USERNAME=William Mandra FWDUSERID2=2055555 FWD2USERNAME=Bujubuneng Mandra FWDPREFIX=*
HOMENUMBER=4208888
BILLCELLPHONE=0811888888 MOMCELLPHONE=0811999999 JESSCELLPHONE=0813222222
; ; Macro for Asterisk Extension ; [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 => 108,1,Dial(${DIALOUTANALOG}/${EXTEN},70) exten => 108,2,Macro(fastbusy) exten => 108,102,Playback(ss-noservice) exten => 108,103,Macro(fastbusy)
; Local PSTN ; [pstn-local] exten => _021.,1,Dial(${DIALOUTANALOG}/${EXTEN:3}) exten => _021.,2,Macro(fastbusy) exten => _021.,102,Macro(dialoutsip,${EXTEN})
[toll-free] exten => _0800.,1,Dial(${DIALOUTANALOG}/${EXTEN}) exten => _0800.,2,Macro(fastbusy) exten => _0800.,102,Macro(dialoutsip,${EXTEN})
[long-distance] exten => _0XXXXXXXXXX,1,Macro(dialoutsip,${EXTEN}) exten => _0XXXXXXXXXX,2,Macro(fastbusy) exten => _0XXXXXXXXXX,102,Dial(${DIALOUTANALOG}/${EXTEN}) exten => _0XXXXXXXXXX,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 => 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 => 2055555,1,Goto(inbound-fwd1,s,1) exten => 2012345,1,Goto(local,2206,1)
; ; Internal Extension ; [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 ; ; A variety of facilities that can be used for testing ;
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