[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
Fri Jan 22 12:15:14 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: ready for review
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-22 12:15 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/
======================================================================
----------------------------------------------------------------------
(0117079) crjw (reporter) - 2010-01-22 12:15
https://issues.asterisk.org/view.php?id=14629#c117079
----------------------------------------------------------------------
Sorry to disagree. But I think "both" issues should be addressed.
My earlier posts mentions problems with commas.
Hyphens create problems too!
#################################
// this macro adds hyphens to a 10 digit phone number
macro hyphens(number) {
Set(LOCAL(xx)=${number:0:3}-${number:3:3}-${number:6:4});
NoOp(${xx});
return ${xx};
}
305 =>{
&hyphens(8005551212);
NoOp(${GOSUB_RETVAL});
HangUp;
}
When 305 is dialed, the NoOp inside the macro shows the number with the
hypens properly embeded, but and the NoOp in the 305 extension shows the
result of
an unwanted mathematical calculation.
Executing [305 at home1:1] Gosub("SIP/x300-00000019",
"hyphens,s,1(8005551212)")
Executing [s at hyphens:1] MSet("SIP/x300-00000019",
"LOCAL(number)=8005551212")
Executing [s at hyphens:2] Set("SIP/x300-00000019",
"LOCAL(xx)=800-555-1212")
Executing [s at hyphens:3] NoOp("SIP/x300-00000019", "800-555-1212")
Executing [s at hyphens:4] Return("SIP/x300-00000019", "-967")
Executing [305 at home1:2] NoOp("SIP/x300-00000019", "-967")
If I use 'return "${xx}"' instead of 'return ${xx}' the extra quotes
become part of the string which is completely undesirable.
Executing [305 at home1:1] Gosub("SIP/x300-0000001a",
"hyphens,s,1(8005551212)")
Executing [s at hyphens:1] MSet("SIP/x300-0000001a",
"LOCAL(number)=8005551212")
Executing [s at hyphens:2] Set("SIP/x300-0000001a",
"LOCAL(xx)=800-555-1212")
Executing [s at hyphens:3] NoOp("SIP/x300-0000001a", "800-555-1212")
Executing [s at hyphens:4] Return("SIP/x300-0000001a", ""800-555-1212"")
Executing [305 at home1:2] NoOp("SIP/x300-0000001a", ""800-555-1212"")
If I use 'Return({$xx})' then the macro returns the proper string.
But I get a warning:
WARNING[27604]: ael/pval.c:2557 check_pval_item: Warning: file
/apps/asterisk/etc/extensions.ael, line 696-696: application call to Return
affects flow of control, and needs to be re-written using AEL if, while,
goto, etc. keywords instead!
Issue History
Date Modified Username Field Change
======================================================================
2010-01-22 12:15 crjw Note Added: 0117079
======================================================================
More information about the asterisk-bugs
mailing list