Macro's giving a hard time


#1

Hi,
I have configured several extensions on my asterisk machine, but every time I create a new extension, I have to define all the steps that are needed in order to answer a specific extension. Currently, this is what my extensions.conf looks like(Fig. 1):

[code][IT-Staff]
exten => 8534,1,dial(SIP/user0,31,rt)
exten => 8534,2,Goto(8534-${DIALSTATUS},1) ; Check the status of the user
exten => 8534-BUSY,1,Voicemail(b8534) ; If Busy, ring voicemail with busy msg
exten => 8534-BUSY,2,Hangup
exten => 8534-NOANSWER,1,Voicemail(u8534) ; If not available, ring voicemail with no-answer msg
exten => 8534-NOANSWER,2,Hangup
exten => 8534,3,Hangup
exten => user0,1,goto(8534,1) ; This statment allows users to be dialed by name
exten => _8534-.,1,Goto(8534-NOANSWER,1) ; Treat anything else as no answer – This LINE IS IMPORTANT

exten => 8586,1,dial(SIP/user1,31,rt)
exten => 8586,2,Goto(8586-${DIALSTATUS},1)
exten => 8586-BUSY,1,Voicemail(b8586)
exten => 8586-BUSY,2,Hangup
exten => 8586-NOANSWER,1,Goto(8586-CallMyCell,1)
exten => 8586-NOANSWER,2,Voicemail(u8586)
exten => 8586-NOANSWER,3,Hangup
exten => 8586-CallMyCell,1,Dial(SIP/901234567890@zultysOutgoingCalls,20,rt)
exten => 8586-CallMyCell,2,Goto(8586-NOANSWER,2)
exten => 8586,3,Hangup
exten => user1,1,goto(8586,1)
exten => _8586-.,1,Goto(8586-NOANSWER,1) ; Treat anything else as no answer – This LINE IS IMPORTANT[/code]

I am trying to define a macro, that looks like this (Fig. 2):

[code][macro-it-staff]

; 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(SIP/${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 [/code]

After this, when I configure an extension like this (Fig. 3):

It directly goes to the voicemail, rather than ringing the phone. Is there something that I am missing? I am not, yet, comfortable with macros, so I would appreciate any help. I have already tried voip-info.org. Once, I am comfortable with macros, I would like to implement call forwarding also that allows the user to enable/disable it.

. I have question for the lower block in Fig. 1. If a person calls user1’s extension, and if he is not in the office, the caller would be forwareded to his cellphone. Well, if he doesn’t answer his phone, it should ring back to his voicemail. But that never happens, the call keeps going and ultimately gets hung up. Notice that, the calls are going through Zultys which has the PSTN terminated in it.


#2

Hi,
I got the standard macro working that posted in my last post. But now, I can’t get the forwarding macro setup. It looks like this:

[apps] ; ; Unconditional Call Forward ; ; create call forward exten => _*21*X.,1,GotoIf($${EXTEN:-1} = #?2:3) exten => _*21*X.,2,StripLSD(1) exten => _*21*X.,3,DBput(CFIM/${CALLERIDNUM}=${EXTEN:4}) exten => _*21*X.,4,Hangup ; ; delete call forward exten => **21,1,ODBCdel(CFIM/${CALLERIDNUM}) exten => **21,2,Hangup ; ; delete call forward (with #) exten => **21#,1,Goto(**21,1)

How do I dial to call forwarding? Or, how do I reach it, from a standard extension. E.g.: If I have:

exten => 1000,1,Macro(it-staff,1000,1000) exten => user2,1,Goto(1000,1)

I believe I will have to add a line somewhere but I am not sure where?