[Home]

Summary:ASTERISK-10874: Picking the wrong extension with _21x.
Reporter:Niklas Larsson (pnlarsson)Labels:
Date Opened:2007-11-24 09:01:50.000-0600Date Closed:2007-11-24 14:58:04.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:PBX/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:Another issue with extension matching, in trunk rev 89537.

Dialing 2012 picks upp extension 20 instead of _20x.

[general]
static=yes
writeprotect=no

[from-internal]
include=>ext_test
include=>ext_local

[ext_local]
exten=>_20x.,1,Noop(20x)

[ext_test]
exten=>20,1,Noop(20)


****** ADDITIONAL INFORMATION ******

lisa*CLI> dialplan reload
== Parsing '/etc/asterisk/extensions.conf':   == Found
  -- Registered extension context 'from-internal'
  -- Including context 'ext_test' in context 'from-internal'
  -- Including context 'ext_local' in context 'from-internal'
  -- Registered extension context 'ext_local'
  -- Added extension '_20x.' priority 1 to ext_local
  -- Registered extension context 'ext_test'
  -- Added extension '20' priority 1 to ext_test

lisa*CLI> dialplan show
[ Context 'ext_test' created by 'pbx_config' ]
 '20' =>           1. Noop(20)                                   [pbx_config]

[ Context 'ext_local' created by 'pbx_config' ]
 '_20x.' =>        1. Noop(20x)                                  [pbx_config]

[ Context 'from-internal' created by 'pbx_config' ]
 Include =>        'ext_test'                                    [pbx_config]
 Include =>        'ext_local'                                   [pbx_config]

[ Context 'app_queue_gosub_virtual_context' created by 'app_queue' ]
 's' =>            1. KeepAlive()                                [app_queue]

[ Context 'app_dial_gosub_virtual_context' created by 'app_dial' ]
 's' =>            1. KeepAlive()                                [app_dial]

[ Context 'parkedcalls' created by 'res_features' ]
 '700' =>          1. Park()                                     [res_features]

    In-mem exten Trie for Fast Extension Pattern Matching:


          Explanation: Node Contents Format = <char(s) to match>:<pattern?>:<specif>:[matched extension]
                       Where <char(s) to match> is a set of chars, any one of which should match the current character
                             <pattern?>: Y if this a pattern match (eg. _XZN[5-7]), N otherwise
                             <specif>: an assigned 'exactness' number for this matching char. The lower the number, the more exact the match
                             [matched exten]: If all chars matched to this point, which extension this matches. In form: EXTEN:<exten string>
                       In general, you match a trie node to a string character, from left to right. All possible matching chars
                       are in a string vertically, separated by an unbroken string of '+' characters.

7:N:-:1:
+       0:N:-:1:
+       +       0:N:-:1:EXTEN:700(0x81afab8)

-= 5 extensions (5 priorities) in 6 contexts. =-

lisa*CLI>
 == Using TOS bits 0
 == Using CoS mark 5

  -- Executing [2012@from-internal:1] NoOp("SIP/2006-b701baa0", "20") in new stack
  -- Auto fallthrough, channel 'SIP/2006-b701baa0' status is 'UNKNOWN'
Comments:By: Tilghman Lesher (tilghman) 2007-11-24 10:50:18.000-0600

Please try using a capital X, instead.

By: Niklas Larsson (pnlarsson) 2007-11-24 11:43:58.000-0600

lisa*CLI> dialplan reload
 == Parsing '/etc/asterisk/extensions.conf':   == Found
   -- Registered extension context 'from-internal'
   -- Including context 'ext_test' in context 'from-internal'
   -- Including context 'ext_local' in context 'from-internal'
   -- Registered extension context 'ext_local'
   -- Added extension '_20X.' priority 1 to ext_local
   -- Registered extension context 'ext_test'
   -- Added extension '20' priority 1 to ext_test
 == Using TOS bits 0
 == Using CoS mark 5
   -- Executing [2012@from-internal:1] NoOp("SIP/2006-08289e18", "20") in new stack
   -- Auto fallthrough, channel 'SIP/2006-08289e18' status is 'UNKNOWN'

By: Digium Subversion (svnbot) 2007-11-24 14:58:04.000-0600

Repository: asterisk
Revision: 89547

U   trunk/configs/extensions.conf.sample
U   trunk/include/asterisk/pbx.h
U   trunk/main/pbx.c
U   trunk/pbx/pbx_config.c

------------------------------------------------------------------------
r89547 | murf | 2007-11-24 14:58:02 -0600 (Sat, 24 Nov 2007) | 1 line

closes issue ASTERISK-10874; where the pattern _20x. buried in an included context, didn't match 2012; There were a small set of problems to fix: 1. I needed NOT to score patterns unless you are at the end of the data string. 2. Capital N,X,Z and small n,x,z are OK in patterns. I canonicalize the patterns in the trie to caps. 3. When a pattern ends with dot or exclamation, CANMATCH/MATCHMORE should always report this pattern, no matter the length.  With this commit, I also supplied the wish of Luigi, where the user can select which pattern matching algorithm to use, the old (legacy) pattern matcher, or the new, trie based matcher. The OLD matcher is the default. A new [general] section variable, extenpatternmatchnew, is added to the extensions.conf, and the example config has it set to false. If true, the new matcher is used. In all other respects, the context/exten structs are the same; the tries and hashtabs are formed, but in the new mode the tries are not used.  A new CLI command 'dialplan set extenpatternmatch true/false' is provided to allow switching at run time. I beg users that are forced to return to the old matcher to please report the reason in the bug tracker. Measured the speed benefit of the new matcher against an impossibly large context with 10,000 extensions: the new matcher is 374 times faster.
------------------------------------------------------------------------