>>> Nobody has any information or opinions on any of this?Personally, I don't think MACROS are going anywhere any time soon, so I have not bothered looking into a substitution. As for ael; I've never used it. Doug
Eric Wieling
2019-Oct-15 16:25 UTC
[asterisk-users] clarification on gosub, macros and AEL
For all new dialplan, I recommend using Gosub. From https://www.voip-info.org/asterisk-ael2/ : This will complement the fact that Macros will be implemented with Gosub() calls instead of Macro() calls from now on, to avoid restricted memory issues. [I think this started in Asterisk 1.4) On 10/15/19 12:07 PM, Doug Lytle wrote:>>>> Nobody has any information or opinions on any of this? > > Personally, I don't think MACROS are going anywhere any time soon, so I have not bothered looking into a substitution. > > As for ael; I've never used it. > > Doug >-- http://help.nyigc.net/
I think the WARNING on Gosub() calls from AEL could change to NOTICE; or at least get more specific, such as "instead of calling Gosub() directly, please try an AEL macro." A new AEL keyword to eventually replace "macro", such as "subcontext", might help clarify things, too. But it should work fine even with the WARNING messages -- as long as you are careful* -- because in modern AEL, these two lines make for equivalent dial plan configuration: &some-macro(); Gosub(some-macro,~~s~~,1); I prefer the former because it is less to type. Although in some cases, such as the Dial() application option "b", the ampersand prefix format won't work, requiring the longer format with ~~s~~ if you want to enter the macro at the default entry point: Dial(PJSIP/1234,,b(some-macro^~~s~~^1)); * However, auto-conversion of macro parameters to local custom variables is (currently) only handled when entering the default entry point ~~s~~. So the following AEL example will parse with one WARNING but the Dial() might not be doing what you expect from just looking at the first line of the macro definition: macro mac-test( ext_ ) { catch BLEG { NoOp(Oops ext_ is blank: ${ext_}. Use ARG1 instead: ${ARG1}.); return; } NoOp(But ext_ is NOT blank at default entry point: ${ext_}.); return; } context ctx-start { _XXXX => { &mac-test(${EXTEN}); // default entry, $ext_ will be same as $EXTEN Gosub(mac-test,~~s~~,1(${EXTEN})); // ditto, with a WARNING Dial(PJSIP/${EXTEN},2,b(mac-test^BLEG^1(${EXTEN}))); // ext_ blank } } ...a corner case like that is why some level of concern should probably still be raised in the logs on direct Gosub() calls from AEL -- but not prohibited. Kind Regards, -- 🤠 C. Maj, Technology Captain @ Penguin PBX Solutions 📞 USA Toll Free 1-833-PNGNPBX (1-833-764-6729) 🤙 International & SMS Texting +1.720.32.42.72.9 🐧 https://www.PenguinPBX.com/
Julian Beach
2019-Oct-16 09:28 UTC
[asterisk-users] clarification on gosub, macros and AEL
Hello Doug, Tuesday, October 15, 2019, 5:07:45 PM, you wrote:> Personally, I don't think MACROS are going anywhere any time soon, > so I have not bothered looking into a substitution.Haven't they gone in Asterisk 16? I've just upgraded from Asterisk 13 and had to do some hasty re-writing of my dialplan to convert the Macros into Gosubs because the Macros did not work (I had noticed the deprecation notice previously, but forgot about it). I didn't have many, so I did them by hand, but it would be easy to script. Julian -- Best regards, Julian mailto:jb_soft at trink.co.uk
Joshua C. Colp
2019-Oct-16 09:39 UTC
[asterisk-users] clarification on gosub, macros and AEL
On Wed, Oct 16, 2019, at 6:28 AM, Julian Beach wrote:> Hello Doug, > > Tuesday, October 15, 2019, 5:07:45 PM, you wrote: > > > Personally, I don't think MACROS are going anywhere any time soon, > > so I have not bothered looking into a substitution. > > Haven't they gone in Asterisk 16? I've just upgraded from Asterisk 13 > and had to do some hasty re-writing of my dialplan to convert the > Macros into Gosubs because the Macros did not work (I had noticed the > deprecation notice previously, but forgot about it). I didn't have > many, so I did them by hand, but it would be easy to script.The module is still present, it just isn't built by default. It requires explicit enabling using menuselect. -- Joshua C. Colp Digium - A Sangoma Company | Senior Software Developer 445 Jan Davis Drive NW - Huntsville, AL 35806 - US Check us out at: www.digium.com & www.asterisk.org