[asterisk-users] How to write custom functions in AEL2 ,
Steve Murphy
murf at parsetree.com
Mon May 11 09:55:23 CDT 2009
On Mon, May 11, 2009 at 1:30 AM, Olivier <oza-4h07 at myamail.com> wrote:
> Hi,
>
> I'm using asterisk 1.6.1 and AEL2.
> I'm trying to find the best way to write my own custom functions ?
>
>
> At the moment, I'm using this pattern (extensions.ael) :
>
> context foo {
> 123 => {
> &myfunc(123456);
> NoOp(${GOSUB_RETVAL});
> };
>
> macro myfunc (arg) {
> Return (${arg});
> }
>
> 1. First, I keep getting warnings like
> Warning: file /etc/asterisk/extensions.ael, line 446-446: application call
> to Return affects flow of control, and needs to be re-written using AEL if,
> while, goto, etc. keywords instead!
> and I would like to get rid of them.
>
This is easily done. Return() is calling the Return application; 'return',
however, is the keyword the AEL uses. Note the lack of a capital R at the
beginning of
the word "return". AEL is case sensitive and "Return" is not equal to
"return".
Also note that, as a previous reply mentions, that return takes no args,
that there is a patch available to upgrade to do that.
You don't need the patch to do what the patch does, tho. But, not having
refreshed my memory on the particulars, I will say
no more!
>
> 2. Secondly, I would like not to use GOSUB_RETVAL and call a custom
> function just like I'm calling other functions with statements like :
> 123 => {
> NoOp(TOLOWER(fOo BaR));
> NoOp(myfunc(123456));
> };
>
>
Again, check your version of Asterisk against whether AEL uses Gosub() to
implement macros.
The AEL2 wiki page on voip-info.org (
http://voip-info.org/wiki/view/Asterisk+AEL2 ) can also
be quite helpful at times!
> What would you advise me to do ?
>
> Regards
>
>
>
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
--
Steve Murphy
ParseTree Corp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20090511/3756f054/attachment.htm
More information about the asterisk-users
mailing list