[Asterisk-Users] Re: Remember the incoming context?
Tony Mountifield
tony at softins.clara.co.uk
Wed Apr 19 01:28:43 MST 2006
In article <20060418225706.GB1115 at k7.mavetju>,
Edwin Groothuis <edwin at mavetju.org> wrote:
> Greetings,
>
> Somewhere on my asterisk system, a calls come in in a certain
> context, for example, from-sip or from-pstn.
>
> Then the calls gets routed through the dialplan, and a macro gets
> called, and another one and then the call needs to be redirected
> to another number in the same initial context. And you can use
> Dial(Local/number/initialcontext) for that.
>
> Oops, this initial context is lost somewhere on the line.
>
> Unless I'm very mistaken, there is no way to find out what the
> original context was, is there?
The current context is always available in the channel variable ${CONTEXT},
so the easiest thing would be to save this variable in another at the
correct point, and use the saved copy later:
[from-sip]
exten => _X.,1,Set(INITIALCONTEXT=${CONTEXT})
exten => ... and so on
[from-pstn]
exten => _X.,1,Set(INITIALCONTEXT=${CONTEXT})
exten => ... and so on
[somewhere-else]
.... Dial(Local/${NUMBER}@${INITIALCONTEXT})
Or something like that.
And couldn't you use Goto(${INITIALCONTEXT},${NUMBER},1) instead of
Dial(Local/${NUMBER}@${INITIALCONTEXT}) ?
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