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

Matthew Nicholson mnicholson at digium.com
Mon Feb 25 14:07:33 CST 2008


On Sat, 2008-02-23 at 12:18 -0600, John Lange wrote:
> On Fri, 2008-02-22 at 16:10 -0600, Matthew Nicholson wrote:
> > On Fri, 2008-02-22 at 10:31 -0600, John Lange wrote:
> > > 
> > > [...]
> > > 
> > > My point is simply that this example doesn't work with the existing
> > > system. "convert-to-local" never matches because "long-distance" is
> > > always a higher priority.
> > > 
> > 
> > I didn't test this, but my gut tells me [convert-to-local] would match
> > before long-distance (asterisk would search in [local] then in
> > [convert-to-local] before moving on).  Also you would need to include
> > the [no-sex] context first for it to be effective, other wise 900
> > numbers would match in [longdistance].
> 
> The order of the patterns has no effect on how they match.

Yes the order of patterns with-in a particular context does not matter,
but the order of include statements does affect matching behavior.
Jared Smith tested this, and my statements appear to be correct.

> >From what I have gathered on this thread, it is "best match current
> context" followed by "best match sub context level 1", "best match sub
> context level 2" etc. down the tree.

You could think of this as a depth first search.  It seems that you
mostly understand how asterisk handles this, but you have come to the
wrong conclusion in this case.

-- 
Matthew Nicholson
Digium




More information about the asterisk-dev mailing list