[Asterisk-Users] Re: WaitExten question

Tony Mountifield tony at softins.clara.co.uk
Sat Mar 26 02:23:55 MST 2005


In article <1f060c4c0503251340b6d5c6f at mail.gmail.com>,
snacktime <snacktime at gmail.com> wrote:
> I'm a bit confused about how WaitExten works.  I assumed that when it
> returns 0, the next priority in the extension would be executed, but
> that doesn't seem to be the case.   When I get to WaitExten and enter
> extension 8, it plays the message, then Waits another 10 seconds and
> times out.
> 
> 
> [local]
> exten => s,1,Wait,1                     ; Wait a second, just for fun
> exten => s,2,Answer                     ; Answer the line
> exten => s,3,DigitTimeout,5             ; Set Digit Timeout to 5 seconds
> exten => s,4,BackGround(thank-you-for-calling)  ; Play a congratulatory message
> exten => s,5,Playback(enter-ext-of-person)
> exten => s,6,WaitExten(10)
> exten => s,7,Playback(goodbye)
> exten => s,9,Hangup

You have a gap between s,7 and s,9. The Hangup should be on s,8.
But that's not relevant to the problem you reported.

> exten => 1000,1,Goto(local,s,1)
> exten => 8,1,Playback(/tmp/test)          ; "test message"

After you enter extension 8, it jumps to here and does Playback. But it
doesn't then jump back to s, it looks for 8,2, and, not finding it, it
just waits for the default response timeout for another extension to be
entered.  But it is not WaitExten(10) that is doing that, it is default
behaviour. If no extension is entered, it goes to t,1.

> exten => #,1,Playback(goodbye)              ; "Thanks for trying the demo"
> exten => #,2,Hangup                     ; Hang them up.
> exten => t,1,Goto(#,1)                  ; If they take too long, give up
> exten => i,1,Playback(invalid)          ; "That's not valid, try again"
> 
> 
> Also, I'm confused about this line in the wiki regarding WaitExten. 
> Specifically what is mean't by 'stack' and 'restarts the current
> context'.  I'm guessing stack means the digits WaitExten has read from
> the caller.  I would think that restarting the current context would
> mean it jump back up to s,1, but it doesn't.  It just resumes at s,6.

I agree the description is confusing! What I think it means is that
the extension during the WaitExten period replaces the current extension
(which was s), but in the current context (i.e. [whatever-its-in-already]).
The term "stack" doesn't imply any kind of subroutine call-and-return
functionality.

Hope this helps
Cheers
Tony
-- 
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org



More information about the asterisk-users mailing list