[asterisk-bugs] [JIRA] (ASTERISK-19205) Most Unique pattern matching broken when trailing "-" is part of extension

Birger "WIMPy" Harzenetter (JIRA) noreply at issues.asterisk.org
Mon Nov 5 22:02:21 CST 2012


    [ https://issues.asterisk.org/jira/browse/ASTERISK-19205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=199270#comment-199270 ] 

Birger "WIMPy" Harzenetter commented on ASTERISK-19205:
-------------------------------------------------------

I just hit a similar issue on the current TRUNK version.

Here are 6 test calls. The first half with a pattern of _foo-! and the second half with _foo.
Both trying to Goto foo-1, foo-2 and foo- in that order.


exten => start,1,Answer()
exten => start,n,Read(x,,1)
exten => start,n,Verbose(0,Goto(foo-${x},1))
exten => start,n,Goto(foo-${x},1)
exten => foo-1,1,Verbose(0,hit foo-1)
exten => _foo-!,1,Verbose(0,hit _foo-! / ${EXTEN})

[2012-11-06 04:43:36]     -- Executing [start at ssmmc:1] Answer("lcr/121", "") in new stack
[2012-11-06 04:43:36]     -- Executing [start at ssmmc:2] Read("lcr/121", "x,,1") in new stack
[2012-11-06 04:43:36]     -- Accepting a maximum of 1 digits.
[2012-11-06 04:43:41]     -- User entered '1'
[2012-11-06 04:43:41]     -- Executing [start at ssmmc:3] Verbose("lcr/121", "0,Goto(foo-1,1)") in new stack
[2012-11-06 04:43:41] Goto(foo-1,1)
[2012-11-06 04:43:41]     -- Executing [start at ssmmc:4] Goto("lcr/121", "foo-1,1") in new stack
[2012-11-06 04:43:41]     -- Goto (ssmmc,foo-1,1)
[2012-11-06 04:43:41]     -- Executing [foo-1 at ssmmc:1] Verbose("lcr/121", "0,hit foo-1") in new stack
[2012-11-06 04:43:41] hit foo-1

[2012-11-06 04:43:48]     -- Executing [start at ssmmc:1] Answer("lcr/122", "") in new stack
[2012-11-06 04:43:48]     -- Executing [start at ssmmc:2] Read("lcr/122", "x,,1") in new stack
[2012-11-06 04:43:48]     -- Accepting a maximum of 1 digits.
[2012-11-06 04:43:49]     -- User entered '2'
[2012-11-06 04:43:49]     -- Executing [start at ssmmc:3] Verbose("lcr/122", "0,Goto(foo-2,1)") in new stack
[2012-11-06 04:43:49] Goto(foo-2,1)
[2012-11-06 04:43:49]     -- Executing [start at ssmmc:4] Goto("lcr/122", "foo-2,1") in new stack
[2012-11-06 04:43:49]     -- Goto (ssmmc,foo-2,1)
[2012-11-06 04:43:49]     -- Executing [foo-2 at ssmmc:1] Verbose("lcr/122", "0,hit _foo-! / foo-2") in new stack
[2012-11-06 04:43:49] hit _foo-! / foo-2

[2012-11-06 04:43:54]     -- Executing [start at ssmmc:1] Answer("lcr/123", "") in new stack
[2012-11-06 04:43:54]     -- Executing [start at ssmmc:2] Read("lcr/123", "x,,1") in new stack
[2012-11-06 04:43:54]     -- Accepting a maximum of 1 digits.
[2012-11-06 04:43:55]     -- User entered nothing.
[2012-11-06 04:43:55]     -- Executing [start at ssmmc:3] Verbose("lcr/123", "0,Goto(foo-,1)") in new stack
[2012-11-06 04:43:55] Goto(foo-,1)
[2012-11-06 04:43:55]     -- Executing [start at ssmmc:4] Goto("lcr/123", "foo-,1") in new stack
[2012-11-06 04:43:55]     -- Goto (ssmmc,foo-,1)
[2012-11-06 04:43:55] WARNING[626][C-00000089]: pbx.c:6161 __ast_pbx_run: Channel 'lcr/123' sent to invalid extension but no invalid handler: context,exten,priority=ssmmc,foo-,1



exten => start,1,Answer()
exten => start,n,Read(x,,1)
exten => start,n,Verbose(0,Goto(foo-${x},1))
exten => start,n,Goto(foo-${x},1)
exten => foo-1,1,Verbose(0,hit foo-1)
exten => _foo.,1,Verbose(0,hit _foo. / ${EXTEN})

[2012-11-06 04:46:08]     -- Executing [start at ssmmc:1] Answer("lcr/124", "") in new stack
[2012-11-06 04:46:08]     -- Executing [start at ssmmc:2] Read("lcr/124", "x,,1") in new stack
[2012-11-06 04:46:08]     -- Accepting a maximum of 1 digits.
[2012-11-06 04:46:09]     -- User entered '1'
[2012-11-06 04:46:09]     -- Executing [start at ssmmc:3] Verbose("lcr/124", "0,Goto(foo-1,1)") in new stack
[2012-11-06 04:46:09] Goto(foo-1,1)
[2012-11-06 04:46:09]     -- Executing [start at ssmmc:4] Goto("lcr/124", "foo-1,1") in new stack
[2012-11-06 04:46:09]     -- Goto (ssmmc,foo-1,1)
[2012-11-06 04:46:09]     -- Executing [foo-1 at ssmmc:1] Verbose("lcr/124", "0,hit foo-1") in new stack
[2012-11-06 04:46:09] hit foo-1

[2012-11-06 04:46:11]     -- Executing [start at ssmmc:1] Answer("lcr/125", "") in new stack
[2012-11-06 04:46:11]     -- Executing [start at ssmmc:2] Read("lcr/125", "x,,1") in new stack
[2012-11-06 04:46:11]     -- Accepting a maximum of 1 digits.
[2012-11-06 04:46:13]     -- User entered '2'
[2012-11-06 04:46:13]     -- Executing [start at ssmmc:3] Verbose("lcr/125", "0,Goto(foo-2,1)") in new stack
[2012-11-06 04:46:13] Goto(foo-2,1)
[2012-11-06 04:46:13]     -- Executing [start at ssmmc:4] Goto("lcr/125", "foo-2,1") in new stack
[2012-11-06 04:46:13]     -- Goto (ssmmc,foo-2,1)
[2012-11-06 04:46:13]     -- Executing [foo-2 at ssmmc:1] Verbose("lcr/125", "0,hit _foo. / foo-2") in new stack
[2012-11-06 04:46:13] hit _foo. / foo-2

[2012-11-06 04:46:15]     -- Executing [start at ssmmc:1] Answer("lcr/126", "") in new stack
[2012-11-06 04:46:15]     -- Executing [start at ssmmc:2] Read("lcr/126", "x,,1") in new stack
[2012-11-06 04:46:15]     -- Accepting a maximum of 1 digits.
[2012-11-06 04:46:16]     -- User entered nothing.
[2012-11-06 04:46:16]     -- Executing [start at ssmmc:3] Verbose("lcr/126", "0,Goto(foo-,1)") in new stack
[2012-11-06 04:46:16] Goto(foo-,1)
[2012-11-06 04:46:16]     -- Executing [start at ssmmc:4] Goto("lcr/126", "foo-,1") in new stack
[2012-11-06 04:46:16]     -- Goto (ssmmc,foo-,1)
[2012-11-06 04:46:16] WARNING[1976][C-0000008c]: pbx.c:6161 __ast_pbx_run: Channel 'lcr/126' sent to invalid extension but no invalid handler: context,exten,priority=ssmmc,foo-,1



In the last example the trailing - is only in the Goto, not in the extension pattern so there seems to be something more to it.

                
> Most Unique pattern matching broken when trailing "-" is part of extension
> --------------------------------------------------------------------------
>
>                 Key: ASTERISK-19205
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-19205
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Core/PBX
>    Affects Versions: 1.8.7.2
>            Reporter: Philippe Lindheimer
>            Assignee: Matt Jordan
>            Severity: Minor
>
> The following FreePBX bug has some information. The crux is as follows. FreePBX uses some dialplan where extension patterns take on a format that might look like: "_RG-10111-." for a pattern. The crux of the issue is given two similar patterns, one always expect Asterisk to do the "most specific match". It appears starting with 1.6.2 something in Asterisk changed the behavior if that trailing "-" is left off. Tests were done on 1.4.32 where Asterisk seemed to work properly, and on 1.6.2.21 and 1.8.7.2 where it works improperly.
> The following is a simple dialplan context that can be used to demonstrate the error:
> [from-internal]
> exten => 1112,1,Goto(tst-parse,s,1)
> [tst-parse]
> exten => s,1,Noop(Running Parse Priority Text)
> exten => s,n,Dial(Local/RG-10111-99999 at tst-parse)
> exten => s,n,Dial(Local/RG-20111-99999 at tst-parse)
> exten => s,n,Hangup
> exten => h,1,Hangup
> exten => _RG-10111-.,1,Noop(IN 10111, this is CORRECT)
> exten => _RG-101-.,1,Noop(IN 101, this is WRONG)
> exten => _RG-20111.,1,Noop(IN 20111, this is CORRECT)
> exten => _RG-201.,1,Noop(IN 201, this is WRONG)
> In this example, you dial "1112" to trigger teh context. Note the difference in the two sets of target dialplan, in one case there is a trailing "-" and in the other case there is not. One wold expect both cases to execute the instruction that results in the "CORRECT" more specific match however leaving off the trailing "-" is required for this to happen and if not, the wrong dialplan is executed.
> The results from 1.4 show proper execution:
> -- Executing [1112 at from-internal:1] Goto("SIP/7001-000005bf", "tst-parse|s|1") in new stack 
>     -- Goto (tst-parse,s,1) 
>     -- Executing [s at tst-parse:1] NoOp("SIP/7001-000005bf", "Running Parse Priority Text") in new stack 
>     -- Executing [s at tst-parse:2] Dial("SIP/7001-000005bf", "Local/RG-10111-99999 at tst-parse") in new stack 
>     -- Called RG-10111-99999 at tst-parse 
>     -- Executing [RG-10111-99999 at tst-parse:1] NoOp("Local/RG-10111-99999 at tst-parse-8d8c,2", "IN 10111| this is CORRECT") in new stack 
>   == Auto fallthrough, channel 'Local/RG-10111-99999 at tst-parse-8d8c,2' status is 'UNKNOWN' 
>     -- Executing [h at tst-parse:1] Hangup("Local/RG-10111-99999 at tst-parse-8d8c,2", "") in new stack 
>   == Spawn extension (tst-parse, h, 1) exited non-zero on 'Local/RG-10111-99999 at tst-parse-8d8c,2' 
>   == Everyone is busy/congested at this time (1:0/0/1) 
>     -- Executing [s at tst-parse:3] Dial("SIP/7001-000005bf", "Local/RG-20111-99999 at tst-parse") in new stack 
>     -- Called RG-20111-99999 at tst-parse 
>     -- Executing [RG-20111-99999 at tst-parse:1] NoOp("Local/RG-20111-99999 at tst-parse-6a9b,2", "IN 20111| this is CORRECT") in new stack 
>   == Auto fallthrough, channel 'Local/RG-20111-99999 at tst-parse-6a9b,2' status is 'UNKNOWN' 
>     -- Executing [h at tst-parse:1] Hangup("Local/RG-20111-99999 at tst-parse-6a9b,2", "") in new stack 
>   == Spawn extension (tst-parse, h, 1) exited non-zero on 'Local/RG-20111-99999 at tst-parse-6a9b,2' 
>   == Everyone is busy/congested at this time (1:0/0/1) 
>     -- Executing [s at tst-parse:4] Hangup("SIP/7001-000005bf", "") in new stack 
>   == Spawn extension (tst-parse, s, 4) exited non-zero on 'SIP/7001-000005bf' 
>     -- Executing [h at tst-parse:1] Hangup("SIP/7001-000005bf", "") in new stack 
>   == Spawn extension (tst-parse, h, 1) exited non-zero on 'SIP/7001-000005bf'
> The results from 1.8 show improper execution, the same was seen on 1.6.2:
>     -- Executing [1112 at from-internal:1] Goto("SIP/700-000003ac", "tst-parse,s,1") in new stack
>     -- Goto (tst-parse,s,1)
>     -- Executing [s at tst-parse:1] NoOp("SIP/700-000003ac", "Running Parse Priority Text") in new stack
>     -- Executing [s at tst-parse:2] Dial("SIP/700-000003ac", "Local/RG-10111-99999 at tst-parse") in new stack
>     -- Called Local/RG-10111-99999 at tst-parse
>     -- Executing [RG-10111-99999 at tst-parse:1] NoOp("Local/RG-10111-99999 at tst-parse-6114;2", "IN 101, this is WRONG") in new stack
>     -- Auto fallthrough, channel 'Local/RG-10111-99999 at tst-parse-6114;2' status is 'UNKNOWN'
>     -- Executing [h at tst-parse:1] Hangup("Local/RG-10111-99999 at tst-parse-6114;2", "") in new stack
>   == Spawn extension (tst-parse, h, 1) exited non-zero on 'Local/RG-10111-99999 at tst-parse-6114;2'
>     -- No one is available to answer at this time (1:0/0/0)
>     -- Executing [s at tst-parse:3] Dial("SIP/700-000003ac", "Local/RG-20111-99999 at tst-parse") in new stack
>     -- Called Local/RG-20111-99999 at tst-parse
>     -- Executing [RG-20111-99999 at tst-parse:1] NoOp("Local/RG-20111-99999 at tst-parse-19bc;2", "IN 20111, this is CORRECT") in new stack
>     -- Auto fallthrough, channel 'Local/RG-20111-99999 at tst-parse-19bc;2' status is 'UNKNOWN'
>     -- Executing [h at tst-parse:1] Hangup("Local/RG-20111-99999 at tst-parse-19bc;2", "") in new stack
> In the case of FreePBX, this breaks functionality when in the event that someone were to have two phone extensions configured with 101 and 10111. The following ticket with FreePBX references this issue:
> http://www.freepbx.org/trac/ticket/5521

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list