[asterisk-dev] search order for pattern matching for includes?

Johansson Olle E oej at edvina.net
Wed May 7 07:41:32 CDT 2008

> __________________________________
> ell, before we go into *why* we do it the way we do it, let's just
> clarify how Asterisk actually does its extension matching.  Since at
> least Asterisk version 1.0, the system looks recursively for a  
> matching
> extension in the following order:
> 1) An exact match in the current context
> 2) A pattern match in the current context
> 3) A match on any switch statements
> 4) A match in the first included context (which we'll call A in the
> example below)
> 4a) A match in the first context included in A (which we'll call AA in
> the example below), following this same set of rules.
> 5) A match in the second included context (B in the example below)
> and so forth.

Actually, you can make it even more detailed, since matching on Caller  
IDs also play a role here.
Replace step 1 with this:

1. Exact match on extension and caller ID
2. Exact match on extension and pattern match on Caller ID
3. Exact match on extension (caller ID not matched)

etc etc etc.


More information about the asterisk-dev mailing list