[asterisk-dev] CID match uses "shortest prefix match"
Steve Davies
davies147 at gmail.com
Tue Mar 17 09:22:43 CDT 2009
2009/3/17 Benny Amorsen <benny+usenet at amorsen.dk>:
> Tilghman Lesher <tilghman at mail.jeffandtilghman.com> writes:
>
>> When it comes to the short-circuit operators "." and "!", the first matches,
>> based upon an alphanumeric search of the entire extension string. As Steve
>> Davies correctly pointed out, the order in which matching is done is better
>> managed by using ordered includes (depth-first search). Also note that the
>> short-circuit operators may only be the final character within an extension,
>> by definition: the short-circuit nature of the character means that no
>> further matching will be done.
>
> Why is it that Asterisk does not let people specify the order, except
> with the rather inconvenient use of includes?
>
> It is probably the thing that annoys me the most about dial plans.
>
>
I will answer that question with a question: Which of the following is
the longest match?
exten => _[123][123][123],1,NoOp(Matches 3 digits using 16 bytes of pattern)
exten => _XXXX.,1,NoOp(Matches 5+ digits using only 7 bytes of pattern)
Now how do you describe that in a simple document, and which one is
the longest? This is why I ALWAYS use depth-first matching, and assume
that "exten =>" ordering is not defined in any way. It is so much
safer!
:)
Steve
More information about the asterisk-dev
mailing list