<br><br><div class="gmail_quote">2009/5/11 Watkins, Bradley <span dir="ltr"><<a href="mailto:Bradley.Watkins@compuware.com">Bradley.Watkins@compuware.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
________________________________<br>
<br>
From: <a href="mailto:asterisk-users-bounces@lists.digium.com">asterisk-users-bounces@lists.digium.com</a><br>
[mailto:<a href="mailto:asterisk-users-bounces@lists.digium.com">asterisk-users-bounces@lists.digium.com</a>] On Behalf Of Olivier<br>
Sent: Monday, May 11, 2009 3:30 AM<br>
To: Asterisk Users Mailing List - Non-Commercial Discussion<br>
Subject: [asterisk-users] How to write custom functions in AEL2<br>
,<br>
<div class="im"><br>
<br>
Hi,<br>
<br>
I'm using asterisk 1.6.1 and AEL2.<br>
I'm trying to find the best way to write my own custom functions<br>
?<br>
<br>
<br>
At the moment, I'm using this pattern (extensions.ael) :<br>
<br>
context foo {<br>
123 => {<br>
&myfunc(123456);<br>
NoOp(${GOSUB_RETVAL});<br>
};<br>
<br>
macro myfunc (arg) {<br>
Return (${arg});<br>
}<br>
<br>
1. First, I keep getting warnings like<br>
Warning: file /etc/asterisk/extensions.ael, line 446-446:<br>
application call to Return affects flow of control, and needs to be<br>
re-written using AEL if, while, goto, etc. keywords instead!<br>
and I would like to get rid of them.<br>
<br>
</div>Unfortunately, AEL does not support using return with a value at the<br>
moment. There is a patch on Reviewboard that does this, as well as<br>
*simple* direct assignment from an AEL macro return:<br>
<a href="http://reviewboard.digium.com/r/114/" target="_blank">http://reviewboard.digium.com/r/114/</a></blockquote><div><br>Fine : that's exactly what I was looking for !<br>Unfortunately, at the moment, this feature is still worked on.<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><a href="http://reviewboard.digium.com/r/114/" target="_blank"></a><br>
<div class="im"><br>
<br>
<br>
2. Secondly, I would like not to use GOSUB_RETVAL and call a<br>
custom function just like I'm calling other functions with statements<br>
like :<br>
123 => {<br>
NoOp(TOLOWER(fOo BaR));<br>
NoOp(myfunc(123456));<br>
};<br>
<br>
What would you advise me to do ?<br>
<br>
</div>That requires rather a lot more work than the above patch, but if you<br>
use the direct assignment at least you needn't worry about GOSUB_RETVAL.<br>
<br>
<br>
Regards,<br>
- Brad<br>
<br>
_______________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
</blockquote></div><br>