Very good dialplan example.
[general]
;
;
;
static=yes
;
; if static=yes and writeprotect=no, you can save dialplan by
; CLI command 'save dialplan' too
;
writeprotect=no
;
;
[globals]
;
;*************************************************************
; BEGIN - Global variable definitions
;*************************************************************
;
;
; External dial tone access via Digium FXO ports
;
; ZAP Group 1, connected to Panasonic KSU CO 3/4
;
;
PANA=ZAP/g1 ; for use by SIP extensions so that they
; can dial internal Panasonic extensions
;
; ZAP Group 2, connected to Panasonic KSU CO 3/4
;
;
PSTN=ZAP/g2 ; for outbound analog pick up EXT 24 or 25
; remember to dial 9
;
;
; External dial tone via VoicePulse
;
IAXCO1=IAX2/user-name:pass-word@vpconnect-t01 ; Voicepulse host 1 outbound
IAXCO2=IAX2/user-name:pass-word@vpconnect-t02 ; Voicepulse host 2 outbound
IAXCID=9005551212
;
; External dial tone via BroadVoice
;
SIPCO1=@broadvoice ; Broadvoice host
SIPCID=9005551212
;
;
Usr1CIDNAME="User One" ; Usr1's caller ID name setting
Usr1VM=11@internal ; Usr1's voice mail box
Usr1CID=9005551212 ; Usr1's caller ID setting
Usr1EXTEN=11 ; Usr1's default extension
Usr1REM1=9005551212 ; Usr1's cell phone
Usr1REM2=9005551212 ; Usr1's office phone
Usr1NMFILE=custom/Usr1
;
Usr2CIDNAME="User Two" ; Usr2's caller ID name setting
Usr2VM=13@internal ; Usr2's voice mail box
Usr2CID=9005551212 ; Usr2's caller ID setting
Usr2EXTEN=13 ; Usr2's default extension
Usr2REM1=9005551212 ; Usr2's cell phone
Usr2REM2=
Usr2NMFILE=custom/Usr2
;
;
; Timeout periods in seconds
;
DEFTIMEOUT=30
VERYSHORTTIMEOUT=10
SHORTTIMEOUT=20
MEDTIMEOUT=40
LONGTIMEOUT=70
;
;
RINGINGLINE=foo
FOUNDME=foo
FLOWCONTROL=foo
FLOWCONFIRM=foo
ReturnTo=foo
FLOWPROCEED=foo
FLOWABORT=foo
CONFIRM=foo
;
; set the default point of contact
;
DEFCIDNAME=${Usr1CIDNAME}
DEFVM=${Usr1VM}
DEFCID=${Usr1CID}
DEFEXTEN=${Usr1EXTEN}
DEFREM1=${Usr1REM1}
DEFREM2=${Usr1REM2}
DEFNMFILE=${Usr1NMFILE}
;
NM=${DEFCIDNAME})
VM=${DEFVM})
ID=${DEFCID})
EXT=${DEFEXTEN})
REM1=${DEFREM1})
REM2=${DEFREM2})
NMFILE={DEFNMFILE})
;
;
; use these to transfer using hook flash transfer - tricky
;
PANAEXT11=11 ; Usr1's office
PANAEXT12=12 ; Usr1's bedroom
PANAEXT13=13 ; Usr2's bedroom
PANAEXT14=14 ; Usr3's bedroom
PANAEXT15=15 ; Usr4's bedroom
PANAEXT16=16 ; kitchen
PANAEXT17=17 ; family room
PANAEXT18=18 ; wireless
PANAEXT19=19 ; office 2
PANAEXT20=20
PANAEXT21=21
PANAEXT22=22
PANAEXT23=23
;
PAGE=34
;
;*************************************************************
; END - Global variable definitions
;*************************************************************
;
;
;*************************************************************
; BEGIN - Include contexts
;*************************************************************
;
;
[set-global-vars]
;
;
exten => _436,1,SetGlobalVar(NM=${Usr1CIDNAME})
exten => _436,2,SetGlobalVar(VM=${Usr1VM})
exten => _436,3,SetGlobalVar(ID=${Usr1CID})
exten => _436,4,SetGlobalVar(EXT=${Usr1EXTEN})
exten => _436,5,SetGlobalVar(REM1=${Usr1REM1})
exten => _436,6,SetGlobalVar(REM2=${Usr1REM2})
exten => _436,7,SetGlobalVar(NMFILE=${Usr1NMFILE})
exten => _436,8,Goto(s-CONFIRM,1)
;
exten => _427,1,SetGlobalVar(NM=${Usr1CIDNAME})
exten => _427,2,SetGlobalVar(VM=${Usr1VM})
exten => _427,3,SetGlobalVar(ID=${Usr1CID})
exten => _427,4,SetGlobalVar(EXT=${Usr1EXTEN})
exten => _427,5,SetGlobalVar(REM1=${Usr1REM1})
exten => _427,6,SetGlobalVar(REM2=${Usr1REM2})
exten => _427,7,SetGlobalVar(NMFILE=${Usr1NMFILE})
exten => _427,8,Goto(s-CONFIRM,1)
;
exten => _837,1,SetGlobalVar(NM=${Usr2CIDNAME})
exten => _837,2,SetGlobalVar(VM=${Usr2VM})
exten => _837,3,SetGlobalVar(ID=${Usr2CID})
exten => _837,4,SetGlobalVar(EXT=${Usr2EXTEN})
exten => _837,5,SetGlobalVar(REM1=${Usr2REM1})
exten => _837,6,SetGlobalVar(REM2=${Usr2REM2})
exten => _837,7,SetGlobalVar(NMFILE=${Usr2NMFILE})
exten => _837,8,Goto(s-CONFIRM,1)
;
;
;
exten => _XXX,1,Goto(s-INVALID,1)
;
;
[pana-trans]
;
; This context provides access to internal extensions
;
;
exten => _11,1,macro(pana-transfer,${PANAEXT11},${Usr1NMFILE},${RINGINGLINE},${Usr1VM})
exten => _12,1,macro(pana-transfer,${PANAEXT12},${Usr1NMFILE},${RINGINGLINE},${Usr1VM})
exten => _13,1,macro(pana-transfer,${PANAEXT13},${Usr2NMFILE},${RINGINGLINE},${Usr2VM})
exten => _14,1,macro(pana-transfer,${PANAEXT14},${Usr3NMFILE},${RINGINGLINE},${Usr3VM})
exten => _15,1,macro(pana-transfer,${PANAEXT15},${Usr4NMFILE},${RINGINGLINE},${Usr4VM})
exten => _16,1,macro(pana-
exten => _23,1,macro(pana-transfer,${PANAEXT23},${Usr1NMFILE},${RINGINGLINE},${Usr1VM})
exten => _26,1,Flash ; hook flash
exten => _26,2,background(silence/1) ; wait for KSU
exten => _26,3,SendDTMF(26) ; send KSU the extension
exten => _26,4,background(silence/1) ; wait for KSU
exten => _26,5,Hangup ; was SoftHangup
exten => _27,1,macro(intext,${Usr5EXTEN},${Usr5VM},${DEFTIMEOUT})
exten => _28,1,macro(intext,${Usr6EXTEN},${Usr6VM},${DEFTIMEOUT})
;
exten => _427,1,macro(pana-transfer,${PANAEXT11},${Usr1NMFILE},${RINGINGLINE},${Usr1VM})
exten => _436,1,macro(pana-transfer,${PANAEXT11},${Usr1NMFILE},${RINGINGLINE},${Usr1VM})
exten => _837,1,macro(pana-transfer,${PANAEXT13},${Usr2NMFILE},${RINGINGLINE},${Usr2VM})
exten => _242,1,macro(pana-transfer,${PANAEXT14},${Usr3NMFILE},${RINGINGLINE},${Usr3VM})
exten => _223,1,macro(pana-transfer,${PANAEXT15},${Usr4NMFILE},${RINGINGLINE},${Usr4VM})
exten => _228,1,macro(pana-transfer,${PANAEXT15},${Usr4NMFILE},${RINGINGLINE},${Usr4VM})
exten => _776,1,macro(intext,SIP/27,${Usr5VM},${DEFTIMEOUT})
exten => _876,1,macro(intext,SIP/27,${Usr5VM},${DEFTIMEOUT})
exten => _476,1,macro(intext,SIP/28,${Usr6VM},${DEFTIMEOUT})
exten => _227,1,macro(intext,SIP/28,${Usr6VM},${DEFTIMEOUT})
;
;
[sip-trans]
;
;
exten => _11,1,Dial(${PANA}/11,${DEFTIMEOUT},Tt)
exten => _12,1,Dial(${PANA}/12,${DEFTIMEOUT},Tt)
exten => _13,1,Dial(${PANA}/13,${DEFTIMEOUT},Tt)
exten => _14,1,Dial(${PANA}/14,${DEFTIMEOUT},Tt)
exten => _15,1,Dial(${PANA}/15,${DEFTIMEOUT},Tt)
exten => _16,1,Dial(${PANA}/16,${DEFTIMEOUT},Tt)
exten => _17,1,Dial(${PANA}/17,${DEFTIMEOUT},Tt)
exten => _18,1,Dial(${PANA}/18,${DEFTIMEOUT},Tt)
exten => _19,1,Dial(${PANA}/19,${DEFTIMEOUT},Tt)
exten => _20,1,Dial(${PANA}/20,${DEFTIMEOUT},Tt)
exten => _21,1,Dial(${PANA}/21,${DEFTIMEOUT},Tt)
exten => _22,1,Dial(${PANA}/22,${DEFTIMEOUT},Tt)
exten => _23,1,Dial(${PANA}/23,${DEFTIMEOUT},Tt)
exten => _26,1,Dial(${PANA}/26,${DEFTIMEOUT},Tt)
exten => _27,1,Dial(SIP/27,${DEFTIMEOUT},Tt)
exten => _28,1,Dial(SIP/28,${DEFTIMEOUT},Tt)
;
exten => _34,1,Dial(${PANA}/34,${DEFTIMEOUT},Tt)
;
exten => _427,1,Dial(${PANA}/11,${DEFTIMEOUT},Tt)
exten => _436,1,Dial(${PANA}/11,${DEFTIMEOUT},Tt)
exten => _837,1,Dial(${PANA}/13,${DEFTIMEOUT},Tt)
exten => _242,1,Dial(${PANA}/14,${DEFTIMEOUT},Tt)
exten => _223,1,Dial(${PANA}/15,${DEFTIMEOUT},Tt)
exten => _228,1,Dial(${PANA}/15,${DEFTIMEOUT},Tt)
exten => _776,1,Dial(SIP/27,${DEFTIMEOUT})
exten => _876,1,Dial(SIP/27,${DEFTIMEOUT})
exten => _476,1,Dial(SIP/28,${DEFTIMEOUT})
exten => _227,1,Dial(SIP/28,${DEFTIMEOUT})
;
;
[vmail-by-ext]
;
;
exten => _11,1,VoiceMail(u${Usr1VM})
exten => _11,2,Goto(#,1)
;
exten => _12,1,VoiceMail(u${Usr1VM})
exten => _12,2,Goto(#,1)
;
exten => _13,1,VoiceMail(u${Usr2VM})
exten => _13,2,Goto(#,1)
;
exten => _16,1,VoiceMail(u${Usr1VM})
exten => _16,2,Goto(#,1)
;
exten => _17,1,VoiceMail(u${Usr1VM})
exten => _17,2,Goto(#,1)
;
exten => _26,1,Flash ; hook flash
exten => _26,2,background(silence/1) ; wait for KSU
exten => _26,3,SendDTMF(26) ; send KSU the extension
exten => _26,4,background(silence/1) ; wait for KSU
exten => _26,5,Hangup ; was SoftHangup
;
[vmail-by-name]
;
;
exten => _427,1,VoiceMail(u${Usr1VM})
exten => _427,2,Goto(#,1)
;
exten => _837,1,VoiceMail(u${Usr2VM})
exten => _837,2,Goto(#,1)
;
exten => _242,1,VoiceMail(u${Usr3VM})
exten => _242,2,Goto(#,1)
;
exten => _223,1,VoiceMail(u${Usr4VM})
exten => _223,2,Goto(#,1)
;
exten => _228,1,VoiceMail(u${Usr4VM})
exten => _228,2,Goto(#,1)
;
;
[user-vm-by-name]
;
;
; User One h=4 e=2 n=7
exten => _427,1,VoiceMailMain(s${Usr1VM})
exten => _427,2,Goto(#,1)
;
; User One h=4 e=3 n=6
exten => _436,1,VoiceMailMain(s${Usr1VM})
exten => _436,2,Goto(#,1)
;
; User Two
exten => _837,1,VoiceMailMain(s${Usr2VM})
exten => _837,2,Goto(#,1)
;
;
[internal-svc]
;
; This section provides access to internal services from outside
; and from inside extensions
;
;
exten => 8500,1,VoicemailMain
exten => 8500,2,Hangup
;
; Or a conference room (edit meetme.conf to enable this room)
;
exten => 8600,1,Meetme(8600)
exten => 8601,1,Meetme(8601)
exten => 8602,1,Meetme(8602)
exten => 8603,1,Meetme(8603)
exten => 8604,1,Meetme(8604)
exten => 8605,1,Meetme(8605)
;
;
[emergency]
;
;
;
;
;*************************************************************
; END - Include contexts
;*************************************************************
;
;
;********************************************************************
; BEGIN - Macro Definitions
;********************************************************************
;
;
[macro-intext]
;
;
exten => s,1,Background(transfer)
exten => s,2,Dial(${ARG1},${ARG3},Tt)
exten => s,3,Voicemail(u${ARG2})
exten => s,4,Hangup
exten => s,103,Voicemail(b${ARG2})
exten => s,104,Hangup
;
;
[macro-pana-transfer]
;
;
; This macro performs an unattended transfer to a Panasonic analog extension using a hook flash transfer
;
; First we call the registered extension for the person we are attempting to transfer the call to. Then we
; announce the line their call is on.
;
; ARG1 = Panasonic analog extension to dial
; ARG2 = sound file name to say user name
; ARG3 = sound file name of ringing line to anounce
; ARG4 = VoiceMail box ID
;
; announce the incoming call on the called party registered extension
;
exten => s,1,Background(transfer) ; announce to caller
;
; announce the call to the extension first
;
exten => s,2,Macro(pana-announce,${ARG1},${ARG2},${ARG3})
;
; announce the call using a PAGE ALL
;
exten => s,3,Macro(pana-announce,${PAGE},${ARG2},${ARG3})
;
; if all else fails, put the caller in voicemail
;
exten => s,4,Background(transfer) ; announce to caller
exten => s,5,Wait(10)
exten => s,6,Voicemail(u${ARG4})
exten => s,7,Hangup
;
;
[macro-pana-announce]
;
;
; ARG1 = Panasonic extension to dial
; ARG2 = sound file name to say user name
; ARG3 = sound file name of ringing line to anounce
;
exten => s,1,Background(transfer) ; announce to caller
exten => s,2,NoOp
exten => s,3,Flash ; hook flash
exten => s,4,background(silence/1) ; wait for KSU
exten => s,5,SendDTMF(${ARG1}) ; send KSU the extension
exten => s,6,background(silence/1) ; wait for KSU
exten => s,7,NoOp ; was SoftHangup
;
exten => s,8,Background(custom/there-is-a-call-for) ; announce to called party
exten => s,9,Background(${ARG2}) ; say their name
exten => s,10,Background(${ARG3}) ; tell what line
exten => s,11,background(silence/1) ; wait a second
;
exten => s,12,Background(custom/there-is-a-call-for) ; repeat the announcement
exten => s,13,Background(${ARG2}) ; say their name
exten => s,14,Background(${ARG3}) ; tell what line
exten => s,15,background(silence/1) ; wait a second
;
exten => s,16,Flash ; flash the hook to return to caller
exten => s,17,background(silence/1) ; wait a second
;
;
[macro-dial-pstn]
;
; Enter with these
; ARG1 = number to dial
; ARG2 = timeout value
; ARG3 = flag determines if hangup or return on noanswer
; HR = hangup and return (default)
; RT = return without hangup (must set)
;
; Returns with FOUNDME = DIALSTATUS
;
;
; the 9w dials 9 then waits .5 sec for outside dialtone
;
exten => s,1,SetGlobalVar(FOUNDME=ANSWER)
exten => s,2,Dial(${PSTN}/9w${ARG1},${ARG2})
exten => s,3,SetGlobalVar(FOUNDME=${DIALSTATUS})
exten => s,4,Goto(s-${DIALSTATUS},1)
;
; returns here if busy
;
exten => s,103,SetGlobalVar(FOUNDME=BUSY)
exten => s,104,Goto(s-BUSY,1)
;
;
exten => s-BUSY,1,BackGround(the-party-you-are-calling)
exten => s-BUSY,2,BackGround(is-curntly-busy)
exten => s-BUSY,3,SetGlobalVar(FOUNDME=BUSY)
exten => s-BUSY,4,Goto(s-CLEANEXIT,1)
;
exten => s-CANCEL,1,BackGround(canceled)
exten => s-CANCEL,2,SetGlobalVar(FOUNDME=CANCEL)
exten => s-CANCEL,3,Goto(s-CLEANEXIT,1)
;
exten => s-CHANUNAVAIL,1,BackGround(channel)
exten => s-CHANUNAVAIL,2,BackGround(is-curntly-unavail)
exten => s-CHANUNAVAIL,3,SetGlobalVar(FOUNDME=CHANUNAVAIL)
exten => s-CHANUNAVAIL,4,Goto(s-CLEANEXIT,1)
;
exten => s-NOANSWER,1,BackGround(nbdy-avail-to-take-call)
exten => s-NOANSWER,2,SetGlobalVar(FOUNDME=NOANSWER)
exten => s-NOANSWER,3,Goto(s-CLEANEXIT,1)
;
exten => s-ANSWER,1,SetGlobalVar(FOUNDME=ANSWER)
exten => s-ANSWER,2,Goto(s-CLEANEXIT,3)
;
exten => s-.,1,BackGround(something-Usr2bly-wrong)
exten => s-.,2,SetGlobalVar(FOUNDME=ERROR)
exten => s-.,3,Goto(s-CLEANEXIT,1)
;
exten => s-CLEANEXIT,1,GotoIf($[${ARG3} = RT]?3:2)
exten => s-CLEANEXIT,2,Hangup
exten => s-CLEANEXIT,3,NoOp
;
;
[macro-dial-sip]
;
;
; Enter with these
; ARG1 = number to dial
; ARG2 = timeout value
; ARG3 = flag determines if hangup or return on no answer
; HR = hangup and return (default)
; RT = return without hangup (must set)
;
; Returns with FOUNDME = DIALSTATUS
;
exten => s,1,SetGlobalVar(FOUNDME=ANSWER)
exten => s,2,Dial(SIP/${ARG1}${SIPCO1},${ARG2})
exten => s,3,SetGlobalVar(FOUNDME=${DIALSTATUS})
exten => s,4,Goto(s-${DIALSTATUS},1)
;
; returns here if busy
;
exten => s,103,SetGlobalVar(FOUNDME=BUSY)
exten => s,104,Goto(s-BUSY,1)
;
exten => s-BUSY,1,BackGround(the-party-you-are-calling)
exten => s-BUSY,2,BackGround(is-curntly-busy)
exten => s-BUSY,3,SetGlobalVar(FOUNDME=BUSY)
exten => s-BUSY,4,Goto(s-CLEANEXIT,1)
;
exten => s-CANCEL,1,BackGround(canceled)
exten => s-CANCEL,2,SetGlobalVar(FOUNDME=CANCEL)
exten => s-CANCEL,3,Goto(s-CLEANEXIT,1)
;
exten => s-CHANUNAVAIL,1,BackGround(channel)
exten => s-CHANUNAVAIL,2,BackGround(is-curntly-unavail)
exten => s-CHANUNAVAIL,3,SetGlobalVar(FOUNDME=CHANUNAVAIL)
exten => s-CHANUNAVAIL,4,Goto(s-CLEANEXIT,1)
;
exten => s-NOANSWER,1,BackGround(nbdy-avail-to-take-call)
exten => s-NOANSWER,2,SetGlobalVar(FOUNDME=NOANSWER)
exten => s-NOANSWER,3,Goto(s-CLEANEXIT,1)
;
exten => s-ANSWER,1,SetGlobalVar(FOUNDME=ANSWER)
exten => s-ANSWER,2,Goto(s-CLEANEXIT,3)
;
exten => s-.,1,BackGround(something-Usr2bly-wrong)
exten => s-.,2,SetGlobalVar(FOUNDME=ERROR)
exten => s-.,3,Goto(s-CLEANEXIT,1)
;
exten => s-CLEANEXIT,1,GotoIf($[${ARG3} = RT]?3:2)
exten => s-CLEANEXIT,2,Hangup
exten => s-CLEANEXIT,3,NoOp
;
;
[macro-dial-iax]
;
;
; Enter with these
; ARG1 = number to dial
; ARG2 = timeout value
; ARG3 = flag determines if hangup or return on no answer
; HR = hangup and return (default)
; RT = return without hangup (must set)
;
; Returns with FOUNDME = DIALSTATUS
;
exten => s,1,SetGlobalVar(FOUNDME=ANSWER)
exten => s,2,GotoIf($[${LEN(${ARG1})} = 10]?2:4)
exten => s,3,SetVar(NumToDial=1${ARG1})
exten => s,4,Goto(s,6)
exten => s,5,SetVar(NumToDial=${ARG1})
exten => s,6,Goto(s,6)
;
exten => s,7,Dial(${IAXCO1}/${NumToDial},${ARG2}) ; try VoicePulse server 1
exten => s,8,SetGlobalVar(FOUNDME=${DIALSTATUS})
exten => s,9,GotoIf($[${DIALSTATUS} = CHANUNAVAIL]?10:12)
;
exten => s,10,Dial(${IAXCO2}/${NumToDial},${ARG2}) ; try VoicePulse server 2
exten => s,11,SetGlobalVar(FOUNDME=${DIALSTATUS})
exten => s,12,Goto(s-${DIALSTATUS},1)
;
; returns here if busy
;
exten => s,108,NoOp
exten => s,109,NoOp
exten => s,110,NoOp
exten => s,111,NoOp
exten => s,112,SetGlobalVar(FOUNDME=BUSY)
exten => s,113,Goto(s-BUSY,1)
;
;
exten => s-BUSY,1,BackGround(the-party-you-are-calling)
exten => s-BUSY,2,BackGround(is-curntly-busy)
exten => s-BUSY,3,SetGlobalVar(FOUNDME=BUSY)
exten => s-BUSY,4,Goto(s-CLEANEXIT,1)
;
exten => s-CANCEL,1,BackGround(canceled)
exten => s-CANCEL,2,SetGlobalVar(FOUNDME=CANCEL)
exten => s-CANCEL,3,Goto(s-CLEANEXIT,1)
;
exten => s-CHANUNAVAIL,1,BackGround(channel)
exten => s-CHANUNAVAIL,2,BackGround(is-curntly-unavail)
exten => s-CHANUNAVAIL,3,SetGlobalVar(FOUNDME=CHANUNAVAIL)
exten => s-CHANUNAVAIL,4,Goto(s-CLEANEXIT,1)
;
exten => s-NOANSWER,1,BackGround(nbdy-avail-to-take-call)
exten => s-NOANSWER,2,SetGlobalVar(FOUNDME=NOANSWER)
exten => s-NOANSWER,3,Goto(s-CLEANEXIT,1)
;
exten => s-ANSWER,1,SetGlobalVar(FOUNDME=ANSWER)
exten => s-ANSWER,2,Goto(s-CLEANEXIT,3)
;
exten => s-.,1,BackGround(something-Usr2bly-wrong)
exten => s-.,2,SetGlobalVar(FOUNDME=ERROR)
exten => s-.,3,Goto(s-CLEANEXIT,1)
;
exten => s-CLEANEXIT,1,GotoIf($[${ARG3} = RT]?3:2)
exten => s-CLEANEXIT,2,Hangup
exten => s-CLEANEXIT,3,NoOp
;
;
[macro-dial-pstn-sip-iax]
;
;
; This macro tries the PSTN circuit first, then
; fails over to our SIP provider and uses IAX
; as a last resort.
;
; As part of a least cost routing plan, this
; routine is best used for local calls.
;
;
; Enter with these
; ARG1 = number to dial
; ARG2 = timeout value
; ARG3 = flag determines if hangup or return on no answer
; HR = hangup and return (default)
; RT = return without hangup (must set)
;
; Returns with FOUNDME = DIALSTATUS
;
exten => s,1,SetGlobalVar(FOUNDME=ANSWER)
exten => s,2,Dial(${PSTN}/9w${ARG1},${ARG2})
exten => s,3,SetGlobalVar(FOUNDME=${DIALSTATUS})
exten => s,4,GotoIf($[${DIALSTATUS} = CHANUNAVAIL]?5:20)
;
exten => s,5,SetGlobalVar(FOUNDME=ANSWER)
exten => s,6,Dial(SIP/${ARG1}${SIPCO1},${ARG2})
exten => s,7,SetGlobalVar(FOUNDME=${DIALSTATUS})
exten => s,8,GotoIf($[${DIALSTATUS} = CHANUNAVAIL]?9:20)
;
exten => s,9,GotoIf($[${LEN(${ARG1})} = 10]?10:12)
exten => s,10,SetVar(NumToDial=1${ARG1})
exten => s,11,Goto(s,13)
exten => s,12,SetVar(NumToDial=${ARG1})
;
exten => s,13,SetGlobalVar(FOUNDME=ANSWER)
exten => s,14,Dial(${IAXCO1}/${NumToDial},${ARG2}) ; try VoicePulse server 1
exten => s,15,SetGlobalVar(FOUNDME=${DIALSTATUS})
exten => s,16,GotoIf($[${DIALSTATUS} = CHANUNAVAIL]?17:20)
;
exten => s,17,SetGlobalVar(FOUNDME=ANSWER)
exten => s,18,Dial(${IAXCO2}/${NumToDial},${ARG2}) ; try VoicePulse server 2
exten => s,19,SetGlobalVar(FOUNDME=${DIALSTATUS})
exten => s,20,Goto(s-${DIALSTATUS},1)
;
; returns here if busy on PSTN
;
exten => s,103,SetGlobalVar(FOUNDME=BUSY)
exten => s,104,Goto(s-BUSY,1)
;
; returns here if busy on SIP
;
exten => s,107,SetGlobalVar(FOUNDME=BUSY)
exten => s,108,Goto(s-BUSY,1)
;
; returns here if busy on IAXCO1
;
exten => s,115,SetGlobalVar(FOUNDME=BUSY)
exten => s,116,Goto(s-BUSY,1)
;
; returns here if busy on IAXCO2
;
exten => s,119,SetGlobalVar(FOUNDME=BUSY)
exten => s,120,Goto(s-BUSY,1)
;
exten => s-BUSY,1,BackGround(the-party-you-are-calling)
exten => s-BUSY,2,BackGround(is-curntly-busy)
exten => s-BUSY,3,SetGlobalVar(FOUNDME=BUSY)
exten => s-BUSY,4,Goto(s-CLEANEXIT,1)
;
exten => s-CANCEL,1,BackGround(canceled)
exten => s-CANCEL,2,SetGlobalVar(FOUNDME=CANCEL)
exten => s-CANCEL,3,Goto(s-CLEANEXIT,1)
;
exten => s-CHANUNAVAIL,1,BackGround(channel)
exten => s-CHANUNAVAIL,2,BackGround(is-curntly-unavail)
exten => s-CHANUNAVAIL,3,SetGlobalVar(FOUNDME=CHANUNAVAIL)
exten => s-CHANUNAVAIL,4,Goto(s-CLEANEXIT,1)
;
exten => s-NOANSWER,1,BackGround(nbdy-avail-to-take-call)
exten => s-NOANSWER,2,SetGlobalVar(FOUNDME=NOANSWER)
exten => s-NOANSWER,3,Goto(s-CLEANEXIT,1)
;
exten => s-ANSWER,1,SetGlobalVar(FOUNDME=ANSWER)
exten => s-ANSWER,2,Goto(s-CLEANEXIT,3)
;
exten => s-.,1,BackGround(something-Usr2bly-wrong)
exten => s-.,2,SetGlobalVar(FOUNDME=ERROR)
exten => s-.,3,Goto(s-CLEANEXIT,1)
;
exten => s-CLEANEXIT,1,GotoIf($[${ARG3} = RT]?3:2)
exten => s-CLEANEXIT,2,Hangup
exten => s-CLEANEXIT,3,NoOp
;
;
[macro-dial-iax-sip-pstn]
;
; This routine tries to connect using our IAX
; account with VoicePulse first. If for any
; reason, VoicePulse is unavailable, it fails
; over to our SIP account with BroadVoice. If
; BroadVoice fails also, it will use one of our
; analog lines with Verizon as a last resort.
;
; As part of a least cost routing plan, this
; routine is best used for long distance or
; international calls.
;
; Enter with these
; ARG1 = number to dial
; ARG2 = timeout value
; ARG3 = flag determines if hangup or return on no answer
; HR = hangup and return (default)
; RT = return without hangup (must set)
;
; Returns with FOUNDME = DIALSTATUS
;
;
exten => s,1,GotoIf($[${LEN(${ARG1})} = 10]?2:4)
exten => s,2,SetVar(NumToDial=1${ARG1})
exten => s,3,Goto(s,5)
exten => s,4,SetVar(NumToDial=${ARG1})
;
exten => s,5,SetGlobalVar(FOUNDME=ANSWER)
exten => s,6,Dial(${IAXCO1}/${NumToDial},${ARG2}) ; try VoicePulse server 1
exten => s,7,SetGlobalVar(FOUNDME=${DIALSTATUS})
exten => s,8,GotoIf($[${DIALSTATUS} = CHANUNAVAIL]?9:20)
;
exten => s,9,SetGlobalVar(FOUNDME=ANSWER)
exten => s,10,Dial(${IAXCO2}/${NumToDial},${ARG2}) ; try VoicePulse server 2
exten => s,11,SetGlobalVar(FOUNDME=${DIALSTATUS})
exten => s,12,GotoIf($[${DIALSTATUS} = CHANUNAVAIL]?13:20)
;
exten => s,13,SetGlobalVar(FOUNDME=ANSWER)
exten => s,14,Dial(SIP/${ARG1}${SIPCO1},${ARG2})
exten => s,15,SetGlobalVar(FOUNDME=${DIALSTATUS})
exten => s,16,GotoIf($[${DIALSTATUS} = CHANUNAVAIL]?18:20)
;
exten => s,17,SetGlobalVar(FOUNDME=ANSWER)
exten => s,18,Dial(${PSTN}/9w${ARG1},${ARG2})
exten => s,19,SetGlobalVar(FOUNDME=${DIALSTATUS})
exten => s,20,Goto(s-${DIALSTATUS},1)
;
; returns here if busy on IAXCO1
;
exten => s,107,Goto(s-BUSY,1)
;
; returns here if busy on IAXCO2
;
exten => s,111,Goto(s-BUSY,1)
;
; returns here if busy on SIPCO1
;
exten => s,115,Goto(s-BUSY,1)
;
; returns here if busy on PSTN
;
exten => s,119,Goto(s-BUSY,1)
;
exten => s-BUSY,1,BackGround(the-party-you-are-calling)
exten => s-BUSY,2,BackGround(is-curntly-busy)
exten => s-BUSY,3,SetGlobalVar(FOUNDME=BUSY)
exten => s-BUSY,4,Goto(s-CLEANEXIT,1)
;
exten => s-CANCEL,1,BackGround(canceled)
exten => s-CANCEL,2,SetGlobalVar(FOUNDME=CANCEL)
exten => s-CANCEL,3,Goto(s-CLEANEXIT,1)
;
exten => s-CHANUNAVAIL,1,BackGround(channel)
exten => s-CHANUNAVAIL,2,BackGround(is-curntly-unavail)
exten => s-CHANUNAVAIL,3,SetGlobalVar(FOUNDME=CHANUNAVAIL)
exten => s-CHANUNAVAIL,4,Goto(s-CLEANEXIT,1)
;
exten => s-NOANSWER,1,BackGround(nbdy-avail-to-take-call)
exten => s-NOANSWER,2,SetGlobalVar(FOUNDME=NOANSWER)
exten => s-NOANSWER,3,Goto(s-CLEANEXIT,1)
;
exten => s-ANSWER,1,SetGlobalVar(FOUNDME=ANSWER)
exten => s-ANSWER,2,Goto(s-CLEANEXIT,3)
;
exten => s-.,1,BackGround(something-Usr2bly-wrong)
exten => s-.,2,SetGlobalVar(FOUNDME=ERROR)
exten => s-.,3,Goto(s-CLEANEXIT,1)
;
exten => s-CLEANEXIT,1,GotoIf($[${ARG3} = RT]?3:2)
exten => s-CLEANEXIT,2,Hangup
exten => s-CLEANEXIT,3,NoOp
;
;
;********************************************************************
; END - Macro Definitions
;********************************************************************
;
;
;********************************************************************
; BEGIN - System Menu
;********************************************************************
;
;
[system-menu-main]
;
; provide user access to their voice mail inbox
; let user leave voice mail for another user
; provide user access to find me
;
; 1 = user gets voice mail
; 2 = user leaves voice mail for another user
; 3 = user tracks down another user at any number
; 4 = user performs menu diagnostics
;
;
exten => s,1,Background(custom/system-menu)
exten => s,2,NoOp
exten => s,3,Background(custom/your-voicemail)
exten => s,4,Background(custom/leave-voicemail)
exten => s,5,Background(custom/find-me)
exten => s,6,Background(custom/system-menu-diag)
exten => s,7,Background(custom/2repeat) ; play the menu messages
exten => s,8,Background(custom/2hangup) ; play the menu messages
exten => s,9,DigitTimeout,1 ; give them 1 seconds between digits
exten => s,10,ResponseTimeout,60 ; give them 60 seconds to make a choice
;
exten => _1,1,Goto(select-get-vmail-by-name,s,1)
;
exten => _2,1,Goto(select-vmail-by-name,s,1)
;
exten => _3,1,Goto(select-find-by-name,s,1)
;
exten => _4,1,Goto(menu-diag,s,1)
;
; Repeat the previous menu
exten => *,1,Goto(s,1)
;
; #=hangup
exten => #,1,Background(goodbye)
exten => #,2,NoOp
exten => #,3,Hangup
;
exten => t,1,Goto(i,1) ; If they take too long, give up
;
exten => i,1,Background(custom/is-invalid) ; "That's not valid, try again"
exten => i,2,Wait(1)
exten => i,3,Goto(s,1)
;
;
[menu-diag]
;
;
; select via menu
; 1 = house-day
; 2 = house-night
; 3 = office-day
; 4 = office-night
; 5 = transfer-to-extension-by-name
; 6 = transfer-to-voicemail-by-name
; 7 = user-access-to-voicemail-by-name
; 8 = transfer-to-remote-phone-1
; 9 = transfer-to-remote-phone-2
; 0 = round-robin-find-me
;
exten => s,1,Background(custom/this-function-offers)
exten => s,2,Background(silence/1)
;
exten => s,3,Background(custom/house-line)
exten => s,4,Background(custom/day-time-menu-select)
exten => s,5,Background(custom/press-the)
exten => s,6,Background(custom/one-key)
exten => s,7,Background(silence/1)
;
exten => s,8,NoOp
exten => s,9,NoOp
exten => s,10,NoOp
exten => s,11,NoOp
exten => s,12,NoOp
exten => s,13,NoOp
;
exten => s,14,Background(custom/house-line)
exten => s,15,Background(custom/night-time-menu-select)
exten => s,16,Background(custom/press-the)
exten => s,17,Background(custom/two-key)
exten => s,18,Background(silence/1)
;
exten => s,19,Background(custom/office-line)
exten => s,20,Background(custom/day-time-menu-select)
exten => s,21,Background(custom/press-the)
exten => s,22,Background(custom/three-key)
exten => s,23,Background(silence/1)
;
exten => s,24,Background(custom/office-line)
exten => s,25,Background(custom/night-time-menu-select)
exten => s,26,Background(custom/press-the)
exten => s,27,Background(custom/four-key)
exten => s,28,Background(silence/1)
;
;
exten => s,29,Background(custom/2repeat) ; play the menu messages
exten => s,30,Background(custom/2return) ; play the menu messages
exten => s,31,Background(silence/1)
exten => s,32,DigitTimeout,1 ; give them 1 seconds between digits
exten => s,33,ResponseTimeout,60 ; give them 60 seconds to make a choice
;
exten => _1,1,Goto(house-day,s,4)
;
exten => _2,1,Goto(house-night,s,4)
;
exten => _3,1,Goto(office-day,s,4)
;
exten => _4,1,Goto(office-night,s,4)
;
exten => _5,1,Goto(select-ext-by-name,s,1)
;
exten => _6,1,Goto(select-vmail-by-name,s,1)
;
exten => _7,1,Goto(select-get-vmail-by-name,s,1)
;
exten => _8,1,Goto(select-remote1-by-name,s,1)
;
exten => _9,1,Goto(select-remote2-by-name,s,1)
;
exten => _0,1,Goto(select-find-by-name,s,1)
;
; Repeat the previous menu
exten => *,1,Goto(s,1)
;
; #=hangup
exten => #,1,NoOp
exten => #,2,Goto(${FLOWCONTROL})
;
exten => t,1,Goto(i,1) ; If they take too long, give up
;
exten => i,1,Background(custom/is-invalid) ; "That's not valid, try again"
exten => i,2,Wait(1)
exten => i,3,Goto(s,1)
;
;
;********************************************************************
; END - System Menu
;********************************************************************
;
;
;*************************************************************
; BEGIN - Route by user name contexts
;*************************************************************
;
;
[select-ext-by-name]
;
; Transfer inbound call to user's internal extension
;
exten => s,1,SetGlobalVar(FLOWCONTROL=select-ext-by-name,s,5)
exten => s,2,Background(custom/emergency-menu-announce)
exten => s,3,Background(custom/trans-to-cell-announce)
exten => s,4,Goto(set-vars-by-name,s,1)
exten => s,5,GotoIf($[${FLOWCONFIRM} = PROCEED]?6:12)
exten => s,6,GotoIf($[${LEN(${EXT})} < 2]?7:8)
exten => s,7,Goto(i,1)
exten => s,8,GotoIf($[${LEN(${EXT})} > 2]?9:12)
exten => s,9 Dial(${EXT},${SHORTTIMEOUT})
exten => s,10,VoiceMail(u${VM})
exten => s,11,Goto(s,16)
;
exten => s,12,NoOp
exten => s,13,Macro(pana-announce,${EXT},${NMFILE},${RINGINGLINE})
exten => s,14,Macro(pana-announce,${PAGE},${NMFILE},${RINGINGLINE})
exten => s,15,VoiceMail(u${VM})
exten => s,16,Background(goodbye)
exten => s,17,Hangup
;
; returns here on a busy SIP extension
;
exten => s,101,VoiceMail(b${VM})
exten => s,102,Background(goodbye)
exten => s,103,Hangup
;
;
exten => t,1,Goto(i,1) ; If they take too long, give up
;
exten => i,1,Background(custom/is-invalid) ; "That's not valid, try again"
exten => i,2,Goto(s,1)
;
;
[select-vmail-by-name]
;
; Transfer inbound call to user's voice mail
;
exten => s,1,Background(custom/emergency-menu-announce)
exten => s,2,Background(custom/trans-to-cell-announce)
exten => s,3,SetGlobalVar(FLOWCONTROL=select-vmail-by-name,s,5)
exten => s,4,Goto(set-vars-by-name,s,1)
exten => s,5,GotoIf($[${FLOWCONFIRM} = PROCEED]?6:7)
exten => s,6,VoiceMail(u${VM})
exten => s,7,Hangup
;
exten => t,1,Goto(i,1) ; If they take too long, give up
;
exten => i,1,Background(custom/is-invalid) ; "That's not valid, try again"
exten => i,2,Goto(s,1)
;
;
[select-get-vmail-by-name]
;
; Local user retrieves voice mail
;
exten => s,1,Background(custom/emergency-menu-announce)
exten => s,2,Background(custom/trans-to-cell-announce)
exten => s,3,SetGlobalVar(FLOWCONTROL=select-get-vmail-by-name,s,5)
exten => s,4,Goto(set-vars-by-name,s,1)
exten => s,5,GotoIf($[${FLOWCONFIRM} = PROCEED]?6:7)
exten => s,6,VoiceMailMain(${VM})
exten => s,7,Hangup
;
exten => t,1,Goto(i,1) ; If they take too long, give up
;
exten => i,1,Background(custom/is-invalid) ; "That's not valid, try again"
exten => i,2,Goto(s,1)
;
;
[select-remote1-by-name]
;
; Transfer inbound call to user's first remote (cell) number
;
exten => s,1,Background(custom/emergency-menu-announce)
exten => s,2,Background(custom/trans-to-cell-announce)
exten => s,3,SetGlobalVar(FLOWCONTROL=select-remote1-by-name,s,5)
exten => s,4,Goto(set-vars-by-name,s,1)
exten => s,5,GotoIf($[${FLOWCONFIRM} = PROCEED]?6:10)
exten => s,6,Background(custom/standby-for-cell-bridge)
exten => s,7,Background(${NMFILE})
exten => s,8,Macro(pstn-sip-iax,${REM1},${SHORTTIMEOUT},RT)
exten => s,9,VoiceMail(u${VM})
exten => s,10,Hangup
;
exten => t,1,Goto(i,1) ; If they take too long, give up
;
exten => i,1,Background(custom/is-invalid) ; "That's not valid, try again"
exten => i,2,Goto(s,1)
;
;
[select-remote2-by-name]
;
; Transfer inbound call to user's second remote (home) number
;
exten => s,1,Background(custom/emergency-menu-announce)
exten => s,2,Background(custom/trans-to-cell-announce)
exten => s,3,SetGlobalVar(FLOWCONTROL=select-remote2-by-name,s,5)
exten => s,4,Goto(set-vars-by-name,s,1)
exten => s,5,GotoIf($[${FLOWCONFIRM} = PROCEED]?6:10)
exten => s,6,Background(custom/standby-for-cell-bridge)
exten => s,7,Background(${NMFILE})
exten => s,8,Macro(pstn-sip-iax,${REM2},${SHORTTIMEOUT},RT)
exten => s,9,VoiceMail(u${VM})
exten => s,10,Hangup
;
exten => t,1,Goto(i,1) ; If they take too long, give up
;
exten => i,1,Background(custom/is-invalid) ; "That's not valid, try again"
exten => i,2,Goto(s,1)
;
;
[select-find-by-name]
;
;
; Locate a user
; First try local extension
; Second try a page all
; Third try remote phone 1
; Fourth try remote phone 2
; Fifth drop caller in voicemail
;
exten => s,1,Background(custom/emergency-menu-announce)
exten => s,2,Background(custom/trans-to-cell-announce)
exten => s,3,SetGlobalVar(FLOWCONTROL=select-find-by-name,s,5)
exten => s,4,Goto(set-vars-by-name,s,1)
;
exten => s,5,GotoIf($[${FLOWCONFIRM} = PROCEED]?6:31)
;
exten => s,6,GotoIf($[${LEN(${EXT})} < 2]?18:8)
exten => s,7,NoOp
exten => s,8,Background(custom/standby-for-cell-bridge)
exten => s,9,Background(${NMFILE})
exten => s,10,GotoIf($[${LEN(${EXT})} > 2]?11:13)
;
exten => s,11 Dial(${EXT},${SHORTTIMEOUT})
exten => s,12,GotoIf($[${DIALSTATUS} = BUSY]?28:18)
;
exten => s,13,Macro(pana-announce,${EXT},${NMFILE},${RINGINGLINE})
exten => s,14,GotoIf($[${FOUNDME} = BUSY]?28:15)
;
exten => s,15,Background(custom/standby-for-cell-bridge)
exten => s,16,Background(${NMFILE})
exten => s,17,Macro(pana-announce,${PAGE},${NMFILE},${RINGINGLINE})
;
exten => s,18,GotoIf($[${LEN(${REM1})} < 10]?23:19)
exten => s,19,Background(custom/standby-for-cell-bridge)
exten => s,20,Background(${NMFILE})
exten => s,21,Macro(pstn-sip-iax,${REM1},${SHORTTIMEOUT},RT)
exten => s,22,GotoIf($[${FOUNDME} = BUSY]?28:23)
;
exten => s,23,GotoIf($[${LEN(${REM2})} < 10]?30:24)
exten => s,24,Background(custom/standby-for-cell-bridge)
exten => s,25,Background(${NMFILE})
exten => s,26,Macro(pstn-sip-iax,${REM2},${SHORTTIMEOUT},RT)
exten => s,27,GotoIf($[${FOUNDME} = BUSY]?28:30)
;
exten => s,28,VoiceMail(b${VM})
exten => s,29,Goto(s,31)
exten => s,30,VoiceMail(u${VM})
exten => s,31,Background(goodbye)
exten => s,32,Hangup
;
exten => t,1,Goto(i,1) ; If they take too long, give up
;
exten => i,1,Background(custom/is-invalid) ; "That's not valid, try again"
exten => i,2,Goto(s,1)
;
;
[set-vars-by-name]
;
;
exten => s,1,SetGlobalVar(ReturnTo=${FLOWCONTROL})
exten => s,2,SetGlobalVar(FLOWCONTROL=set-vars-by-name,s,2)
exten => s,3,SetGlobalVar(FLOWCONFIRM=foo)
exten => s,4,Background(custom/begin-process-by-name)
;
exten => s,5,Background(custom/2repeat)
exten => s,6,Background(custom/2return)
;
exten => s,7,DigitTimeout,2 ; give them 2 seconds between digits
exten => s,8,ResponseTimeout,30 ; give them 30 seconds to make a choice
;
;
include => set-global-vars
;
;
; get confirmation of selection
;
; Macro returns with FLOWCONFIRM set
; to either PROCEED or ABORT code
;
exten => s-CONFIRM,1,SetGlobalVar(FLOWCONFIRM=foo)
exten => s-CONFIRM,2,SetGlobalVar(FLOWCONTROL=set-vars-by-name,s-CONFIRM,5)
exten => s-CONFIRM,3,SetGlobalVar(CONFIRM=${NMFILE})
exten => s-CONFIRM,4,Goto(confirmation,s,1)
exten => s-CONFIRM,5,SetGlobalVar(FLOWCONTROL=set-vars-by-name,s,4)
exten => s-CONFIRM,6,Goto(s-${FLOWCONFIRM},1)
;
exten => s-PROCEED,1,SetGlobalVar(FLOWCONTROL=${ReturnTo}))
exten => s-PROCEED,2,Goto(${FLOWCONTROL})
;
; the caller aborted the selection process
; loop them back to the top and let them
; try again
;
; ABORT = confirmation process ended with a rejection of selection
exten => s-ABORT,1,SetGlobalVar(NM=${DEFCIDNAME}) ; set vars back to default setting
exten => s-ABORT,2,SetGlobalVar(VM=${DEFVM})
exten => s-ABORT,3,SetGlobalVar(ID=${DEFCID})
exten => s-ABORT,4,SetGlobalVar(EXT=${DEFEXTEN})
exten => s-ABORT,5,SetGlobalVar(REM1=${DEFREM1})
exten => s-ABORT,6,SetGlobalVar(REM2=${DEFREM2})
exten => s-ABORT,7,SetGlobalVar(NMFILE=${DEFNMFILE})
exten => s-ABORT,8,SetGlobalVar(FLOWCONFIRM=foo)
exten => s-ABORT,9,Goto(${FLOWCONTROL}) ; let them make another selection
;
; somehow we got back with an invalid
; selection. loop back and let them
; try again.
;
; INVALID = invalid key while making confirmation
;
exten => s-INVALID,1,SetGlobalVar(NM=${DEFCIDNAME}) ; set vars back to default setting
exten => s-INVALID,2,SetGlobalVar(VM=${DEFVM})
exten => s-INVALID,3,SetGlobalVar(ID=${DEFCID})
exten => s-INVALID,4,SetGlobalVar(EXT=${DEFEXTEN})
exten => s-INVALID,5,SetGlobalVar(REM1=${DEFREM1})
exten => s-INVALID,6,SetGlobalVar(REM2=${DEFREM2})
exten => s-INVALID,7,SetGlobalVar(NMFILE=${DEFNMFILE})
exten => s-INVALID,8,SetGlobalVar(FLOWCONFIRM=foo)
exten => s-INVALID,9,Background(custom/select-invalid-try-again)
exten => s-INVALID,10,Goto(${FLOWCONTROL})
;
;
; foo = something odd happend during the selection process
;
exten => s-foo,1,SetGlobalVar(NM=${DEFCIDNAME}) ; set vars back to default setting
exten => s-foo,2,SetGlobalVar(VM=${DEFVM})
exten => s-foo,3,SetGlobalVar(ID=${DEFCID})
exten => s-foo,4,SetGlobalVar(EXT=${DEFEXTEN})
exten => s-foo,5,SetGlobalVar(REM1=${DEFREM1})
exten => s-foo,6,SetGlobalVar(REM2=${DEFREM2})
exten => s-foo,7,SetGlobalVar(NMFILE=${DEFNMFILE})
exten => s-foo,8,Background(something-Usr2bly-wrong)
exten => s-foo,9,Goto({FLOWCONTROL}) ; loop back to selections
;
; TIMEOUT = timed out making confirmation
;
exten => s-TIMEOUT,1,SetGlobalVar(NM=${DEFCIDNAME}) ; set vars back to default setting
exten => s-TIMEOUT,2,SetGlobalVar(VM=${DEFVM})
exten => s-TIMEOUT,3,SetGlobalVar(ID=${DEFCID})
exten => s-TIMEOUT,4,SetGlobalVar(EXT=${DEFEXTEN})
exten => s-TIMEOUT,5,SetGlobalVar(REM1=${DEFREM1})
exten => s-TIMEOUT,6,SetGlobalVar(REM2=${DEFREM2})
exten => s-TIMEOUT,7,SetGlobalVar(NMFILE=${DEFNMFILE})
exten => s-TIMEOUT,8,SetGlobalVar(FLOWCONFIRM=foo)
exten => s-TIMEOUT,9,Background(custom/select-invalid-try-again)
exten => s-TIMEOUT,10,Goto(${FLOWCONTROL})
;
exten => s-CLEANEXIT,1,SetGlobalVar(FLOWCONFIRM=foo) ; set vars back to default setting
exten => s-CLEANEXIT,2,SetGlobalVar(ReturnTo=foo)
exten => s-CLEANEXIT,3,SetGlobalVar(NM=${DEFCIDNAME})
exten => s-CLEANEXIT,4,SetGlobalVar(VM=${DEFVM})
exten => s-CLEANEXIT,5,SetGlobalVar(ID=${DEFCID})
exten => s-CLEANEXIT,6,SetGlobalVar(EXT=${DEFEXTEN})
exten => s-CLEANEXIT,7,SetGlobalVar(REM1=${DEFREM1})
exten => s-CLEANEXIT,8,SetGlobalVar(REM2=${DEFREM2})
exten => s-CLEANEXIT,9,SetGlobalVar(NMFILE=${DEFNMFILE})
exten => s-CLEANEXIT,10,SetGlobalVar(FOUNDME=foo)
exten => s-CLEANEXIT,11,SetGlobalVar(FLOWCONTROL=${ReturnTo})
exten => s-CLEANEXIT,12,SetGlobalVar(ReturnTo=)
exten => s-CLEANEXIT,13,Goto(${FLOWCONTROL})
;
exten => s-.,1,Goto(s-foo,1)
;
; Repeat the previous menu
exten => *,1,Goto(${FLOWCONTROL})
exten => *,2,Goto(s-CLEANEXIT,1)
;
; # = hangup/abort return to calling process
exten => #,1,SetGlobalVar(FLOWCONTROL=${ReturnTo})
exten => #,2,SetGlobalVar(ReturnTo= )
exten => #,3,Goto(${FLOWCONTROL})
exten => #,4,Goto(s-CLEANEXIT,1)
;
exten => t,1,Goto(i,1) ; If they take too long, give up
;
exten => i,1,Background(custom/is-invalid) ; "That's not valid, try again"
exten => i,2,NoOp
exten => i,3,Goto(${FLOWCONTROL})
exten => i,4,Goto(s-CLEANEXIT,1)
;
;
[confirmation]
;
; simple yes/no, go/no-go decision routine
;
; enter with
;
; ARG1 = sound file name describing the item selected that
; requires confirmation
;
; returns with FLOWCONFIRM set to
; PROCEED - selection confirmed
; ABORT - want to make another selection
; TIMEOUT - took to much time with a simple decision
;
exten => s,1,Background(custom/you-selected)
exten => s,2,Background(${CONFIRM})
exten => s,3,Background(silence/1)
exten => s,4,Background(custom/confirm-about-selection)
;
exten => s,5,DigitTimeout,1 ; give them 1 seconds between digits
exten => s,6,ResponseTimeout,5 ; give them 5 seconds to make a choice
;
; * = Confirm selection
exten => *,1,SetGlobalVar(FLOWCONFIRM=PROCEED)
exten => *,2,NoOp(${FLOWCONFIRM})
exten => *,3,Goto(${FLOWCONTROL})
;
; # = Reject selection
exten => #,1,SetGlobalVar(FLOWCONFIRM=ABORT)
exten => #,2,NoOp(${FLOWCONFIRM})
exten => #,3,Goto(${FLOWCONTROL})
;
; t=timeout
exten => t,1,SetGlobalVar(FLOWCONFIRM=TIMEOUT)
exten => t,2,NoOp(${FLOWCONFIRM})
exten => t,3,Goto(${FLOWCONTROL})
;
; i=invalid selection
exten => i,1,Background(custom/select-invalid-try-again)
exten => i,2,Goto(s,1) ; invalid choice, loop them back
;
;
;*************************************************************
; END - Route by user name contexts
;*************************************************************
;
;
;********************************************************************
; BEGIN - Outbound call handlers
;********************************************************************
;
;
[default]
;
; this is where SIP extensions enter the dial plan
;
exten => s,1,DigitTimeout,2 ; give them 2 seconds between digits
exten => s,2,ResponseTimeout,30 ; give them 30 seconds to make a choice
;
include => sip-trans
include => internal-svc
;
; Master context for outbound call routing
;
; Handle pstn service numbers.
; This group should only be dialed using
; one of our two analog lines.
;
; This routine is only used by our SIP
; phones. The Panasonic handsets enter
; the dial plan at co3out and co4out
; depending on the selection of CO3 or
; or CO4 at the handset.
;
exten => _0,1,Macro(dial-pstn,${EXTEN},${LONGTIMEOUT})
exten => _411,1,Macro(dial-pstn,${EXTEN},${LONGTIMEOUT})
exten => _611,1,Macro(dial-pstn,${EXTEN},${LONGTIMEOUT})
exten => _911,1,Macro(dial-pstn,${EXTEN},${LONGTIMEOUT})
;
;
; handle outbound toll free calls - force analog
;
exten => _1800.,1,Macro(dial-pstn-sip-iax,${EXTEN},${LONGTIMEOUT})
exten => _1855.,1,Macro(dial-pstn-sip-iax,${EXTEN},${LONGTIMEOUT})
exten => _1866.,1,Macro(dial-pstn-sip-iax,${EXTEN},${LONGTIMEOUT})
exten => _1877.,1,Macro(dial-pstn-sip-iax,${EXTEN},${LONGTIMEOUT})
exten => _1888.,1,Macro(dial-pstn-sip-iax,${EXTEN},${LONGTIMEOUT})
;
; Handle outbound local calls
;
; All local numbers are 10 digits in our area.
; This plan has no pattern for seven digit dialing.
; On local calls, we favor our analog lines from
; Verizon, then fail over to Voicepulse.
;
; NOTE: VoicePulse needs the local 10 digit phone
; number to be preceeded by a "1" and there
; will be per-minute charges against the
; account.
;
; local call rule try analog line first, then sip, then iax
;
exten => _NXXNXXXXXX,1,Macro(dial-pstn-sip-iax,${EXTEN},${LONGTIMEOUT})
;
; long distance rule sends call to iax first, then sip, then pstn
;
; for long distance calls, we try the VoicePulse IAX
; service first. if VoicePulse is not available we try
; the BroadVoice SIP service. if all else fails, we
; use an analog line from Verizon. This forces least
; cost routing of the call.
;
exten => _1NXXNXXXXXX,1,Macro(dial-iax-sip-pstn,${EXTEN},${LONGTIMEOUT}) ; voicepulse first
;
; handle outbound internationl calls
;
; for international calls, we try the VoicePulse IAX
; service first. if VoicePulse is not available we try
; the BroadVoice SIP service. if all else fails, we
; use an analog line from Verizon. This forces least
; cost routing of the call.
;
exten => _011.,1,Macro(dial-iax-sip-pstn,${EXTEN},${LONGTIMEOUT})
;
; handle outbound local calls - force ZAP trunk
;
exten => _9NXXNXXXXXX,1,Macro(dial-pstn,${EXTEN:1},${LONGTIMEOUT})
;
; handle outbound long distance calls - force ZAP trunk
;
exten => _91NXXNXXXXXX,1,Macro(dial-pstn,${EXTEN:1},${LONGTIMEOUT})
;
; handle outbound internationl calls - force ZAP trunk
;
exten => _9011.,1,Macro(dial-pstn,${EXTEN:1},${LONGTIMEOUT})
;
; handle outbound local calls - force IAX via VoicePulse
;
exten => _8NXXNXXXXXX,1,Macro(dial-iax,1${EXTEN:1},${LONGTIMEOUT})
;
; handle outbound long distance calls - force IAX via VoicePulse
;
exten => _81NXXNXXXXXX,1,Macro(dial-iax,${EXTEN:1},${LONGTIMEOUT})
;
; handle outbound internationl calls - force IAX via VoicePulse
;
exten => _8011.,1,Macro(dial-iax,${EXTEN:1},${LONGTIMEOUT})
;
; handle outbound local calls - force SIP via BroadVoice
;
exten => _7NXXNXXXXXX,1,Macro(dial-sip,${EXTEN:1},${LONGTIMEOUT})
;
; handle outbound long distance calls - force SIP via BroadVoice
;
exten => _71NXXNXXXXXX,1,Macro(dial-sip,${EXTEN:1},${LONGTIMEOUT})
;
; handle outbound internationl calls - force SIP via BroadVoice
;
exten => _7011.,1,Macro(dial-sip,${EXTEN:1},${LONGTIMEOUT})
;
exten => t,1,Goto(i,1) ; If they take too long, give up
;
exten => i,1,Background(invalid) ; "That's not valid, try again"
exten => i,2,Wait(1)
exten => i,3,Goto(s,1)
;
;
[co3out]
;
; this is where a Panasonic analog extension enters
; the dial plan if they pick up CO3 (VoicePulse)
;
exten => s,1,DigitTimeout,2 ; give them 2 seconds between digits
exten => s,2,ResponseTimeout,30 ; give them 30 seconds to make a choice
;
; If the user presses 0, give them access to the
; system menu
;
exten => 0,1,NoOp
exten => 0,2,Goto(system-menu-main,s,1)
;
; Keep them from dialing PSTN service numbers as
; VoicePulse will not route them properly anyway
;
exten => _411,1,Goto(i,1)
exten => _611,1,Goto(i,1)
exten => _911,1,Goto(i,1)
;
include => sip-trans
include => internal-svc
;
; handle outbound local calls - force VoicePulse
;
exten => _NXXNXXXXXX,1,Macro(dial-iax,1${EXTEN},${LONGTIMEOUT})
;
; handle outbound long distance calls - force VoicePulse
;
exten => _1NXXNXXXXXX,1,Macro(dial-iax,${EXTEN},${LONGTIMEOUT})
;
; handle outbound internationl calls - force VoicePulse
;
exten => _011.,1,Macro(dial-iax,${EXTEN},${LONGTIMEOUT})
;
;
exten => t,1,Goto(i,1) ; If they take too long, let them try again
;
exten => i,1,Background(invalid) ; "That's not valid, try again"
exten => i,2,Wait(1)
exten => i,3,Goto(s,1)
;
;
[co4out]
;
; this is where a Panasonic analog extension enters
; the dial plan if they pick up CO4 (BroadVoice)
;
exten => s,1,DigitTimeout,2 ; give them 2 seconds between digits
exten => s,2,ResponseTimeout,30 ; give them 30 seconds to make a choice
;
; If the user presses 0, give them access to the
; system menu
;
exten => 0,1,NoOp
exten => 0,2,Goto(system-menu-main,s,1)
;
; Keep them from dialing PSTN service numbers as
; VoicePulse will not route them properly anyway
;
exten => _411,1,Goto(i,1)
exten => _611,1,Goto(i,1)
exten => _911,1,Goto(i,1)
;
include => sip-trans
include => internal-svc
;
; handle outbound local calls - force BroadVoice
;
exten => _NXXNXXXXXX,1,Macro(dial-sip,${EXTEN},${LONGTIMEOUT})
;
; handle outbound long distance calls - force BroadVoice
;
exten => _1NXXNXXXXXX,1,Macro(dial-sip,${EXTEN},${LONGTIMEOUT})
;
; handle outbound internationl calls - force BroadVoice
;
exten => _011.,1,Macro(dial-sip,${EXTEN},${LONGTIMEOUT})
;
exten => t,1,Goto(i,1) ; If they take too long, let them try again
;
exten => i,1,Background(invalid) ; "That's not valid, try again"
exten => i,2,Wait(1)
exten => i,3,Goto(s,1)
;
;
;********************************************************************
; END - Outbound call handlers
;********************************************************************
;
;
;********************************************************************
; BEGIN - Inbound call handlers
;********************************************************************
;
;
[house-in]
;
; This routine handles inbound calls on the analog
; house line.
;
; The Panasonic KSU is programmed to ring only
; a couple phones after hours so one or two rings
; will not wake everyone in the house.
;
exten => s,1,SetGlobalVar(RINGINGLINE=custom/on-line-one)
exten => s,2,GotoIfTime(07:00-21:00|sun-sat|*|*?house-day,s,1)
exten => s,3,Goto(house-night,s,1)
;
;
[office-in]
;
; This routine handles inbound calls on the analog office line
;
; The office-day checks to see if we might be closed
; due to a holiday and makes a holiday announcment
; if true.
;
; We have to support the possibility that a client
; might have an emergency. We need to be available
; 7x24 for certain clients.
;
; After hours, we will answer immediately without
; ringing every phone in the house by brancing to
; the "office-night" context.
;
; The Panasonic KSU is programmed to ring only
; a couple phones after hours so one or two rings
; will not wake everyone in the house.
;
exten => s,1,SetGlobalVar(RINGINGLINE=custom/on-line-two)
exten => s,2,GotoIfTime(08:00-18:00|mon-fri|*|*?office-day,s,1)
exten => s,3,Goto(office-night,s,1)
;
[voicepulse-in]
;
; This routine handles inbound calls on our VoicePulse DID
; Voicepulse rings in with the extension set to our DID
; VoicePulse is handled as an office line
;
exten => _9005551212,1,SetGlobalVar(RINGINGLINE=custom/on-line-three)
exten => _9005551212,2,GotoIfTime(08:00-18:00|mon-fri|*|*?office-day,s,1)
exten => _9005551212,3,Goto(office-night,s,1)
;
;
[broadvoice-in]
;
; BroadVoice rings in on the s extension
; BroadVoice is handled as an Office line.
;
exten => s,1,SetGlobalVar(RINGINGLINE=custom/on-line-four)
exten => s,2,GotoIfTime(08:00-18:00|mon-fri|*|*?office-day,s,1)
exten => s,3,Goto(office-night,s,1)
;
;
;********************************************************************
; END - Inbound call handlers
;********************************************************************
;
;
;********************************************************************
; BEGIN - House IVR Menu
;********************************************************************
;
;
[house-day]
;
;
exten => s,1,Wait(20)
exten => s,2,Answer
exten => s,3,zapateller ; torture telemarketers
;
; menu diag enter here
;
exten => s,4,NoOp
exten => s,5,Background(custom/welcome-hend) ; play the intro message
exten => s,6,NoOp
;
exten => s,7,Background(custom/this-is-daytime-menu)
exten => s,8,Background(custom/appologise)
;
; loops should return here
;
exten => s,9,SetGlobalVar(FLOWCONTROL=house-day,s,9)
exten => s,10,NoOp
exten => s,11,NoOp
exten => s,12,Background(custom/if-you-know-ext)
;
exten => s,13,Background(silence/1)
exten => s,14,Background(custom/if-emergency)
exten => s,15,Background(custom/press-the)
exten => s,16,Background(custom/nine-key)
exten => s,17,Background(silence/1)
;
exten => s,18,Background(custom/will-trans-to-default)
exten => s,19,Background(silence/1)
;
exten => s,20,Background(custom/2repeat) ; play the menu messages
exten => s,21,Background(custom/2hangup) ; play the menu messages
;
exten => s,22,DigitTimeout,2 ; give them 2 seconds between digits
exten => s,23,ResponseTimeout,30 ; give them 30 seconds to make a choice
;
include => pana-trans
include => internal-svc
;
; Repeat the previous menu
exten => *,1,Goto(s,9)
;
; #=hangup
exten => #,1,Background(goodbye)
exten => #,2,Hangup
;
exten => t,1,VoiceMail(u${DEFVM})
exten => t,2,Hangup
;
exten => i,1,Background(pbx-invalid) ; "That's not valid, try again"
exten => i,2,Wait(1)
exten => i,3,Goto(s,9)
;
;
[house-night]
;
;
exten => s,1,Wait(10)
exten => s,2,Answer
exten => s,3,zapateller ; torture telemarketers
;
; menu diag enter here
;
exten => s,4,NoOp
exten => s,5,Background(custom/welcome-hend) ; play the intro message
exten => s,6,NoOp
;
exten => s,7,Background(custom/this-is-afterhours-menu)
exten => s,8,Background(custom/direct-to-vmail-is-active)
;
; loops should return here
;
exten => s,9,NoOp
exten => s,10,NoOp
exten => s,11,SetGlobalVar(FLOWCONTROL=house-night,s,9)
exten => s,12,Background(custom/if-you-know-ext)
exten => s,13,Background(silence/1)
;
exten => s,14,Background(custom/if-emergency)
exten => s,15,Background(custom/press-the)
exten => s,16,Background(custom/nine-key)
exten => s,17,Background(silence/1)
;
exten => s,18,Background(custom/will-trans-to-default)
exten => s,19,Background(silence/1)
;
exten => s,20,Background(custom/2repeat) ; play the menu messages
exten => s,21,Background(custom/2hangup) ; play the menu messages
;
exten => s,22,DigitTimeout,2 ; give them 2 seconds between digits
exten => s,23,ResponseTimeout,30 ; give them 30 seconds to make a choice
;
;
include => vmail-by-ext
include => vmail-by-name
include => internal-svc
;
; Repeat the previous menu
exten => *,1,Goto(s,9)
;
; #=hangup
exten => #,1,Background(goodbye)
exten => #,2,Hangup
;
exten => t,1,VoiceMail(u${DEFVM})
exten => t,2,Hangup
;
exten => i,1,Background(pbx-invalid) ; "That's not valid, try again"
exten => i,2,Wait(1)
exten => i,3,Goto(s,9)
;
;
;********************************************************************
; END - House IVR Menu
;********************************************************************
;
;
;********************************************************************
; BEGIN - Office IVR Menu
;********************************************************************
;
;
[office-day]
;
;
exten => s,1,Wait(30)
exten => s,2,Answer
exten => s,3,zapateller ; torture telemarketers
;
; menu diag enter here
;
exten => s,4,Background(silence/1) ; one second silence
exten => s,5,Background(custom/welcome) ; play the intro message
exten => s,6,NoOp
;
exten => s,7,GotoIfTime(*|*|1|jan?office-holiday,s,1)
exten => s,8,GotoIfTime(*|*|4|jul?office-holiday,s,1)
exten => s,9,GotoIfTime(*|*|11|nov?office-holiday,s,1)
exten => s,10,GotoIfTime(*|*|25|dec?office-holiday,s,1)
;
exten => s,11,GotoIfTime(*|mon|15-21|jan?office-holiday,s,1)
exten => s,12,GotoIfTime(*|mon|15-21|feb?office-holiday,s,1)
exten => s,13,GotoIfTime(*|mon|26-31|may?office-holiday,s,1)
exten => s,14,GotoIfTime(*|mon|1-7|sep?office-holiday,s,1)
exten => s,15,GotoIfTime(*|mon|8-17|oct?office-holiday,s,1)
exten => s,16,GotoIfTime(*|thu|22-28|nov?office-holiday,s,1)
;
; if its not a Holiday check to see if its during business hours
;
exten => s,17,GotoIfTime(08:00-17:59|mon-fri|*|*?office-open,s,1)
;
; if its not during business hours, we must be closed
;
exten => s,18,Goto(office-night,s,7)
;
; include access to internal extentions and services
;
;
include => pana-trans
include => internal-svc
;
; Repeat the previous menu
exten => *,1,Goto(s,5)
;
; #=hangup
exten => #,1,Background(goodbye)
exten => #,2,Hangup
;
exten => t,1,Goto(i,1) ; If they take too long, give up
;
exten => i,1,Background(pbx-invalid) ; "That's not valid, try again"
exten => i,2,Wait(1)
exten => i,3,Goto(s,5)
;
;
[office-night]
;
;
exten => s,1,Wait(10)
exten => s,2,Answer
exten => s,3,zapateller ; torture telemarketers
;
; menu diag enter here
;
exten => s,4,Background(silence/1) ; one second silence
exten => s,5,Background(custom/welcome) ; play the intro message
exten => s,6,Background(silence/1) ; one second silence
exten => s,7,Background(custom/office-closed)
;
exten => s,8,Background(custom/this-is-afterhours-menu)
exten => s,9,Background(custom/office-hours)
;
; loops should return here
;
exten => s,10,SetGlobalVar(FLOWCONTROL=office-night,s,10)
exten => s,11,NoOp
exten => s,12,NoOp(${FLOWCONTROL})
exten => s,13,Background(custom/if-you-know-ext)
exten => s,14,Background(silence/1) ; one second silence
exten => s,15,Background(custom/to-leave-vm-by-name)
exten => s,16,Background(custom/dial-first-three-char)
;
exten => s,17,Background(silence/1)
exten => s,18,Background(custom/if-emergency)
exten => s,19,Background(silence/1)
exten => s,20,NoOp
;
exten => s,21,Background(custom/2repeat) ; play the menu messages
exten => s,22,Background(custom/2hangup) ; play the menu messages
;
exten => s,23,DigitTimeout,5 ; give them 5 seconds between digits
exten => s,24,ResponseTimeout,90 ; give them 90 seconds to make a choice
;
;
include => vmail-by-ext
include => vmail-by-name
include => internal-svc
include => emergency
;
; Repeat the previous menu
exten => *,1,Goto(s,10)
;
; #=hangup
exten => #,1,Background(goodbye)
exten => #,2,Hangup
;
exten => t,1,VoiceMail(u${DEFVM}) ; If they take too long, send to vmail
exten => t,2,Hangup
;
exten => i,1,Background(pbx-invalid) ; "That's not valid, try again"
exten => i,2,NoOp
exten => i,3,Goto(s,10)
;
;
[office-holiday]
;
; provide Holiday greeting and provide emergency access for
; contract clients
;
exten => s,1,Background(custom/office-closed-holiday) ; play the office we are closed message
exten => s,2,Background(custom/office-hours) ; play the open hours message
exten => s,3,Goto(office-night,s,8)
;
; include access to internal extentions and services
;
include => vmail-by-ext
include => vmail-by-name
include => internal-svc
;
; Repeat the previous menu
exten => *,1,Goto(office-night,s,8)
;
; #=hangup
exten => #,1,Background(goodbye)
exten => #,2,Hangup
;
exten => t,1,VoiceMail(u${DEFVM}) ; If they take too long, send to vmail
exten => t,2,Hangup
;
exten => i,1,Background(pbx-invalid) ; "That's not valid, try again"
exten => i,2,Wait(1)
exten => i,3,Goto(office-night,s,8)
;
;
[office-open]
;
; during normal business hours, operate like a fancy answering machine
;
exten => s,1,NoOp
exten => s,2,NoOp
exten => s,3,NoOp
;
; menu diag enter here
;
exten => s,4,NoOp
exten => s,5,NoOp
exten => s,6,NoOp
;
exten => s,7,NoOp
exten => s,8,NoOp
;
; loops should return here
;
exten => s,9,Background(custom/if-you-know-ext)
;
exten => s,10,Background(silence/1)
exten => s,11,Background(custom/if-emergency)
exten => s,12,Background(custom/press-the)
exten => s,13,Background(custom/nine-key)
exten => s,14,Background(silence/1)
;
exten => s,15,Background(custom/will-trans-to-default)
exten => s,16,Background(silence/1)
;
exten => s,17,Background(custom/2repeat) ; play the menu messages
exten => s,18,Background(custom/2hangup) ; play the menu messages
;
exten => s,19,DigitTimeout,2 ; give them 2 seconds between digits
exten => s,20,ResponseTimeout,30 ; give them 30 seconds to make a choice
;
include => pana-trans
include => internal-svc
;
; Repeat the previous menu
exten => *,1,Goto(s,9)
;
; #=hangup
exten => #,1,Background(goodbye)
exten => #,2,Hangup
;
exten => t,1,VoiceMail(u${DEFVM})
exten => t,2,Hangup
;
exten => i,1,Background(pbx-invalid) ; "That's not valid, try again"
exten => i,2,Wait(1)
exten => i,3,Goto(s,9)
;
;
;********************************************************************
; END - Office IVR Menu
;********************************************************************
;
;
Nenhum comentário:
Postar um comentário