[asterisk-dev] [asterisk-commits] murf: trunk r89272 - /trunk/main/pbx.c

Luigi Rizzo rizzo at icir.org
Fri Nov 16 11:35:20 CST 2007

On Fri, Nov 16, 2007 at 10:07:54AM -0700, Steve Murphy wrote:
> On Fri, 2007-11-16 at 09:34 -0600, Kevin P. Fleming wrote:
> > SVN commits to the Asterisk project wrote:
> > > Author: murf
> > > Rescaled the weights of the patterns to give something more independent of pattern length; and make . less likely to win. Question: which should win for 14102241145-- _1xxxxxxx.   or  _XXXXXXXXXXX  -- right now, the pure X pattern will win.
> I think this is a good idea; from "expected" behavior we can generate an
> algorithm that describes how we calculate the best match. But we need to
> make the algorithm fairly simple, or nobody will be able to follow it,
> and there'll be surprises at runtime.

exactly - this is the way to go, and the reason why i put the description
in main/pbx.c that you mention.

If people have specific needs, they are usually trivial to solve
if the "rules of the game" are simple, and a lot harder if you have
a million options and exceptions to consider.

> So, my system interprets this by assigning weights to each pattern char,
> where, right now, N gets 98, Z gets 99, X gets 100, . and ! get 200 (per
> char matched).
> A sing char, non pattern, gets '1', and char ranges ( [0123] ), get a
> count of the number of chars in the range, where the LOWEST score wins.

I don't understand why N Z X are 98 99 100 instead of 8 9 10 as the
equivalent [2-9] [1-9] [0-9] ranges ?


More information about the asterisk-dev mailing list