________________________________ 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