[Home]

Summary:ASTERISK-13168: AEL &macro("arg") with UTF-8 argument incorrectly compiles into dialplan
Reporter:wetwired (wetwired)Labels:
Date Opened:2008-12-05 02:34:45.000-0600Date Closed:2009-02-19 16:45:35.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:PBX/pbx_ael
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) extensions.ael
Description:AEL &macro expression used with UTF-8 argument (Russian in my case) incorrectly compiles into dialplan. It was  broken in Asterisk 1.4.22-rc4. In Asterisk 1.4.22-rc3  and earlier and also in 1.6.0.1 everything is OK.

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

My AEL dialplan:

   234 =>
   {
       &test("??????");
       &test(" ??????2");
       Macro(test|"??????3");
   }

macro test(arg)
{
       NoOp(${arg});
}

In Asterisk 1.4.22-rc3 CLI we have:
   -- Executing [234@outgoing:1] Macro("SIP/111-09c842b8", "test|"??????"") in new stack
   -- Executing [s@macro-test:1] Set("SIP/111-09c842b8", "arg="??????"") in new stack
   -- Executing [s@macro-test:2] NoOp("SIP/111-09c842b8", "??????") in new stack
   -- Executing [234@outgoing:2] Macro("SIP/111-09c842b8", "test|" ??????2"") in new stack
   -- Executing [s@macro-test:1] Set("SIP/111-09c842b8", "arg=" ??????2"") in new stack
   -- Executing [s@macro-test:2] NoOp("SIP/111-09c842b8", " ??????2") in new stack
   -- Executing [234@outgoing:3] Macro("SIP/111-09c842b8", "test|"??????3"") in new stack
   -- Executing [s@macro-test:1] Set("SIP/111-09c842b8", "arg="??????3"") in new stack
   -- Executing [s@macro-test:2] NoOp("SIP/111-09c842b8", "??????3") in new stack

But in Asterisk 1.4.22-rc4:

   -- Executing [234@outgoing:1] Macro("SIP/111-08c70678", "test|"") in new stack
   -- Executing [s@macro-test:1] Set("SIP/111-08c70678", "arg="") in new stack
   -- Executing [s@macro-test:2] NoOp("SIP/111-08c70678", "") in new stack
   -- Executing [234@outgoing:2] Macro("SIP/111-08c70678", "test|" ??????2"") in new stack
   -- Executing [s@macro-test:1] Set("SIP/111-08c70678", "arg=" ??????2"") in new stack
   -- Executing [s@macro-test:2] NoOp("SIP/111-08c70678", " ??????2") in new stack
   -- Executing [234@outgoing:3] Macro("SIP/111-08c70678", "test|"??????3"") in new stack
   -- Executing [s@macro-test:1] Set("SIP/111-08c70678", "arg="??????3"") in new stack
   -- Executing [s@macro-test:2] NoOp("SIP/111-08c70678", "??????3") in new stack
Comments:By: Leif Madsen (lmadsen) 2008-12-05 14:05:32.000-0600

Hey murf,

I've assigned this to you, and it seems this used to work, and also works in 1.6.x, so maybe this could be a reasonably simple fix? Let me know if you need any assistance. Thanks!

By: Steve Murphy (murf) 2008-12-10 00:52:02.000-0600

I just committed a fix today to a bug that would erase the args to the first function call in an exten (on 32-bit machines). checkout the 1.4 latest svn, and verify that this bug is still alive. If the latest SVN of 1.4 (http://svn.digium.com/svn/asterisk/branches/1.4) still has this problem, then
upload the extensions.ael file with all the russian in it to this bug. If not,
I guess I killed two birds with one stone, so to speak.


By: wetwired (wetwired) 2008-12-10 06:31:32.000-0600

I've checked out  Asterisk SVN-branch-1.4-r162463 and problem still remains + now I have such messages in CLI after ael reload:

[Dec 10 17:15:45] NOTICE[7405]: pbx_ael.c:4477 pbx_load_module: AEL load process: calculated config file name '/etc/asterisk/extensions.ael'.
[Dec 10 17:15:45] ERROR[7405]: ael.flex:644 ael_yylex: Unhandled char(s): "?
[Dec 10 17:15:45] ERROR[7405]: ael.flex:644 ael_yylex: Unhandled char(s): ?
[Dec 10 17:15:45] ERROR[7405]: ael.flex:644 ael_yylex: Unhandled char(s): ?
[Dec 10 17:15:45] ERROR[7405]: ael.flex:644 ael_yylex: Unhandled char(s): ?
[Dec 10 17:15:45] ERROR[7405]: ael.flex:644 ael_yylex: Unhandled char(s): ?
[Dec 10 17:15:45] ERROR[7405]: ael.flex:644 ael_yylex: Unhandled char(s): ?
[Dec 10 17:15:45] ERROR[7405]: ael.flex:644 ael_yylex: Unhandled char(s): ?
[Dec 10 17:15:45] ERROR[7405]: ael.flex:644 ael_yylex: Unhandled char(s): ?
[Dec 10 17:15:45] ERROR[7405]: ael.flex:644 ael_yylex: Unhandled char(s): ?
[Dec 10 17:15:45] ERROR[7405]: ael.flex:644 ael_yylex: Unhandled char(s): ?
[Dec 10 17:15:45] ERROR[7405]: ael.flex:644 ael_yylex: Unhandled char(s): ?
[Dec 10 17:15:45] ERROR[7405]: ael.flex:644 ael_yylex: Unhandled char(s): ?
[Dec 10 17:15:45] NOTICE[7405]: pbx_ael.c:4485 pbx_load_module: AEL load process: parsed config file name '/etc/asterisk/extensions.ael'.

This happens at string
&test("??????");

But if I add space in the beginning of argument, it works fine
&test(" ??????");

I uploaded my extensions.ael



By: Digium Subversion (svnbot) 2008-12-10 10:44:57.000-0600

Repository: asterisk
Revision: 162671

U   branches/1.4/pbx/ael/ael.flex
U   branches/1.4/pbx/ael/ael_lex.c

------------------------------------------------------------------------
r162671 | murf | 2008-12-10 10:44:56 -0600 (Wed, 10 Dec 2008) | 22 lines

(closes issue ASTERISK-13168)
Reported by: wetwired
Tested by: murf

I checked, and I added a mod to the trunk version
of Asterisk that would make it 8-bit transparent
on 27 Nov 2007, but I made no such updates to
1.4. My best guess is that 1.4 was released, and
it was not appropriate to commit an enhancement.

But I'm going to add the same fixes to 1.4 now,
for the following reasons:
1. wetwired is correct; 1.4 is **mostly** 8-bit
  transparent now. This is because the lexical
  token forming rules use . in most 'word'
  state continuances.  It's just the beginning
  of a 'word' that is picky.
2. Accepting 8-bit chars in some places and
  not others leads to bug reports like this.



------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=162671