[asterisk-users] Re: Match a Numer - then continue with dialplan

Tony Mountifield tony at softins.clara.co.uk
Wed Dec 20 14:43:51 MST 2006


In article <emc9v5$8if$1 at softins.clara.co.uk>,
Tony Mountifield <tony at softins.clara.co.uk> wrote:
> In article <645FEC31A18FE54A8721500CDD55A7B6035D0C72 at mail.oneeighty.com>,
> Douglas Garstang <dgarstang at oneeighty.com> wrote:
> > > [example]
> > > include => ctx31X
> > > include => ctx3XX
> > > 
> > > exten => _X.,1,NoOp(this gets executed first for everything)
> > > exten => _X.,2,NoOp(this gets executed second only if ctx31X 
> > > or ctx3XX didnt match)
> > > exten => _X.,3,NoOp(this gets executed third for everything)
> > > 
> > > [ctx31X]
> > > exten => _31X,2,NoOp(this gets executed second for 310-319)
> > > 
> > > [ctx3XX]
> > > exten => _3XX,2,NoOp(this gets executed second for 300-309 
> > > and 320-399)
> > 
> > Does this really work? I've never seen this behavior documented anywhere.
> > Asterisk always searches the current context before looking in included ones for a start.
> > Second, I don't see how it can just jump out of [example] into [ctx31X] and back again
> > without being told to do so.... 
> 
> No, I forgot one thing. Since includes are searched in order, the default
> needs to go in an include as well:
> 
> [example]
> include => ctx31X
> include => ctx3XX
> include => ctxdflt
> 
> [ctxdflt]
> exten => _X.,1,NoOp(this gets executed first for everything)
> exten => _X.,2,NoOp(this gets executed second only if ctx31X or ctx3XX didnt match)
> exten => _X.,3,NoOp(this gets executed third for everything)
> 
> [ctx31X]
> exten => _31X,2,NoOp(this gets executed second for 310-319)
> 
> [ctx3XX]
> exten => _3XX,2,NoOp(this gets executed second for 300-309 and 320-399)
> 
> That should work as I described.

And having just tried it out, it does indeed.

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