[Asterisk-Users] Dial plan - does not stop after first match

Jean-Yves Avenard jean-yves.avenard at hydrix.com
Mon May 16 16:19:46 MST 2005


Hello
On 17/05/2005, at 8:13 AM, Michael Stahl wrote:

> My dial plan seems to work great - in that when I call extensions  
> 1234 it connects to 1234.  Strangely, after the call terminates  
> (the other side hangs up first), Asterisk continues in the same  
> context and then matches to extensions _. which causes an invalid  
> extension error!
>
> Why does asterisk not leave the context (called internalmenu) after  
> the remote hangup?  Instead, it continues to the InternalInvalid  
> context (included later in the InternalMenu context).   I'm confused!
>
> Here is a snippet of the relevant context and macro.  Thanks,
> Mike
>

But that's exactly what your dialplan ask asterisk to do: keep doing  
stuff after the call has hanged up.
If you do not want to continue after Dial, then make sure there a  
Hangup and nothing else after that.



>
> ;****************************************************************
> ; Macros
> ;****************************************************************
>
> [macro-stdexten]
> ;
> ; Standard extension macro:
> ;   ${ARG1} - Extension  (we could have used ${MACRO_EXTEN} here as  
> well
> ;   ${ARG2} - Device(s) to ring
> ;
> exten => s,1,Playback(transfer,skip)  ; "Please hold while..." but  
> skip if channel is not up
> ;exten => s,2,SendText('Calling extension '${ARG1}) ; Tell the user  
> what extension being called
> exten => s,2,SetVar(LastStatus=CallDone) ; Ensure script knows that  
> a Dial was completed
> exten => s,3,Dial(${ARG2},${RINGTIME},r) ; Ring the interface, 20  
> seconds maximum
> exten => s,4,NoOp(${DIALSTATUS})  ; Show status after hangup
> exten => s,5,Goto(s-${DIALSTATUS},1)  ; Jump based on status  
> (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
>

Here , you tell asterisk to Goto s-. after the Dial operation...

>
> exten => s-NOANSWER,1,Voicemail(u${ARG1}) ; If unavailable, send to  
> voicemail w/ unavail announce
>
> exten => s-BUSY,1,Voicemail(b${ARG1})  ; If busy, send to voicemail  
> w/ busy announce
>
> exten => s-ANSWER,1,NoOp   ; If call answered, then do nothing  
> after hangup
>
> exten => _s-.,1,Goto(s-NOANSWER,1)  ; Treat anything else as no answer
>
> exten => a,1,VoicemailMain(${ARG1})  ; If they press *, send the  
> user into VoicemailMain
>
>
---
Jean-Yves Avenard
Hydrix Pty Ltd - Embedding the net
www.hydrix.com | fax +61 3 95722686 | office +61 3 8573 5299 | direct  
+61 3 8573 5200

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20050516/d119ddb9/attachment.htm


More information about the asterisk-users mailing list