[asterisk-dev] AEL, GoSub and DIALPLAN_EXISTS() do not like each other!

Kirill Katsnelson kkm at adaptiveai.com
Wed Feb 2 17:04:55 CST 2011


Steve,

Thank you very much for your answer, but I think it misses the point 
somewhat.

> In the beginning, we implemented macros with macros. But, there is a limit
> of about 7 levels, and then you crash. So I changed AEL to
> implement macros with gosubs instead. Now you can use recursion to your
> heart's content.

This I understand. In fact, I am using  DIALPLAN_EXISTS() and GoSub(), 
if you noted in the code sample I shown, which will not even work with 
the old-style Macro macros:

 >>    if (${DIALPLAN_EXISTS("setup-${CUSTAPP}",s,1)}) {
 >>      GoSub(setup-${CUSTAPP},s,1);
 >>    }

> My advise: don't mix AEL macro calls with gosubs.
> Really, there should be little to no need. It'll only complicate things.

Unfortunately, we have couple hundred of applications here, but only a 
handful requires custom set-up macros (I am using the word "macro" 
*strictly* in AEL sense).

Requiring that every application had a set up macro would certainly 
complicate things. We already run about 2 thousand lines of AEL code, 
and adding 200 empty macros to it would not make it less complicated, 
with added fun of maintaining it. This is something that I am using only 
as an override to the default flow.

Besides, AEL lacks capability to call a macro by name: the macro 
invocation `& IDENTIFIER' requires IDENTIFIER be visible as a macro name 
at compile time.

> Need to use routines in extensions.conf? Take a few minutes and rewrite them
> into AEL.

I never wrote extension.conf. We went AEL from the very start few years ago.

> If you need to do some real low-level tweaks in extensions.conf, then mimic
> the conventions of AEL there. (Look at the code AEL generates for macros as
> an example).

That was my whole point. AEL lacks the capability to check if a macro 
with a run time produced name exists, and, if it is, to call it.

  -kkm



More information about the asterisk-dev mailing list