Summary: | ASTERISK-17113: [patch] Contexts with a 'switch' statement in a 's' extension adds MSet to the beginning of the Context | ||
Reporter: | Kevin Scott Adams (nivek) | Labels: | |
Date Opened: | 2010-12-15 13:54:56.000-0600 | Date Closed: | 2011-03-03 14:17:11.000-0600 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | PBX/pbx_ael |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) 20101215__issue18480__2.diff.txt ( 1) AELwithnoswitch.txt ( 2) AELwithPattern.txt ( 3) AELwiths.txt | |
Description: | Creating a simple context with a switch statement in the 's' extension will always add two Mset commands to the beginning of the context. Changing the 's' to '_.' only gives one Mset. ****** STEPS TO REPRODUCE ****** context Inbound-Dialplan { s => { Answer(); if ("${CALLERID(NUM):1}" == "1") { NoOp(); } switch (${CALLERID(NUM):1:4}) { case 800 : case 877 : NoOp(); break; default : break; } Hangup(); } } Produces.... [ Context 'Inbound-Dialplan' created by 'pbx_ael' ] 's' => 1. MSet(LOCAL(~~EXTEN~~)=${EXTEN}) [pbx_ael] 2. MSet(LOCAL(~~EXTEN~~)=${~~EXTEN~~}) [pbx_ael] 3. NoOp() [pbx_ael] 4. Answer() [pbx_ael] 5. GotoIf($["${CALLERID(NUM):1}" == "1"]?6:7) [pbx_ael] 6. NoOp() [pbx_ael] 7. NoOp(Finish if_Inbound-Dialplan_312) [pbx_ael] 8. Goto(sw_313_"${CALLERID(NUM):1:4}",10) [pbx_ael] 9. NoOp(Finish switch_Inbound-Dialplan_313) [pbx_ael] 10. Hangup() [pbx_ael] 'sw_313_' => 10. Goto(sw_313_.,10) [pbx_ael] 'sw_313_"248"' => 10. Goto(sw_313_"800",10) [pbx_ael] 'sw_313_"800"' => 10. NoOp() [pbx_ael] 11. Goto(s,9) [pbx_ael] '_sw_313_.' => 10. Goto(s,9) [pbx_ael] context Inbound-Dialplan { _. => { Answer(); if ("${CALLERID(NUM):1}" == "1") { NoOp(); } switch (${CALLERID(NUM):1:4}) { case 800 : case 877 : NoOp(); break; default : break; } Hangup(); } } Produces.... 'sw_274_' => 10. Goto(sw_274_.,10) [pbx_ael] 'sw_274_"248"' => 10. Goto(sw_274_"800",10) [pbx_ael] 'sw_274_"800"' => 10. NoOp() [pbx_ael] 11. Goto(_.,8) [pbx_ael] '_sw_274_.' => 10. Goto(_.,8) [pbx_ael] '_.' => 1. MSet(~~EXTEN~~=${EXTEN}) [pbx_ael] 2. NoOp() [pbx_ael] 3. Answer() [pbx_ael] 4. GotoIf($["${CALLERID(NUM):1}" == "1"]?5:6) [pbx_ael] 5. NoOp() [pbx_ael] 6. NoOp(Finish if_Inbound-Dialplan_273) [pbx_ael] 7. Goto(sw_274_"${CALLERID(NUM):1:4}",10) [pbx_ael] 8. NoOp(Finish switch_Inbound-Dialplan_274) [pbx_ael] 9. Hangup() [pbx_ael] ****** ADDITIONAL INFORMATION ****** Not sure if it is correct behavior but is gives of "Warnings" that it is not in a Macro | ||
Comments: | By: Tilghman Lesher (tilghman) 2010-12-15 13:57:23.000-0600 For example? I don't see a specific problem reported here. By: Kevin Scott Adams (nivek) 2010-12-15 14:01:01.000-0600 Should be under the "View Advanced" By: Kevin Scott Adams (nivek) 2010-12-15 14:02:05.000-0600 I will upload file for you in case that is not working. By: Kevin Scott Adams (nivek) 2010-12-15 14:08:23.000-0600 Files uploaded. By: Tilghman Lesher (tilghman) 2010-12-15 14:18:20.000-0600 I meant, what warnings are you seeing with this dialplan? By: Kevin Scott Adams (nivek) 2010-12-15 14:38:52.000-0600 [Dec 15 15:42:11] ERROR[13057]: app_stack.c:522 local_write: Tried to set LOCAL(~~EXTEN~~), but we aren't within a Gosub routine By: Kevin Scott Adams (nivek) 2010-12-15 14:41:51.000-0600 This error only happens with the 's' extension. But a pattern or static extension still produces a "Mset" with a switch but no error message. By: Tilghman Lesher (tilghman) 2010-12-15 15:00:32.000-0600 I'm going to suggest as the fix to use a special extension name for actual "macro" (actually Gosub) definitions, thus avoiding the conflict. This will need to be tested to verify that it works as expected. By: Kevin Scott Adams (nivek) 2010-12-16 07:03:17.000-0600 No error messages but is this proper behavior for the ael compile... '0' => 1. Gosub(Pre-Dial-Extension,~~s~~,1(0000)) [pbx_ael] 2. Hangup() [pbx_ael] '0004F213C999' => hint: Custom:0004F213C999_LAMP [pbx_ael] '0004F2151716' => hint: Custom:0004F2151716_LAMP [pbx_ael] '1698' => 1. Goto(Transfer-to-Voicemail,s,1) [pbx_ael] '1699' => 1. Goto(User-Of-Voicemail,s,1) [pbx_ael] '6030' => 1. Goto(s,1) [pbx_ael] 's' => 1. MSet(~~EXTEN~~=${EXTEN}) [pbx_ael] 2. Set(ExtensionNumber=${CPWR_DID2EXTENSION(${~~EXTEN~~})}) [pbx_ael] 3. Gosub(Pre-Dial-Extension,~~s~~,1(${ExtensionNumber})) [pbx_ael] I thought that Mset was only for Macro's. Other 'Patterns' give no MSET's. Not saying it is wrong just wondering? By: Kevin Scott Adams (nivek) 2010-12-16 07:10:14.000-0600 No error messages or problems. But just an observation. Is this proper behavior for the ael compile... '0' => 1. Gosub(Pre-Dial-Extension,~~s~~,1(0000)) [pbx_ael] 2. Hangup() [pbx_ael] '0004F213C999' => hint: Custom:0004F213C999_LAMP [pbx_ael] '0004F2151716' => hint: Custom:0004F2151716_LAMP [pbx_ael] '1698' => 1. Goto(Transfer-to-Voicemail,s,1) [pbx_ael] '1699' => 1. Goto(User-Of-Voicemail,s,1) [pbx_ael] '6030' => 1. Goto(s,1) [pbx_ael] 's' => 1. MSet(~~EXTEN~~=${EXTEN}) [pbx_ael] 2. Set(ExtensionNumber=${CPWR_DID2EXTENSION(${~~EXTEN~~})}) [pbx_ael] 3. Gosub(Pre-Dial-Extension,~~s~~,1(${ExtensionNumber})) [pbx_ael] 4. Goto(sw_160_${~~EXTEN~~},10) [pbx_ael] 5. NoOp(Finish switch_Office-Dialplan_160) [pbx_ael] 6. Hangup() [pbx_ael] I thought that Mset was only for Macro's. And it only shows up with a SWITCH statement in the extension block. I am assuming it is because 'SWITCH' is ugly and needs to be browbeat to behave in an 'extension' block weather it be 's', PATTERN or a static. By: Tilghman Lesher (tilghman) 2010-12-17 15:35:22.000-0600 Yes, that's the proper behavior. MSet is short for multiple-set, which is a behavior that we wished to deprecate, that of setting multiple values at once. It had a side effect, though, that Steve Murphy liked for AEL: if people used quotes to encapsulate a single value, MSet would remove those quotes automatically, as expected. It is therefore used in AEL but nowhere else. By: Kevin Scott Adams (nivek) 2010-12-18 07:36:16.000-0600 Ok. Thanks for clarifying that. It all makes sense now. I was lead to believe it was an APP made strictly for macros. By: Tilghman Lesher (tilghman) 2010-12-18 12:19:15.000-0600 The main thing I'm interested in is getting rid of the warnings, as they will clearly lead to incorrect behavior. If that is done, then this is ready for commit. BTW, the issue with the warnings is not due to the use of MSet; it's due to the use of the LOCAL() construct, which is only valid when used within a Gosub routine. By: Kevin Scott Adams (nivek) 2010-12-22 06:14:03.000-0600 The warning messages, as far as I can see, do not exists anymore. By: Digium Subversion (svnbot) 2010-12-22 14:03:31.000-0600 Repository: asterisk Revision: 299448 U branches/1.6.2/pbx/ael/ael-test/ref.ael-test19 U branches/1.6.2/pbx/ael/ael-test/ref.ael-test3 U branches/1.6.2/pbx/ael/ael-test/ref.ael-vtest13 U branches/1.6.2/pbx/ael/ael-test/ref.ael-vtest17 U branches/1.6.2/pbx/ael/ael-test/ref.ael-vtest25 U branches/1.6.2/res/ael/pval.c ------------------------------------------------------------------------ r299448 | tilghman | 2010-12-22 14:03:31 -0600 (Wed, 22 Dec 2010) | 8 lines Resolve warnings by disambiguating the "s" extension as used by chan_dahdi from the "s" extension as used by the AEL macros. (closes issue ASTERISK-17113) Reported by: nivek Patches: 20101215__issue18480__2.diff.txt uploaded by tilghman (license 14) Tested by: nivek ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=299448 By: Digium Subversion (svnbot) 2010-12-22 14:05:03.000-0600 Repository: asterisk Revision: 299449 _U branches/1.8/ U branches/1.8/pbx/ael/ael-test/ref.ael-test19 U branches/1.8/pbx/ael/ael-test/ref.ael-test3 U branches/1.8/pbx/ael/ael-test/ref.ael-vtest13 U branches/1.8/pbx/ael/ael-test/ref.ael-vtest17 U branches/1.8/pbx/ael/ael-test/ref.ael-vtest25 U branches/1.8/res/ael/pval.c ------------------------------------------------------------------------ r299449 | tilghman | 2010-12-22 14:05:03 -0600 (Wed, 22 Dec 2010) | 15 lines Merged revisions 299448 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ........ r299448 | tilghman | 2010-12-22 14:03:30 -0600 (Wed, 22 Dec 2010) | 8 lines Resolve warnings by disambiguating the "s" extension as used by chan_dahdi from the "s" extension as used by the AEL macros. (closes issue ASTERISK-17113) Reported by: nivek Patches: 20101215__issue18480__2.diff.txt uploaded by tilghman (license 14) Tested by: nivek ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=299449 By: Digium Subversion (svnbot) 2010-12-22 14:10:35.000-0600 Repository: asterisk Revision: 299450 _U trunk/ U trunk/pbx/ael/ael-test/ref.ael-test19 U trunk/pbx/ael/ael-test/ref.ael-test3 U trunk/pbx/ael/ael-test/ref.ael-vtest13 U trunk/pbx/ael/ael-test/ref.ael-vtest17 U trunk/pbx/ael/ael-test/ref.ael-vtest25 U trunk/res/ael/pval.c ------------------------------------------------------------------------ r299450 | tilghman | 2010-12-22 14:10:35 -0600 (Wed, 22 Dec 2010) | 22 lines Merged revisions 299449 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r299449 | tilghman | 2010-12-22 14:05:02 -0600 (Wed, 22 Dec 2010) | 15 lines Merged revisions 299448 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ........ r299448 | tilghman | 2010-12-22 14:03:30 -0600 (Wed, 22 Dec 2010) | 8 lines Resolve warnings by disambiguating the "s" extension as used by chan_dahdi from the "s" extension as used by the AEL macros. (closes issue ASTERISK-17113) Reported by: nivek Patches: 20101215__issue18480__2.diff.txt uploaded by tilghman (license 14) Tested by: nivek ........ ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=299450 By: Digium Subversion (svnbot) 2011-02-14 00:50:25.000-0600 Repository: asterisk Revision: 307750 U branches/1.8/apps/app_dial.c U branches/1.8/apps/app_queue.c ------------------------------------------------------------------------ r307750 | tilghman | 2011-02-14 00:50:24 -0600 (Mon, 14 Feb 2011) | 23 lines Calling a gosub routine defined in AEL from Dial/Queue ceased to work. A bug in AEL did not distinguish between the "s" extension generated by AEL and an "s" extension that was required to exist by the chan_dahdi (or another channel) that was not supplied with a starting extension. Therefore, AEL made incorrect assumptions about what commands were permissable in the context. This was fixed by making AEL generate a different extension name. However, Dial and Queue make additional assumptions about the name of the default gosub extension. Therefore, they needed to be brought into line with a "macro" rendered by AEL (as a gosub), without breaking traditional dialplans written without the aid of AEL. Related to (issue ASTERISK-17113) Reported by: nivek (closes issue ASTERISK-17334) Reported by: kkm Patches: 20110209__issue18729.diff.txt uploaded by tilghman (license 14) 018729-dial-queue-gosub-try3.patch uploaded by kkm (license 888) Tested by: kkm ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=307750 By: Digium Subversion (svnbot) 2011-02-14 00:54:09.000-0600 Repository: asterisk Revision: 307751 _U trunk/ U trunk/apps/app_dial.c U trunk/apps/app_queue.c ------------------------------------------------------------------------ r307751 | tilghman | 2011-02-14 00:54:08 -0600 (Mon, 14 Feb 2011) | 30 lines Merged revisions 307750 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r307750 | tilghman | 2011-02-14 00:50:23 -0600 (Mon, 14 Feb 2011) | 23 lines Calling a gosub routine defined in AEL from Dial/Queue ceased to work. A bug in AEL did not distinguish between the "s" extension generated by AEL and an "s" extension that was required to exist by the chan_dahdi (or another channel) that was not supplied with a starting extension. Therefore, AEL made incorrect assumptions about what commands were permissable in the context. This was fixed by making AEL generate a different extension name. However, Dial and Queue make additional assumptions about the name of the default gosub extension. Therefore, they needed to be brought into line with a "macro" rendered by AEL (as a gosub), without breaking traditional dialplans written without the aid of AEL. Related to (issue ASTERISK-17113) Reported by: nivek (closes issue ASTERISK-17334) Reported by: kkm Patches: 20110209__issue18729.diff.txt uploaded by tilghman (license 14) 018729-dial-queue-gosub-try3.patch uploaded by kkm (license 888) Tested by: kkm ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=307751 |