Stdexten macro


[macro-stdexten]
;; Standard extension macro:
;   ${ARG1} - Voicemail box  
;   ${ARG2} - Device extension(s) to ring
;; Usage: 
; in main context do exten => 1000,1,Macro(stdexten,1000,1000)
; I use variables defined in the globals section so it becomes
; exten => ${PHONE1},1,Macro(stdexten,${PHONE1},${PHONE1})
;
exten => s,1,Dial(${ARG2},20)					; Ring the interface, 20 seconds maximum
exten => s,2,Goto(s-${DIALSTATUS},1)				; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)

exten => s-BUSY,1,Voicemail(b${ARG1})				; If busy, send to voicemail w/ busy announce
exten => s-BUSY,2,Goto(public,s,1)				; If they press #, return to start

exten => s-NOANSWER,1,Voicemail(u${ARG1})			; If unavailable, send to voicemail w/ unavail announce
exten => s-NOANSWER,2,Goto(public,s,1)				; If they press #, return to start

exten => _s-.,1,Goto(s-NOANSWER,1)				; Treat anything else as no answer



Version 0.2
A slightly enhanced version of the above...

[macro-stdexten]
;; Standard extension macro:
;   ${ARG1} - Voicemail box  
;   ${ARG2} - Device extension(s) to ring
;; Usage: 
; in main context do exten => 1000,1,Macro(stdexten,1000,1000)
; I use variables defined in the globals section so it becomes
; exten => ${PHONE1},1,Macro(stdexten,${PHONE1},${PHONE1})
;
exten => s,1,GotoIf($~np~["${VMCOUNT(${ARG1})}" != "0"]~/np~?3)   ; User has voicemail
exten => s,2,GotoIf($~np~["${VMCOUNT(${ARG1})}" = "0"]~/np~?4)    ; User has no voicemail
exten => s,3,SendText(You have voicemail messages)         ; Tell user about voicemail
exten => s,4,Dial(${ARG2},10,tTr)                                      ; Ring! Ring!
exten => s,5,Goto(s-${DIALSTATUS},1)                               ; Jump based on status...
exten => s,6,Hangup()                                                      ; Just in case?
exten => s-BUSY,1,Voicemail(b${ARG1})                ; Busy, off to voicemail
exten => s-BUSY,2,Hangup()
exten => s-CHANUNAVAIL,1,Voicemail(u${ARG1})    ; Channel screwed. write a macro for here
exten => s-CHANUNAVAIL,2,Hangup()
exten => s-CONGESTION,1,Congestion()                ; Like above, write a macro for this case
exten => s-CONGESTION,2,Hangup()
exten => s-NOANSWER,1,Voicemail(u${ARG1})       ; Out to lunch, off to voicemail
exten => s-NOANSWER,2,Hangup()
exten => _s-.,1,Goto(s-NOANSWER,1)                    ; Catch the freaks, off to voicemail



[macro-stdexten]
;; Standard extension macro:
;   ${ARG1} - Voicemail box  
;   ${ARG2} - Device extension(s) to ring
;; Usage: 
; in main context do exten => 1000,1,Macro(stdexten,1000,1000)
; I use variables defined in the globals section so it becomes
; exten => ${PHONE1},1,Macro(stdexten,${PHONE1},${PHONE1})
;
exten => s,1,Dial(${ARG2},20)					; Ring the interface, 20 seconds maximum
exten => s,2,Goto(s-${DIALSTATUS},1)				; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)

exten => s-BUSY,1,Voicemail(b${ARG1})				; If busy, send to voicemail w/ busy announce
exten => s-BUSY,2,Goto(public,s,1)				; If they press #, return to start

exten => s-NOANSWER,1,Voicemail(u${ARG1})			; If unavailable, send to voicemail w/ unavail announce
exten => s-NOANSWER,2,Goto(public,s,1)				; If they press #, return to start

exten => _s-.,1,Goto(s-NOANSWER,1)				; Treat anything else as no answer



Version 0.2
A slightly enhanced version of the above...

[macro-stdexten]
;; Standard extension macro:
;   ${ARG1} - Voicemail box  
;   ${ARG2} - Device extension(s) to ring
;; Usage: 
; in main context do exten => 1000,1,Macro(stdexten,1000,1000)
; I use variables defined in the globals section so it becomes
; exten => ${PHONE1},1,Macro(stdexten,${PHONE1},${PHONE1})
;
exten => s,1,GotoIf($~np~["${VMCOUNT(${ARG1})}" != "0"]~/np~?3)   ; User has voicemail
exten => s,2,GotoIf($~np~["${VMCOUNT(${ARG1})}" = "0"]~/np~?4)    ; User has no voicemail
exten => s,3,SendText(You have voicemail messages)         ; Tell user about voicemail
exten => s,4,Dial(${ARG2},10,tTr)                                      ; Ring! Ring!
exten => s,5,Goto(s-${DIALSTATUS},1)                               ; Jump based on status...
exten => s,6,Hangup()                                                      ; Just in case?
exten => s-BUSY,1,Voicemail(b${ARG1})                ; Busy, off to voicemail
exten => s-BUSY,2,Hangup()
exten => s-CHANUNAVAIL,1,Voicemail(u${ARG1})    ; Channel screwed. write a macro for here
exten => s-CHANUNAVAIL,2,Hangup()
exten => s-CONGESTION,1,Congestion()                ; Like above, write a macro for this case
exten => s-CONGESTION,2,Hangup()
exten => s-NOANSWER,1,Voicemail(u${ARG1})       ; Out to lunch, off to voicemail
exten => s-NOANSWER,2,Hangup()
exten => _s-.,1,Goto(s-NOANSWER,1)                    ; Catch the freaks, off to voicemail


Created by: bjohnson, Last modification: Thu 04 of Nov, 2010 (05:52 UTC) by admin
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+