[asterisk-dev] new priority of pattern matching in 1.4. Does it makes sense?

Atis Lezdins atis at iq-labs.net
Tue Feb 26 04:45:01 CST 2008


On 2/25/08, Jared Smith <jsmith at digium.com> wrote:
> On Mon, 2008-02-25 at 14:51 -0600, John Lange wrote:
>  > My example was contrived (to protect the innocent) so working through
>  > the way I have it in the real world I'm slowly coming to the realization
>  > that the order of inclusion is what was throwing it off.
>
>
> I was afraid this was the case, which is why I tried to explain it as
>  clearly as I could.
>
>
>  > So I think I finally have a handle on how Asterisk does matching. It's
>  > kind of embarrassing that I've been doing Asterisk so long and not had a
>  > complete understanding of how it works.
>  >
>  > Anyhow, does this description do it justice?
>
>
> Pretty good -- I'll add a few minor details in here, just for those who
>  are following along and trying to learn it for themselves.
>
>
>  > Asterisk pattern matching works like this:
>  >
>  > 1) Asterisk searches for *ANY* matching pattern in the starting context
>  > giving priority to the best match.
>
>
> Yes.
>
>
>  > 2) Only if no pattern could possibly match in the starting context,
>  > Asterisk will search the first specified included context, again giving
>  > priority to the best match.
>
>
> Yes (assuming there are no "switch =>" statements)
>
>
>  > 3) Only if no pattern could possibly match in the first included
>  > context, then Asterisk will search the second, then third included
>  > context, and so on until a match is found or all patterns have been
>  > tested.
>
>
> I'd rewrite this as "Only if no patter could possibly matchin in the
>  first included context *or any contexts included in the first included
>
> context*, then Asterisk will search the second, then third included
>  context, and so on until a match is found or all patterns have been
>  tested."
>
>  > 4) if no pattern matches, the "i" extension will be matched.
>
>
> The 'i' only matches if an extension is entered at a Background() or
>  WaitExten() application.  An arbitrary extension being dialed in a
>  context will not trigger the 'i' extension.

And how about GoTo? It also will jump to "i" if can't match.

>
>  > 5) if no "i" extension exists, the "t" extension will match after the
>  > specified timeout.
>
>
> The 't' extension will be matched after a response timeout from either
>  the Background() or WaitExten() applications (whether or not an 'i'
>  extension exists).
>
>
>  --
>  Jared Smith
>  Community Relations Manager
>  Digium, Inc.
>

Regards,
Atis

-- 
Atis Lezdins
VoIP Project Manager,
IQ Labs Inc.
atis at iq-labs.net
Skype: atis.lezdins
Cell Phone: +371 28806004
Work phone: +1 800 7502835



More information about the asterisk-dev mailing list