NSLU2-Linux
view · edit · print · history

For asterisk 1.2

[macro-stdexten];
;
; Standard extension macro:
;   ${ARG1} - Extension  (we could have used ${MACRO_EXTEN} here as well
;   ${ARG2} - Device(s) to ring
;   ${ARG3} - Dial command arguments
;
exten => s,1,Set(temp=${DB(CFU/${ARG1})})       ; Get CFU key
exten => s,2,GotoIf($["${temp}" = ""]?5)        ; If not existing, ring the interface
exten => s,3,Dial(Local/${temp}@default/n)      ; Unconditional Forward
exten => s,4,Voicemail(u${ARG1})                ; If CFU failed, send to voicemail w/ unavail announce
exten => s,5,Dial(${ARG2},30,${ARG3})           ; Ring the interface, 30 seconds maximum
exten => s,6,Goto(s-${DIALSTATUS},1)            ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)

exten => s-NOANSWER,1,Set(temp=${DB(CFNA/${ARG1})})     ; Get CFNA key
exten => s-NOANSWER,2,GotoIf($["${temp}" = ""]?4)       ; If not existing, goto voicemail
exten => s-NOANSWER,3,Dial(Local/${temp}@default/n)     ; Forward on No Answer
exten => s-NOANSWER,4,Voicemail(u${ARG1})       ; If unavailable, send to voicemail w/ unavail announce
exten => s-NOANSWER,5,Goto(s,5)                 ; If they press #, return to ring the interface

exten => s-BUSY,1,Set(temp=${DB(CFB/${ARG1})})          ; Get CFB key
exten => s-BUSY,2,GotoIf($["${temp}" = ""]?4)   ; If not existing, goto voicemail
exten => s-BUSY,3,Dial(Local/${temp}@default/n) ; Forward on Busy
exten => s-BUSY,4,Voicemail(b${ARG1})           ; If busy, send to voicemail w/ busy announce
exten => s-BUSY,5,Goto(s,5)                     ; If they press #, return to ring the interface

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

exten => a,1,VoicemailMain(${ARG1}@default)     ; If they press *, send the user into VoicemailMain


[apps]

; Call Forward Unconditional
; activate
exten => _*21*X.,1,Set(DB(CFU/${CALLERIDNUM})=${EXTEN:4})
exten => _*21*X.,2,Playback(call-fwd-unconditional)
exten => _*21*X.,3,Playback(has-been-set-to)
exten => _*21*X.,4,SayDigits(${EXTEN:4})
exten => _*21*X.,5,Hangup
; clear
exten => *20*,1,Set(DB(CFU/${CALLERIDNUM})=)
exten => *20*,2,Playback(call-fwd-unconditional)
exten => *20*,3,Playback(has-been-cleared)
exten => *20*,4,Hangup
; query
exten => *25*,1,Playback(call-fwd-unconditional)
exten => *25*,2,Set(temp=${DB(CFU/${CALLERIDNUM})})  ; Get CFU key
exten => *25*,3,GotoIf($["${temp}" = ""]?7)
exten => *25*,4,Playback(is-set-to)
exten => *25*,5,SayDigits(${temp})
exten => *25*,6,Hangup
exten => *25*,7,Playback(is-not-set)
exten => *25*,8,Hangup


; Call Forward Busy
; activate
exten => _*41*X.,1,Set(DB(CFB/${CALLERIDNUM})=${EXTEN:4})
exten => _*41*X.,2,Playback(call-fwd-on-busy)
exten => _*41*X.,3,Playback(has-been-set-to)
exten => _*41*X.,4,SayDigits(${EXTEN:4})
exten => _*41*X.,5,Hangup
; clear
exten => *40*,1,Set(DB(CFB/${CALLERIDNUM})=)
exten => *40*,2,Playback(call-fwd-on-busy)
exten => *40*,3,Playback(has-been-cleared)
exten => *40*,4,Hangup
; query
exten => *45*,1,Playback(call-fwd-on-busy)
exten => *45*,2,Set(temp=${DB(CFB/${CALLERIDNUM})})  ; Get CFB key
exten => *45*,3,GotoIf($["${temp}" = ""]?7)
exten => *45*,4,Playback(is-set-to)
exten => *45*,5,SayDigits(${temp})
exten => *45*,6,Hangup
exten => *45*,7,Playback(is-not-set)
exten => *45*,8,Hangup

