[Home]

Summary:ASTERISK-05104: AEL parsing issues on app_cut
Reporter:Kristopher Lalletti (kris2k)Labels:
Date Opened:2005-09-18 11:29:47Date Closed:2006-07-06 11:12:32
Priority:MinorRegression?No
Status:Closed/CompleteComponents:PBX/pbx_ael
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:The ael parser seems to automatically assume that the second it notices an equal character, it has to perform a set variable.

In the case of app_cut, where, in the syntax, there is an = sign, it breaks-up the entire syntax.

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

AEL:

macro myDemo (myValue, myDelimiter) {
 Cut(myNewValue=myValue|myDelimiter|1);
};

Extension:
[ Context 'macro-myDemo' created by 'pbx_ael' ]
 's' =>            1. Set(myValue=${ARG1})                       [pbx_ael]
                   2. Set(myDelimiter=${ARG2})                   [pbx_ael]
                   3. Set(Cut(myNewValue=$[ myValue|myDelimiter|1) ]) [pbx_ael]

Which is wrong.

AEL:
macro myDemo (myValue, myDelimiter) {
 Cut(foo|bar|1);
};

Extension:
[ Context 'macro-myDemo' created by 'pbx_ael' ]
 's' =>            1. Set(myValue=${ARG1})                       [pbx_ael]
                   2. Set(myDelimiter=${ARG2})                   [pbx_ael]
                   3. Cut(foo|bar|1)                             [pbx_ael]

Which is right.

So, the parser is noticing the = character, and automatically assuming that it has to set a variable.
Comments:By: Clod Patry (junky) 2005-09-18 12:24:52

reporter has Revision 1.7 for pbx_ael.c

By: Russell Bryant (russell) 2005-09-18 18:19:53

You should be using the CUT dialplan function instead of the Cut application.  Can you change your dialplan to use the CUT function and verify that it works correctly for that?

By: Russell Bryant (russell) 2005-09-20 09:41:36

Any application that has that kind of syntax should be converted to a dialplan function.  However, I guess the parser needs to be made aware of the case where the '=' is inside parenthesis.  If that is the case, it is not a Set().

By: Kristopher Lalletti (kris2k) 2005-09-20 10:09:56

I haven't upgraded to the latest CVS yet and try the CUT() function (been meaning to, but time is a rare thing), however, the main point of this bug is exactly what you mentionned; the parser should respect the parenthesis, and not automatically assume a Set() at first sight of an equal character, thic could lead to larger problems at the long term.

By: Tilghman Lesher (tilghman) 2005-09-20 12:23:40

Revision 1.8 for pbx_ael.c seems to have a fix for this problem.  Have you tried latest CVS?

By: Kristopher Lalletti (kris2k) 2005-09-20 14:22:25

pbx_ael.c v 1.10 (from CVS HEAD 2005-09-08 01:02:55 UTC) has resolved this issue, and also has CUT() function.

I just tried the given scenario in the bug, and the dialplan is proper.