[asterisk-bugs] [Asterisk 0014629]: [patch] Add support in AEL for macro return values and direct assignment of them to variables and functions.

Asterisk Bug Tracker noreply at bugs.digium.com
Wed Jan 27 21:55:26 CST 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=14629 
====================================================================== 
Reported By:                Marquis
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   14629
Category:                   PBX/pbx_ael
Reproducibility:            N/A
Severity:                   feature
Priority:                   normal
Status:                     acknowledged
Asterisk Version:           SVN 
JIRA:                       SWP-282 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2009-03-09 06:03 CDT
Last Modified:              2010-01-27 21:55 CST
====================================================================== 
Summary:                    [patch] Add support in AEL for macro return values
and direct assignment of them to variables and functions.
Description: 
This patch adds macro return value and simple assignment support to AEL.

This is the bug report for review request 114 as per Russell Bryant.
http://reviewboard.digium.com/r/114/
====================================================================== 

---------------------------------------------------------------------- 
 (0117283) crjw (reporter) - 2010-01-27 21:55
 https://issues.asterisk.org/view.php?id=14629#c117283 
---------------------------------------------------------------------- 
Thanks Marquis, it looks better after selecting "REBUILD_PARSERS"!
A couple of issues though:

I have a string in the "globals" section that fails to parse; it caused no
trouble before.
I did not yet determine if this is a result of the patch or the result of
another bug that surfaced after rebuilding the parsers.
The code that causes problems is this:
globals {
    TEST_EXTENSIONS=SIP/x300b&SIP/x400&SIP/x450;
};
The parser no longer like the ampersands.
Normally I would use 'Set()' to set a variable when the string contains
non-alphanumeric characters.  But 'Set()' is an "application", and
applications can't be used in the globals section of extensions.ael;  too
bad.

I am now able to do "direct assignment" to a variable.
But I still have a runtime problem if the returned value contains commas.
I tested with minus signs and plus signs; these are fine.
The problem with the commas lies in the fact the the code is using
'MSet()'.
MSet allows for multiple variable assignments and expects each assignment
will be separated by a comma.
   MSet syntax: MSet(name1=value1[,name2=value2[,...]])
If direct assignment were to use 'Set()' instead of 'MSet()', this problem
would go away.
Here is my test code:
macro returnmacro(xx) {
        Set(xx=1,2);
        Return(${xx});
}
...
610 =>{
        FOO=&returnmacro(zz)
        NoOp(GOSUB_RETVAL: ${GOSUB_RETVAL});
        NoOp(FOO:          ${FOO});
        Hangup;
}
And here is the console output:
############################################
 Executing [610 at home1:1] Gosub("SIP/x300b-00000008",
"returnmacro,s,1(zz)")
 Executing [s at returnmacro:1] MSet("SIP/x300b-00000008", "LOCAL(xx)=zz")
 Executing [s at returnmacro:2] Set("SIP/x300b-00000008", "xx=1,2")
 Executing [s at returnmacro:3] Return("SIP/x300b-00000008", "1,2")
 Executing [610 at home1:2] MSet("SIP/x300b-00000008", "FOO=1,2")
[Jan 28 03:24:50] WARNING[28572]: pbx.c:9520 pbx_builtin_setvar_multiple:
MSet: ignoring entry '2' with no '=' (in 610 at home1:2
 Executing [610 at home1:3] NoOp("SIP/x300b-00000009", "GOSUB_RETVAL: 1,2")
 Executing [610 at home1:4] NoOp("SIP/x300b-00000009", "FOO:          1")
 Executing [610 at home1:5] Hangup("SIP/x300b-00000008", "")
############################################

Would there be any ramifications of making the direct assignment code use
'Set()' instead of 'Mset()'? 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-01-27 21:55 crjw           Note Added: 0117283                          
======================================================================




More information about the asterisk-bugs mailing list