; Call Forward Not Answer
; activate
exten => _*61*X.,1,Set(DB(CFNA/${CALLERIDNUM})=${EXTEN:4})
exten => _*61*X.,2,Playback(call-fwd-no-ans)
exten => _*61*X.,3,Playback(has-been-set-to)
exten => _*61*X.,4,SayDigits(${EXTEN:4})
exten => _*61*X.,5,Hangup
; clear
exten => *60*,1,Set(DB(CFNA/${CALLERIDNUM})=)
exten => *60*,2,Playback(call-fwd-no-ans)
exten => *60*,3,Playback(has-been-cleared)
exten => *60*,4,Hangup
; query
exten => *65*,1,Playback(call-fwd-no-ans)
exten => *65*,2,Set(temp=${DB(CFNA/${CALLERIDNUM})})  ; Get CFNA key
exten => *65*,3,GotoIf($["${temp}" = ""]?7)
exten => *65*,4,Playback(is-set-to)
exten => *65*,5,SayDigits(${temp})
exten => *65*,6,Hangup
exten => *65*,7,Playback(is-not-set)
exten => *65*,8,Hangup

; Call Forward Unconditional to Voicemail
exten => *22*,1,Set(DB(CFU/${CALLERIDNUM})=*${CALLERIDNUM})
exten => *22*,2,Playback(call-fwd-unconditional)
exten => *22*,3,Playback(has-been-set-to)
exten => *22*,4,Playback(voice-mail-system)
exten => *22*,5,Hangup

; Cancel All Forwards
exten => *00*,1,Set(DB(CFU/${CALLERIDNUM})=)
exten => *00*,2,Set(DB(CFB/${CALLERIDNUM})=)
exten => *00*,3,Set(DB(CFNA/${CALLERIDNUM})=)
exten => *00*,4,Playback(call-fwd-cancelled)
exten => *00*,5,Hangup

; extension for checking voicemail via voicemailmain
exten => 81,1,VoicemailMain
exten => 81,2,Hangup

; this allows all users to to dial a common extension number to directly access thier voicemail mailbox
exten => 80,1,VoicemailMain(s${CALLERIDNUM})
exten => 80,2,Hangup

; this allow users to transfer calls directly to a mailbox by dialing * followed by an extension number
exten => _*4XX,1,Voicemail(u${EXTEN:1})
exten => _*4XX,2,Hangup

For asterisk 1.4

[macro-stdexten];
;
; Standard extension macro:
;   ${ARG1} - Extension  (we could have used ${MACRO_EXTEN} here as well
;   ${ARG2} - Device(s) to ring
;   ${ARG3} - Dial command arguments
;
exten => s,1,GotoIf(${DB_EXISTS(CFU/${ARG1})}?2:4)       ; If CFU key not existing, ring the interface
exten => s,2,Dial(Local/${DB_RESULT}@default/n) ; Unconditional Forward
exten => s,3,Voicemail(${ARG1},u)               ; If CFU failed, send to voicemail w/ unavail announce
exten => s,4,Dial(${ARG2},30,${ARG3})           ; Ring the interface, 30 seconds maximum
exten => s,5,Goto(s-${DIALSTATUS},1)            ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)

exten => s-NOANSWER,1,GotoIf(${DB_EXISTS(CFNA/${ARG1})}?2:3)    ; If CFNA key not existing, goto voicemail
exten => s-NOANSWER,2,Dial(Local/${DB_RESULT}@default/n)        ; Forward on No Answer
exten => s-NOANSWER,3,Voicemail(${ARG1},u)      ; If unavailable, send to voicemail w/ unavail announce
exten => s-NOANSWER,4,Goto(s,4)                 ; If they press #, return to ring the interface

exten => s-BUSY,1,GotoIf(${DB_EXISTS(CFB/${ARG1})}?2:3)  ; If CFB key not existing, goto voicemail
exten => s-BUSY,2,Dial(Local/${DB_RESULT}@default/n)    ; Forward on Busy
exten => s-BUSY,3,Voicemail(${ARG1},b)          ; If busy, send to voicemail w/ busy announce
exten => s-BUSY,4,Goto(s,4)                     ; If they press #, return to ring the interface

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

exten => a,1,VoicemailMain(${ARG1}@default)     ; If they press *, send the user into VoicemailMain



[apps]

