[Asterisk-Users] extensions.conf
Steven Critchfield
critch at basesys.com
Mon Aug 23 09:33:29 MST 2004
On Mon, 2004-08-23 at 09:40, Steve Maroney wrote:
> Hey guys,
>
> Is there a way to make asterisk return the calling point after the last
> command is completed in a context? The goto statement doesn't seem to work
> as I expected it too.
Goto is a unconditional jump. If you expected anything else from it,
your expectations where flawed. I have an idea you where expecting a
gosub type of operation.
> For Example:
>
> [iax-demo]
> exten => s,1,Playback(demo-abouttotry)
> exten => s,2,Dial(IAX2/guest at misery.digium.com/s at default)
> exten => s,3,Playback(demo-nogo)
>
>
> [some-menu]
> exten => s,1,Playback(Some-file)
> exten => s,2,Playback(another-file)
> exten => s,3,Playback(another-file)
> exten => s,4,WaitExten(4)
> exten => s,5,Queue(some-queue)
>
> exten => 300,1,Goto(iax-demo,s,1)
> exten => 300,2,goto(s,3)
>
> [some-other-menu]
> exten => s,1,Playback(Some-different-file)
> exten => s,2,Playback(some-other-file)
> exten => s,3,WaitExten(4)
> exten => s,4,Queue(different-queue)
>
> exten => 300,1,Goto(iax-demo,s,1)
> exten => 300,2,Goto(s,1)
>
> You see, I want the iax-demo in both contexts, but after the demos done,
> I want the caller to be returned to the context, but where depends on
> the calling context. Any help ?
You can accomplish your intended function by using either Macros,
channel variables, or an include.
Specifically, you could make the IAX demo be on a specific extension and
include it appropriately.
[iax-demo]
exten => 300,1,Playback
exten => 300,2,Dial
exten => 300,3,Playback
[some-menu]
exten => ..... normal stuff
include => iax-demo
[some-other-menu]
exten => ...... normal stuff
include => iax-demo
In this case, you never leave the context
[iax-demo]
exten => s,1,playback
exten => s,2,dial
exten => s,3,playback
exten => s,4,goto($STORED_CONTEXT,s,3)
[some-stuff]
exten => s,1,SetVar(STORED_CONTEXT,'some-stuff')
exten => ....... normal stuff
exten => 300,1,goto(iax-demo,s,1)
[some-more-stuff[
exten => s,1,setvar(STORED_CONTEXT,'some-more-stuff)
exten => ........... normal stuff
exten => 300,1,goto(iax-demo,s,1)
Pretty easy when you think about what is provided to you.
--
Steven Critchfield <critch at basesys.com>
More information about the asterisk-users
mailing list