[asterisk-bugs] [Asterisk 0012777]: Pattern matching treats 'x' differently than 'X'

noreply at bugs.digium.com noreply at bugs.digium.com
Mon Jun 2 22:31:50 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=12777 
====================================================================== 
Reported By:                jsmith
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   12777
Category:                   PBX/pbx_config
Reproducibility:            always
Severity:                   minor
Priority:                   high
Status:                     new
Asterisk Version:           SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  1.4  
SVN Revision (number only!): 117582 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             06-02-2008 21:50 CDT
Last Modified:              06-02-2008 22:31 CDT
====================================================================== 
Summary:                    Pattern matching treats 'x' differently than 'X'
Description: 
Steve Edwards reported
[http://lists.digium.com/pipermail/asterisk-users/2008-June/212956.html]
that the pattern _2xxx is evaluated before _2[1-4]00.  I went to reply that
it shouldn't be that way, but in my testing, I found he was right.

I think this is a pretty serious bug in the pattern matching code.

As I understand it, Asterisk should be evaluating the patterns one digit
at a time, from left to right.  Whenever more than one pattern could
possibly match, the *most constrained* digit should match first.  In other
words, given these two patterns, if I dialed 1234, the first one should
match before the second, as it's a more constrained match in the third
digit (it matches two possible values, while the other matches three).

_12[3-4]X
_12[3-5]X

The problem arises in that Asterisk seems to be treating the wildcard 'X'
differently than 'x', and I can't figure out why.  Both of them should mean
"any digit 0 through 9", but apparently they don't.  See below for more
details:
====================================================================== 

---------------------------------------------------------------------- 
 jsmith - 06-02-08 22:31  
---------------------------------------------------------------------- 
More information... here's the output of trunk:

localhost*CLI> core show version
Asterisk SVN-trunk-r119839 built by jsmith @ localhost.localdomain on a
i686 running Linux on 2008-06-03 03:24:59 UTC
localhost*CLI> dialplan show 2300 at test-1
[ Context 'test-1' created by 'pbx_config' ]
  '_2[1-4]00' =>    1. NoOp(bar)                                 
[pbx_config]
  '_2XXX' =>        1. NoOp(foo)                                 
[pbx_config]

-= 2 extensions (2 priorities) in 1 context. =-
localhost*CLI> dialplan show 2300 at test-2
[ Context 'test-2' created by 'pbx_config' ]
  '_2xxx' =>        1. NoOp(foo)                                 
[pbx_config]
  '_2[1-4]00' =>    1. NoOp(bar)                                 
[pbx_config]

-= 2 extensions (2 priorities) in 1 context. =-

So even though the pattern-matching stuff has been changed/updated in
trunk, this is still an issue.  I think I have a patch for 1.4 ready to go,
but I'll hold off posting it until I figure out how to fix this in trunk as
well. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
06-02-08 22:31  jsmith         Note Added: 0087692                          
======================================================================




More information about the asterisk-bugs mailing list