[Asterisk-Users] standard extension with forwarding

snacktime snacktime at gmail.com
Tue Nov 22 00:36:40 MST 2005


I threw together this standard extension and would like some feedback
if there is a better way.  I didn't want to use priority jumping, and
I needed it to handle calling outside numbers also without opening up
my whole outside dialing context to incoming callers.  It's based on
the default standard extension macro in asterisk.

; Standard extension macro:
;   ${ARG1} - Device(s) to ring
;   ${ARG2} - Voicemail Box

exten => s,1,DBget(CFU=CF/${MACRO_EXTEN}/CFU)
exten => s,2,DBget(CFB=CF/${MACRO_EXTEN}/CFB)
exten => s,3,DBget(CFNA=CF/${MACRO_EXTEN}/CFNA)
exten => s,4,GotoIf($["${CFU}" != ""]?s-CFU|1)
exten => s,1,Set(DIALNUM=${ARG1})
exten => s,2,GotoIf($[${LEN(${DIALNUM})} >= 7]?s-DIAL|3:s-DIAL|1)

exten => s-NOANSWER,1,GotoIf($["${CFNA}" != "" & "${NOANSWER}" != 1]?s-CFNA|1)
exten => s-NOANSWER,2,Set(NOANSWER=1)
exten => s-NOANSWER,3,Voicemail(u${ARG2})
exten => s-NOANSWER,4,Hangup

exten => s-BUSY,1,GotoIf($["${CFB}" != "" & "${BUSY}" != 1]?s-CFB|1)
exten => s-BUSY,2,Set(BUSY=1)
exten => s-BUSY,3,Voicemail(b${ARG2})
exten => s-BUSY,4,Hangup

exten => s-CFU,1,Set(DIALNUM=${CFU})
exten => s-CFU,2,GotoIf($[${LEN(${DIALNUM})} >= 7]?s-DIAL|3:s-DIAL|1)

exten => s-CFB,1,Set(DIALNUM=${CFB})
exten => s-CFB,2,GotoIf($[${LEN(${DIALNUM})} >= 7]?s-DIAL|3:s-DIAL|1)

exten => s-CFNA,1,Set(DIALNUM=${CFNA})
exten => s-CFNA,2,GotoIf($[${LEN(${DIALNUM})} >= 7]?s-DIAL|3:s-DIAL|1)

exten => s-DIAL,1,Dial(Local/${DIALNUM}@extensions/n,20)
exten => s-DIAL,2,Goto(s-${DIALSTATUS},1)
exten => s-DIAL,3,Dial(Local/${DIALNUM}@outgoing/n,20)
exten => s-DIAL,4,Goto(s-${DIALSTATUS},1)

exten => _s-.,1,Goto(s-NOANSWER,1)



More information about the asterisk-users mailing list