The macros that make it all work


Macros used in dial plan



;********************************************************************
; 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
; 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.
;
; It should be noted that the PANASONIC hand sets
; have the option of manually selecting the
; line to be used for outbound dialing. Normally,
; this routine would only be of value to single
; line or IP phones as it is simpler to just select
; the outbound path at the PANASONIC hand set.
;
; 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.
;
; It should be noted that the PANASONIC hand sets
; have the option of manually selecting the
; line to be used for outbound dialing. Normally,
; this routine would only be of value to single
; line or IP phones as it is simpler to just select
; the outbound path at the PANASONIC hand set.
;
;
; 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
;********************************************************************
;
;


Macros used in dial plan



;********************************************************************
; 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
; 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.
;
; It should be noted that the PANASONIC hand sets
; have the option of manually selecting the
; line to be used for outbound dialing. Normally,
; this routine would only be of value to single
; line or IP phones as it is simpler to just select
; the outbound path at the PANASONIC hand set.
;
; 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.
;
; It should be noted that the PANASONIC hand sets
; have the option of manually selecting the
; line to be used for outbound dialing. Normally,
; this routine would only be of value to single
; line or IP phones as it is simpler to just select
; the outbound path at the PANASONIC hand set.
;
;
; 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
;********************************************************************
;
;

Created by: ghendershot, Last modification: Fri 29 of Oct, 2004 (02:36 UTC)
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+