Upgrade 3CX to v18 and get it hosted free!

Stdexten macro

Author image

[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

Article Reviews

Write a Review

Your email address will not be published. Required fields are marked *

Required Field. Minimum 5 characters.

Required Field. Minimum 5 characters, maximum 50.

Required field.There is an error with this field.

Required Field.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

There are no reviews for this article. Be the first one to write a review.
Get 3CX - Absolutely Free!
Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.