; Call Forward Unconditional
; activate
exten => _*21*X.,1,Set(DB(CFU/${CALLERID(num)})=${EXTEN:4})
exten => _*21*X.,2,Playback(call-fwd-unconditional)
exten => _*21*X.,3,Playback(has-been-set-to)
exten => _*21*X.,4,SayDigits(${EXTEN:4})
exten => _*21*X.,5,Hangup
; clear
exten => *20*,1,Set(temp=${DB_DELETE(CFU/${CALLERID(num)})})
exten => *20*,2,Playback(call-fwd-unconditional)
exten => *20*,3,Playback(has-been-cleared)
exten => *20*,4,Hangup
; query
exten => *25*,1,Playback(call-fwd-unconditional)
exten => *25*,2,GotoIf(${DB_EXISTS(CFU/${CALLERID(num)})}?3:6)  ; Get CFU key
exten => *25*,3,Playback(is-set-to)
exten => *25*,4,SayDigits(${DB_RESULT})
exten => *25*,5,Hangup
exten => *25*,6,Playback(is-not-set)
exten => *25*,7,Hangup

; Call Forward Busy
; activate
exten => _*41*X.,1,Set(DB(CFB/${CALLERID(num)})=${EXTEN:4})
exten => _*41*X.,2,Playback(call-fwd-on-busy)
exten => _*41*X.,3,Playback(has-been-set-to)
exten => _*41*X.,4,SayDigits(${EXTEN:4})
exten => _*41*X.,5,Hangup
; clear
exten => *40*,1,Set(temp=${DB_DELETE(CFB/${CALLERID(num)})})
exten => *40*,2,Playback(call-fwd-on-busy)
exten => *40*,3,Playback(has-been-cleared)
exten => *40*,4,Hangup
; query
exten => *45*,1,Playback(call-fwd-on-busy)
exten => *45*,2,GotoIf(${DB_EXISTS(CFB/${CALLERID(num)})}?3:6)  ; Get CFB key
exten => *45*,3,Playback(is-set-to)
exten => *45*,4,SayDigits(${DB_RESULT})
exten => *45*,5,Hangup
exten => *45*,6,Playback(is-not-set)
exten => *45*,7,Hangup

; Call Forward Not Answer
; activate
exten => _*61*X.,1,Set(DB(CFNA/${CALLERID(num)})=${EXTEN:4})
exten => _*61*X.,2,Playback(call-fwd-no-ans)
exten => _*61*X.,3,Playback(has-been-set-to)
exten => _*61*X.,4,SayDigits(${EXTEN:4})
exten => _*61*X.,5,Hangup
; clear
exten => *60*,1,Set(temp=${DB_DELETE(CFNA/${CALLERID(num)})})
exten => *60*,2,Playback(call-fwd-no-ans)
exten => *60*,3,Playback(has-been-cleared)
exten => *60*,4,Hangup
; query
exten => *65*,1,Playback(call-fwd-no-ans)
exten => *65*,2,GotoIf(${DB_EXISTS(CFNA/${CALLERID(num)})}?3:6)  ; Get CFNA key
exten => *65*,3,Playback(is-set-to)
exten => *65*,4,SayDigits(${DB_RESULT})
exten => *65*,5,Hangup
exten => *65*,6,Playback(is-not-set)
exten => *65*,7,Hangup

; Call Forward Unconditional to Voicemail
exten => *22*,1,Set(DB(CFU/${CALLERID(num)})=*${CALLERID(num)})
exten => *22*,2,Playback(call-fwd-unconditional)
exten => *22*,3,Playback(has-been-set-to)
exten => *22*,4,Playback(voice-mail-system)
exten => *22*,5,Hangup

; Cancel All Forwards
exten => *00*,1,Set(temp=${DB_DELETE(CFU/${CALLERID(num)})})
exten => *00*,2,Set(temp=${DB_DELETE(CFB/${CALLERID(num)})})
exten => *00*,3,Set(temp=${DB_DELETE(CFNA/${CALLERID(num)})})
exten => *00*,4,Playback(call-fwd-cancelled)
exten => *00*,5,Hangup


; extension for checking voicemail via voicemailmain
exten => 81,1,VoicemailMain
exten => 81,2,Hangup

;this allows all users to to dial a common extension number to directly access thier voicemail mailbox
exten => 80,1,VoicemailMain(${CALLERID(num)},s)
exten => 80,2,Hangup

;this allow users to transfer calls directly to a mailbox by dialing * followed by an extension number
exten => _*4XX,1,Voicemail(${EXTEN:1},u)
exten => _*4XX,2,Hangup

view · edit · print · history · Last edited by cdoban.
Originally by cdoban.
Page last modified on February 12, 2007, at 04:16 PM