[Home]

Summary:ASTERISK-19137: patten matching wrong when issue "dialplan reload"
Reporter:Aaron An (aaron)Labels:
Date Opened:2011-12-29 05:38:16.000-0600Date Closed:
Priority:MajorRegression?
Status:Open/NewComponents:PBX/pbx_ael
Versions:1.8.8.0 13.18.4 Frequency of
Occurrence
Constant
Related
Issues:
is related toASTERISK-18343 extenpatternmatchnew fails to correctly respect dialplan order (regex match before exact in an included context)
Environment:CentOS 5.4 X86_64Attachments:
Description:I am using ael to write dialplan. when issue "dialplan reload" command the pattern matching does not work.
I have open the debug in pbx.c and see the below:
from the log we can see the order is change so it match the wrong exten.

log before dialplan reload: ================
[Dec 29 19:25:30] NOTICE[21748] pbx.c: The Trie we are searching in:
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  s:N:-:1:
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  +       w:N:-:1:
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  +       +       _:N:-:1:
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  +       +       +       1:N:-:1:
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  +       +       +       +       2:N:-:1:
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  +       +       +       +       +       7:N:-:1:
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  +       +       +       +       +       +       _:N:-:1:EXTEN:sw_127_(0x2aaad817c9e0)
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  +       +       +       +       +       +       +       1:N:-:1:EXTEN:sw_127_1(0x2aaad817c5e0)
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  s:Y:-:1:
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  +       w:Y:-:1:
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  +       +       _:Y:-:1:
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  +       +       +       1:Y:-:1:
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  +       +       +       +       2:Y:-:1:
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  +       +       +       +       +       7:Y:-:1:
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  +       +       +       +       +       +       _:Y:-:1:
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  +       +       +       +       +       +       +       .:Y:-:98304:EXTEN:_sw_127_.(0x2aaad817c130)
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  ~:N:-:1:
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  +       ~:N:-:1:
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  +       +       s:N:-:1:
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  +       +       +       ~:N:-:1:
[Dec 29 19:25:30] DEBUG[21748] pbx.c: ::  +       +       +       +       ~:N:-:1:EXTEN:~~s~~(0x2aaad817b790)

log after dialplan reload: ================
[Dec 29 19:27:12] NOTICE[22568] pbx.c: The Trie we are searching in:
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  ~:N:-:1:
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  +       ~:N:-:1:
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  +       +       s:N:-:1:
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  +       +       +       ~:N:-:1:
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  +       +       +       +       ~:N:-:1:EXTEN:~~s~~(0x14de4a30)
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  s:Y:-:1:
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  +       w:Y:-:1:
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  +       +       _:Y:-:1:
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  +       +       +       1:Y:-:1:
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  +       +       +       +       2:Y:-:1:
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  +       +       +       +       +       7:Y:-:1:
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  +       +       +       +       +       +       _:Y:-:1:
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  +       +       +       +       +       +       +       .:Y:-:98304:EXTEN:_sw_127_.(0x14d838d0)
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  s:N:-:1:
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  +       w:N:-:1:
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  +       +       _:N:-:1:
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  +       +       +       1:N:-:1:
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  +       +       +       +       2:N:-:1:
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  +       +       +       +       +       7:N:-:1:
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  +       +       +       +       +       +       _:N:-:1:EXTEN:sw_127_(0x14d83330)
[Dec 29 19:27:12] DEBUG[22568] pbx.c: ::  +       +       +       +       +       +       +       1:N:-:1:EXTEN:sw_127_1(0x14d83270)
Comments:By: Aaron An (aaron) 2011-12-29 05:49:04.117-0600

if I issue "ael reload" after "dialplan reload" it works.

By: Aaron An (aaron) 2011-12-30 01:08:20.045-0600

here is my test dialplan:
context default{
126 => {
&macro_test(1);
}
}
macro macro_test (param){
switch(${param}){
case 1:
NoOp(1);
break;
default:
NoOp(default);
break;
}
}

dialplan show macro result(the result is exactly the same after "dialplan reload" or after "ael reload"):

