[asterisk-dev] CID match uses "shortest prefix match"

Klaus Darilion klaus.mailinglists at pernau.at
Tue Mar 17 09:58:02 CDT 2009



Steve Davies schrieb:
> 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)

Of course this is ambiguous, actualla how is Asterisk sorting such 
extensions?

With
exten => _123.,1,NoOp(Matches 3 digits using 16 bytes of pattern)
exten => _XXXX.,1,NoOp(Matches 5+ digits using only 7 bytes of pattern)

IMO 123 should be evaluated first, and it is evaluated first.

> 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!

But for simple dialplans using tons of includes makes the dialplan 
confusing.

regards
klaus

> 
> :)
> Steve
> 
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
> 
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev



More information about the asterisk-dev mailing list