[general]
[globals]
ARON=SIP/Aron
CARMEN=SIP/Carmen
CARLOS=SIP/Register
MARIA=SIP/Maria
BRIAN=SIP/RemoteBrian
CLAUDIA=IAX2/Claudia
JUANITA=IAX2/Juanita
FILOMENA=IAX2/Filomena
BE=IAX2/Be
WALTER=IAX2/Walter
VOIPOUT1=IAX2/voicepulse01
VOIPOUT2=IAX2/voicepulse02
VOIPOUT3=SIP/asterlink
;VOIPOUT=iax2/RabinGlove@nufone
;VOIPOUT=proxy01.sipphone.com
POTSOUT=ZAP/g1
[inbound]
exten=> 8882717336,1,goto(open,s,1) ;use toll free for failover
; First, let’s do the holidays
include => holiday|||1|jan
include => holiday|||28|may
include => holiday|||4|jul
include => holiday|||4|sep
include => holiday|||23|nov
include => holiday|||25|dec
include => holiday|||31|dec
; these are the days we’re open
include => open|06:20-18:45|mon-fri||
include => open|06:20-13:45|sat||
; if we’re not open, we’re closed (duh!)
include => closed
[open]
exten => s,1,Answer
exten => s,n,wait(1)
exten => s,n,Dial(zap/1&zap/2&sip/carmen&sip/aron&sip/maria&sip/register,25)
exten => s,n,voicemail(b0)
exten => s,n,hangup
[holiday]
exten => s,1,Answer
exten => s,n,wait(1)
exten => s,n(dial),Dial(zap/1&zap/2&zap/3&sip/carmen&sip/aron&sip/maria&sip/register,3)
exten => s,n,voicemail(u00)
exten => s,n,hangup
[closed]
exten => s,1,Answer
exten => s,n,wait(1)
exten => s,n(dial),Dial(zap/1&zap/2&zap/3&sip/carmen&sip/aron&sip/maria&sip/register&sip
/RemoteBrian,3)
exten => s,n,voicemail(u0)
exten => s,n,hangup
[outbound]
exten => asterisk,1,VoiceMailMain("${CALLERIDNUM}")
;hints
exten => 100,hint,SIP/Aron
exten => 101,hint,SIP/Carmen
exten => 103,hint,SIP/Register
exten => 109,hint,SIP/Maria
exten => 701,1,ParkedCall(701)
exten => 701,hint,park:701@parkedcalls
exten => 702,1,ParkedCall(702)
exten => 702,hint,park:702@parkedcalls
exten => 703,1,ParkedCall(703)
exten => 703,hint,park:703@parkedcalls
'lines’
exten => 00,1,goto(700,1)
exten => 01,1,goto(701,1)
exten => 02,1,goto(702,1)
exten => 03,1,goto(703,1)
include => emergency
include => parkedcalls
include => inside
include => local
include => toll
[notoll]
include => emergency
include => parkedcalls
include => inside
include => local
[internal]
include => emergency
include => parkedcalls
include => inside
[toll]
exten => _011.,1,macro(voip_call,${EXTEN})
;Force use of POTS with “9” prefix, w/ or w/o “1” prefix
exten => _91NXXNXXXXXX,1,Dial(${POTSOUT}/ww${EXTEN:1},60)
exten => _91NXXNXXXXXX,2,hangup
exten => _9NXXNXXXXXX,1,Dial(${POTSOUT}/ww${EXTEN:1},60)
exten => _9NXXNXXXXXX,2,hangup
exten => _1NXXNXXXXXX,1,macro(voip_call,${EXTEN})
exten => _NXXNXXXXXX,1,macro(voip_call,1${EXTEN})
exten => _81NXXNXXXXXX,1,macro(voip_call,${EXTEN:1})
exten => _8NXXNXXXXXX,1,macro(voip_call,1${EXTEN:1})
exten => _71NXXNXXXXXX,1,set(CALLERID(num)=9734651640)
exten => _71NXXNXXXXXX,n,dial(${VOIPOUT3}/${EXTEN:1})
exten => _7NXXNXXXXXX,1,dial(${VOIPOUT3}/1${EXTEN:1})
exten => _71NXXNXXXXXX,1,dial(${VOIPOUT3}/${EXTEN:1})
exten => _7NXXNXXXXXX,1,dial(${VOIPOUT3}/1${EXTEN:1})
[inside]
;Internal Extensions
exten => 0,1,Dial(zap/G2,60)
exten => 00,1,Dial(SIP/Carmen&SIP/Aron&SIP/Carlos&SIP/Maria&SIP/Register,60)
exten => 100,1,macro(internal_extension,100,${ARON})
exten => 101,1,macro(internal_extension,101,${CARMEN})
exten => 102,1,macro(internal_extension,102,${CARLOS})
exten => 103,1,macro(internal_extension,103,sip/Register)
exten => 104,1,macro(internal_extension,104,zap/1)
exten => 105,1,macro(internal_extension,105,zap/2)
exten => 106,1,macro(internal_extension,106,zap/3)
exten => 109,1,macro(internal_extension,109,${MARIA})
exten => 108,1,macro(internal_extension,108,${BRIAN})
exten => 999,1,dial(zap/4) ;the horn
exten => 999,n,hangup
exten => _*10[0-9],1,voicemail(b${EXTEN:1})
exten => _**10[0-9],1,voicemail(u${EXTEN:2})
exten => *0,1,voicemail(b${EXTEN:1})
exten => **0,1,voicemail(u${EXTEN:2})
exten => *00,1,voicemail(b${EXTEN:1})
exten => **00,1,voicemail(u${EXTEN:2})
exten => 199,1,answer
exten => 199,n,wait(2)
exten => 199,n,Set(CALLERID(name)=M-${CALLERIDNAME})
exten => 199,n,sipaddheader(“Alert-Info:http://www.notused.com;info=alert-external;x-line-id=0”) ;DISTINCT RING
exten => 199,n,dial(sip/maria&sip/carmen,15)
exten => 199,n,voicemail(u109)
;snom PAGE
exten => _910[0-9],1,SIPAddHeader(Call-Info:sip:domain;answer-after=0)
exten => _910[0-9],n,goto(inside,${EXTEN:1},1)
exten => _910[0-9],n,hangup
;MeetMe
exten=> _50X,1,meetme(${EXTEN})
;Voicemail System
exten => 5000,1,answer()
exten => 5000,2,voicemailmain()
exten => 5000,3,hangup()
exten => 900,1,goto(func,s,1)
[func] ;I have the func
exten => s,1,Answer
exten => s,n,Background(func_instruct) ;1 for away vm, 2 for busy vm, 3 to page
exten => s,n,Set(TIMEOUT(response)=15)
exten => s,n,Set(TIMEOUT(digit)=3)
exten => _[123],1,Set(DB(FLAGS/${CALLERID(num)})=${EXTEN}) ;set db vals and hangup so some channels get dialtone ASAP
exten => _[123],n,hangup
[macro-pots_call]
exten => s,1,dial(${POTSOUT}/${ARG1},60)
exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status
exten => s-CHANUNAVAIL,1,playback(tt-somethingwrong)
exten => s-CHANUNAVAIL,2,wait(5)
exten => s-CHANUNAVAIL,3,macro(voip_call,${ARG1})
exten => s.,1,hangup
[macro-voip_call]
exten => s,1,set(CALLERID(num)=9734651640)
exten => s,n,set(PROV_COUNT=1)
exten => s,n(start),dial(${VOIPOUT${PROV_COUNT}}/${ARG1},60)
exten => s,n,Goto(s-${DIALSTATUS},1) ; Jump based on status
exten => s-CHANUNAVAIL,1,set(PROV_COUNT=$[${PROV_COUNT}+1])
exten => s-CHANUNAVAIL,n,gotoif($[${PROV_COUNT}<4]?s,start)
exten => s-CHANUNAVAIL,playback(please-hold)
exten => s-CHANUNAVAIL,n,macro(pots_call,${ARG1})
exten => s.,1,hangup
[macro-internal_extension]
exten => s,1,Gotoif($[${DB(FLAGS/${CALLERID(num)})}=1]?s-NOANSWER,1) ; if flag set call VM
exten => s,n,Gotoif($[${DB(FLAGS/${CALLERID(num)})}=2]?s-BUSY,1) ; do same but lie and say busy
exten => s,n,Gotoif($[${DB(FLAGS/${CALLERID(num)})}=3]?s-PAGE,1) ; page the guy, or just dial the interface as per usual
exten => s,n(dial),Dial(${ARG2},20) ; Ring the interface, 20 seconds maximum
exten => s,n,Goto(s-${DIALSTATUS},1) ; Jump based on status
exten => s-BUSY,1,Set(DB(FLAGS/${CALLERID(num)})=0)
exten => s-BUSY,n,Voicemail(b${ARG1}) ; If busy, send to voicemail w/ busy announce
exten => s-BUSY,n,Hangup
exten => s-NOANSWER,1,Set(DB(FLAGS/${CALLERID(num)})=0)
exten => s-NOANSWER,n,Voicemail(u${ARG1}) ; If unavailable, send to voicemail w/ unavail
exten => s-NOANSWER,n,Hangup
exten => s-PAGE,1,Set(DB(FLAGS/${CALLERID(num)})=0)
exten => s-PAGE,n,SIPAddHeader(Call-Info:sip:domain;answer-after=0) ;substitute YOUR hardware’s SDP page value
exten => s-PAGE,n,goto(s,dial)
exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer
[emergency]
exten => 911,1,dial(zap/G1/ww911)
exten => 911,n,wait(2)
exten => 911,n,dial(zap/G1/ww911)
exten => 911,n,dial(${VOIPOUT}/ww19733667111,g) ; non-emergency is the next best thing
exten => 911,n,goto(emergency,911,1)