ccic*CLI> dialplan show macro_test
[ Context 'macro_test' created by 'pbx_ael' ]
 'sw_254_' =>      10. Goto(sw_254_.,10)                         [pbx_ael]
 'sw_254_1' =>     10. NoOp(1)                                   [pbx_ael]
                   11. Goto(~~s~~,5)                             [pbx_ael]
 '~~s~~' =>        1. MSet(LOCAL(param)=${ARG1})                 [pbx_ael]
                   2. MSet(LOCAL(~~EXTEN~~)=${EXTEN})            [pbx_ael]
                   3. MSet(LOCAL(~~EXTEN~~)=${~~EXTEN~~})        [pbx_ael]
                   4. Goto(sw_254_${param},10)                   [pbx_ael]
                   5. NoOp(Finish switch_macro_test_254)         [pbx_ael]
                   6. Return()                                   [pbx_ael]
 '_sw_254_.' =>    10. NoOp(default)                             [pbx_ael]
                   11. Goto(~~s~~,5)                             [pbx_ael]

-= 4 extensions (11 priorities) in 1 context. =-
ccic*CLI>


after ael reload(this is ok):
   -- Executing [126@internal:1] Gosub("SIP/8881-00000002", "macro_test,~~s~~,1(1)") in new stack
   -- Executing [~~s~~@macro_test:1] MSet("SIP/8881-00000002", "LOCAL(param)=1") in new stack
   -- Executing [~~s~~@macro_test:2] MSet("SIP/8881-00000002", "LOCAL(~~EXTEN~~)=~~s~~") in new stack
   -- Executing [~~s~~@macro_test:3] MSet("SIP/8881-00000002", "LOCAL(~~EXTEN~~)=~~s~~") in new stack
   -- Executing [~~s~~@macro_test:4] Goto("SIP/8881-00000002", "sw_254_1,10") in new stack
   -- Goto (macro_test,sw_254_1,10)
   -- Executing [sw_254_1@macro_test:10] NoOp("SIP/8881-00000002", "1") in new stack
   -- Executing [sw_254_1@macro_test:11] Goto("SIP/8881-00000002", "~~s~~,5") in new stack
   -- Goto (macro_test,~~s~~,5)
   -- Executing [~~s~~@macro_test:5] NoOp("SIP/8881-00000002", "Finish switch_macro_test_254") in new stack
   -- Executing [~~s~~@macro_test:6] Return("SIP/8881-00000002", "") in new stack
   -- Executing [h@internal:1] NoOp("SIP/8881-00000002", "hangup in internal") in new stack

after dialplan reload (this is wrong):
   -- Executing [126@internal:1] Gosub("SIP/8881-00000004", "macro_test,~~s~~,1(1)") in new stack
   -- Executing [~~s~~@macro_test:1] MSet("SIP/8881-00000004", "LOCAL(param)=1") in new stack
   -- Executing [~~s~~@macro_test:2] MSet("SIP/8881-00000004", "LOCAL(~~EXTEN~~)=~~s~~") in new stack
   -- Executing [~~s~~@macro_test:3] MSet("SIP/8881-00000004", "LOCAL(~~EXTEN~~)=~~s~~") in new stack
   -- Executing [~~s~~@macro_test:4] Goto("SIP/8881-00000004", "sw_254_1,10") in new stack
   -- Goto (macro_test,sw_254_1,10)
   -- Executing [sw_254_1@macro_test:10] NoOp("SIP/8881-00000004", "default") in new stack
   -- Executing [sw_254_1@macro_test:11] Goto("SIP/8881-00000004", "~~s~~,5") in new stack
   -- Goto (macro_test,~~s~~,5)
   -- Executing [~~s~~@macro_test:5] NoOp("SIP/8881-00000004", "Finish switch_macro_test_254") in new stack
   -- Executing [~~s~~@macro_test:6] Return("SIP/8881-00000004", "") in new stack
   -- Auto fallthrough, channel 'SIP/8881-00000004' status is 'UNKNOWN'
   -- Executing [h@internal:1] NoOp("SIP/8881-00000004", "hangup in internal") in new stack



By: Matt Jordan (mjordan) 2011-12-30 16:33:59.780-0600

I've acknowledged this issue. Thank you for taking the time to report this issue. Please note that pbx_ael has a support state of extended, and maintenance of the module will typically come from open source contributors.

More information about the various module support levels can be found at https://wiki.asterisk.org/wiki/display/AST/Asterisk+Module+Support+States

By: Richard Mudgett (rmudgett) 2012-01-03 14:33:03.038-0600

ASTERISK-18343 might have relevance here.