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

Steve Davies davies147 at gmail.com
Mon Mar 16 12:31:10 CDT 2009


2009/3/16 Alex Hermann <alex at speakup.nl>:
> On Monday 16 March 2009 17:57:20 Klaus Darilion wrote:
>> Hi!
>>
>> I tried the CID match feature of Asterisk (1.4.23) but found a strange
>> behavior: it matches on shortest prefix, e.g:
>>
>>    s/_+436991116! => &Macro1();
>>    s/_+4369911!   => &Macro2();
>>
>> if CALLERID(num) is +43699111600 I would think that Macro1 is executed,
>> but instead Macro2 is executed. Regardless of the order in the config file.
>>
>> Debugging is very difficult, as the CID match is not shown in "dialplan
>> show" and also the logging does not reveal any CID matching.
>>
>> I think this is a bug - or is there a reason why shortest prefix match?
>
> That is the function of the !: match as soon as possible. Try a . (dot)
> instead and it will match the loger pattern.
>

Has this changed then?

I was always under the impression that if there were 2 possible
exten=> matches in a single context, then which one was chosen was
"undefined", but include=> directives were still considered in order,
so to specify which order the above patterns are tried would require:

[context1]
include => context2    # <- Consider this first
include => context3    # <- Consider this second

[context2]
exten => s/_+436991116! => &Macro1();
[context3]
exten => s/_+4369911!   => &Macro2();

TBH I am not sure of the use of the ! on the CID match. On the
extension matching I am under the impression that it signifies a
last-ditch match that only occurs if nothing more specific is
available.

Cheers,
Steve



More information about the asterisk-dev mailing list