[asterisk-dev] extensions.conf included contexts priorities

Andrew Kohlsmith akohlsmith-asterisk at benshaw.com
Tue Apr 24 12:32:30 MST 2007


On Tuesday 24 April 2007 12:36 pm, Jared Smith wrote:
> Actually, I think this *is* intentend.  As I understand it, here's how
> the extension matching works in Asterisk.  First, Asterisk tries to
> find a match in the current context. If it finds no match, it then
> looks for any switch statements to see if it can find a match there.
> If there is no match there, it then looks at any include statements.
> It should also be noted that for nested includes, Asterisk does a
> depth-first search through the includes.

[ ... example snipped ... ]

> In short, we can sum it all up like this: Asterisk checks all
> extensions before switches, and all switches before includes.  I hope
> that clears things up for you.  (If I've made a mistake in my
> explanation, please let me know.)

No, your explanation is clear, but that leaves implementations hazy.  :-(

How would one go about handling catchalls?  the 'i' extension seems like a 
very poor way to do so, and having

[foo-catchall]
exten _XXX,1,NoOp(Do something with a ${EXTEN} from foo)

[foo]
exten => 123,1,...
include => bar
include => baz
include => foo-catchall

[bar-catchall]
exten _XXX,1,NoOp(Do something with a ${EXTEN} from bar)

[bar]
exten => 456,1,...
include => bar-catchall

[baz-catchall]
exten _XXX,1,NoOp(Do something with a ${EXTEN} from baz)

[baz]
exten => 456,1,...
include => baz-catchall

just seems plain old silly...

Similarly, since that does indeed seem to be the case, there is then no way of 
overriding a context's extensions by including another context above the 
extension definitions you want to override.

-A.


More information about the asterisk-dev mailing list