[asterisk-users] 'Start' in extension rules
Turbo Fredriksson
turbo at bayour.com
Sat Oct 13 18:08:49 CDT 2007
Quoting Philipp Kempgen <philipp.kempgen at amooma.de>:
>> exten => s,1,Answer()
>> exten => s,n,Goto(s-${DIALSTATUS},1)
>
> This still doesn't make sense because you did not Dial()
> before jumping based on ${DIALSTATUS}.
Ok, make sense. But still no go:
----- s n i p -----
[default]
exten => s,1,Answer()
exten => s,2,Dial(SIP/${EXTEN},20,t)
exten => s,4,Goto(default,s-${DIALSTATUS},1)
exten => s-CANCEL,1,Hangup()
exten => s-DONTCALL,1,Voicemail(${EXTEN},u)
exten => s-NOANSWER,1,Voicemail(${EXTEN},u)
exten => s-BUSY,1,Voicemail(${EXTEN},b)
exten => 2403,1,Hangup()
exten => _X.,1,Playback(pbx-invalid)
exten => _X.,2,Hangup()
----- s n i p -----
If I didn't have the '2403,1,Hangup()' line, I just got
'No such extension'. If I instead put:
----- s n i p -----
exten => 2403,1,Dial(SIP/${EXTEN},20,t)
exten => 2403,2,Set(GLOBAL(ORIGEXTEN)=${EXTEN})
exten => 2403,3,Goto(default,s-${DIALSTATUS},1)
----- s n i p -----
And changed the 'EXTEN' to 'ORIGEXTEN' in some places,
added the 'Set()' in some other (mainly as prio 3
in the 's,...' lines) it works. But the whole idea
here was so that I wouldn't have to use so many
lines...
The 's,...' part is STILL not 'executed'...!
>>> exten => _X.,1,Dial(SIP/${EXTEN},20)
>>> exten => _X.,n,Goto(s-${DIALSTATUS},1)
>>
>> > Well, I don't want the first part
>
> Then maybe
>
> [default]
> exten => _X.,1,Dial(SIP/${EXTEN},20)
> exten => _X.,n,Goto(s-${DIALSTATUS},1)
How are these different?
> Or you could define every extension and use a macro. There's an example
> in the default extensions.conf file (if you ran `make samples`).
Ah, got it... A little modifications for my need, and of I went!
For the archive:
----- s n i p -----
[macro-catchstatus]
exten => s,1,Dial(SIP/${ARG1},20,t) ; Dial the extension, maximum 20 seconds
exten => s,2,Goto(s-${DIALSTATUS},1) ; Go to relevant dial status
exten => s-CANCEL,1,Hangup()
exten => s-DONTCALL,1,Voicemail(${ARG2},u) ; Direct caller to the voicemail w/ unavailible
exten => s-NOANSWER,1,Voicemail(${ARG2},u) ; Direct caller to the voicemail w/ unavailible
exten => s-NOANSWER,2,Goto(default,s,1) ; If they press #, return to start
exten => s-BUSY,1,Voicemail(${ARG2},b) ; Direct caller to the voicemail w/ busy
exten => s-BUSY,2,Goto(default,s,1) ; If they press #, return to start
exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer
exten => a,1,VoicemailMain(${ARG2}) ; If they press *, send the user into VoicemailMain
[default]
exten => s,1,Answer() ; Can't Playtones unless we answer the line first
exten => 2403,1,Macro(catchstatus,${EXTEN},${EXTEN})
----- s n i p -----
One line per extension, exactly how I wanted it originally.
Thanx for the pointers!
More information about the asterisk-users
mailing list