[asterisk-dev] Re: extensions.conf included contexts priorities

Watkins, Bradley Bradley.Watkins at compuware.com
Thu Apr 26 04:16:54 MST 2007


 
> > 
> > Here's an example:
> > 
> > [foo]
> > exten => 22,1,NoOp(CONTEXT1=${CONTEXT})
> > 
> > include => bar
> > include => baz
> > 
> > [bar]
> > exten => 22,2,NoOp(CONTEXT2=${CONTEXT}) exten => 22,4,Hangup
> > 
> > [baz]
> > exten => 22,3,NoOp(CONTEXT3=${CONTEXT})
> > 
> > If the caller enters context "foo" at extension 22, the following 
> > dialplan applications will be invoked:
> > 
> > NoOp(CONTEXT1=foo)
> > NoOp(CONTEXT2=foo) *** not bar ***
> > NoOp(CONTEXT3=foo) *** not baz ***
> > Hangup
> 

> 
> But your example is truly mind-expanding. Heaven help the 
> dialplan programmer who uses those kinds of tricks, even if 
> they are possible.
> Any examples of practical usage that would demand this?
> 

There is, in fact, an existing feature in chan_sip that specifically
requires this behavior:  regcontext/regexten

The implementation there is to have a separate context where all the
exten=> XXX,1,NoOP() lines are put, and then have that context be
included in whatever context your sip peers are in.  Like so:

In sip.conf:

Regcontext=sipregs

[1234]
Yada
Yada
Regexten=1234
Context=sip-phones

In extensions.conf:

[sip-phones]

exten => _1XXX,2,Dial(SIP/${EXTEN})
include => sipregs


This will cause chan_sip to create a context called sipregs and,
assuming peer 1234 is registered, then you will be able to call it since
a priority 1 matching the dialed extension exists (in the included
context).


That's a significantly less obtuse example, but is essentially the same
functionality.  I would certainly never intentionally write anything
like what Tony did if I could avoid it. :)

- Brad

The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. 


More information about the asterisk-dev mailing list