Re: [asterisk-users] How to write custom functions in AEL2 ,

2009-05-11 Thread Olivier
2009/5/11 Olivier 

>
> 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));
>
> Here, I meant
NoOp(read this ${TOLOWER(fOo BaR)});
___
-- 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

Re: [asterisk-users] How to write custom functions in AEL2 ,

2009-05-11 Thread Watkins, Bradley


From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Olivier
Sent: Monday, May 11, 2009 3:30 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: [asterisk-users] How to write custom functions in AEL2
,


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.

Unfortunately, AEL does not support using return with a value at the
moment.  There is a patch on Reviewboard that does this, as well as
*simple* direct assignment from an AEL macro return:
http://reviewboard.digium.com/r/114/



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));
};

What would you advise me to do ?

That requires rather a lot more work than the above patch, but if you
use the direct assignment at least you needn't worry about GOSUB_RETVAL.


Regards,
- Brad

___
-- 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


Re: [asterisk-users] How to write custom functions in AEL2 ,

2009-05-11 Thread Olivier
2009/5/11 Watkins, Bradley 

> 
>
>From: asterisk-users-boun...@lists.digium.com
> [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Olivier
>Sent: Monday, May 11, 2009 3:30 AM
>To: Asterisk Users Mailing List - Non-Commercial Discussion
>Subject: [asterisk-users] How to write custom functions in AEL2
> ,
>
>
>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.
>
> Unfortunately, AEL does not support using return with a value at the
> moment.  There is a patch on Reviewboard that does this, as well as
> *simple* direct assignment from an AEL macro return:
> http://reviewboard.digium.com/r/114/


Fine : that's exactly what I was looking for !
Unfortunately,  at the moment, this feature is still worked on.

> 
>
>
>
>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));
>};
>
>What would you advise me to do ?
>
> That requires rather a lot more work than the above patch, but if you
> use the direct assignment at least you needn't worry about GOSUB_RETVAL.
>
>
> Regards,
> - Brad
>
> ___
> -- 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
>
___
-- 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

Re: [asterisk-users] How to write custom functions in AEL2 ,

2009-05-11 Thread Steve Murphy
On Mon, May 11, 2009 at 1:30 AM, Olivier  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
___
-- 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