login | register
Sun 07 of Sep, 2008 [10:06 UTC]

voip-info.org

History

Stdexten macro

Created by: bjohnson,Last modification on Mon 20 of Nov, 2006 [13:19 UTC] by gremlin
[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($["${VMCOUNT(${ARG1})}" != "0"]?3) ; User has voicemail
exten => s,2,GotoIf($["${VMCOUNT(${ARG1})}" = "0"]?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

Comments

Comments Filter
222

333Called from where?

by rupert, Wednesday 09 of July, 2008 [02:18:37 UTC]
The stdexten macro seems to be called automagically (1.4), even if not referenced anywhere in the dialplan.
I couldn't find any documentation about that behaviour. Maybe something with users.conf vs. sip.conf/iax.conf?

Maybe someone who knows can add a respective comment?