[asterisk-dev] AEL, GoSub and DIALPLAN_EXISTS() do not like each other!
Steve Murphy
murf at parsetree.com
Wed Feb 2 23:31:40 CST 2011
On Wed, Feb 2, 2011 at 4:04 PM, Kirill Katsnelson <kkm at adaptiveai.com>wrote:
> 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.
Sounds like a bug to me! Tell you what, you report this as a bug, and I'll
attach a patch to the bug
that fixes the problem. Is it a deal?
murf
>
>
> --
Steve Murphy
ParseTree Corporation
57 Lane 17
Cody, WY 82414
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20110202/57fa2b04/attachment-0001.htm>
More information about the asterisk-dev
mailing list