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? Edwin -- Edwin Groothuis | Personal website: http://www.mavetju.org edwin@mavetju.org | Weblog: http://weblog.barnet.com.au/edwin/
I thought this was Local/number@context If the number is unique in your configuration, and the context is already included somehow in your default-context, you can just do a Local/number, give it a try Edwin Groothuis 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? > >Edwin > > >
On Tue, Apr 18, 2006 at 06:57:32PM -0700, asterisk-users-request@lists.digium.com wrote:> If the number is unique in your configuration, and the context is > already included somehow in your default-context, you can just do a > Local/number, give it a tryThe issue is, I don't want it in the default context (which is the standard one if you omit the @), I want it in the current context. That way I can be sure that if somebody calls in the from the PSTN or the internet context, they won't end up calling out again, while if I'm calling in from one of my phone contextes, I can do the magic dial(Local/) in my macro, but then require the right context. Looks like I have to submit a patch! Edwin -- Edwin Groothuis | Personal website: http://www.mavetju.org edwin@mavetju.org | Weblog: http://weblog.barnet.com.au/edwin/
Hi Have you tried using something like Set(ORIGINAL_CHANNEL=from-sip) in the original channel? You can then use Dial(Local/number/${ORIGINAL_CHANNEL}). Regards, Silviu -----Original Message----- From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Edwin Groothuis Sent: mercredi 19 avril 2006 00:57 To: asterisk-users@lists.digium.com Subject: [Asterisk-Users] Remember the incoming context? 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? Edwin -- Edwin Groothuis | Personal website: http://www.mavetju.org edwin@mavetju.org | Weblog: http://weblog.barnet.com.au/edwin/ _______________________________________________ --Bandwidth and Colocation provided by Easynews.com -- Asterisk-Users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Tony Mountifield
2006-Apr-19 01:28 UTC
[Asterisk-Users] Re: Remember the incoming context?
In article <20060418225706.GB1115@k7.mavetju>, Edwin Groothuis <edwin@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@softins.co.uk - http://www.softins.co.uk Play: tony@mountifield.org - http://tony.mountifield.org