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

Steve Murphy murf at parsetree.com
Wed Feb 2 08:53:38 CST 2011


On Wed, Feb 2, 2011 at 4:06 AM, Kirill Katsnelson <kkm at adaptiveai.com>wrote:

> AEL does not offer this feature of .conf scripts.
>
> Practical example. We are using many customer "applications". An
> application name is also a queue name, among a few other things. Also, there
> is an optional per-customer set-up macro, invoked like this:
>
>    if (${DIALPLAN_EXISTS("setup-${CUSTAPP}",s,1)}) {
>      GoSub(setup-${CUSTAPP},s,1);
>    }
>
> Now, GoSub() causes a warning when compiling AEL file. Something we could
> live up to now. But the use of `s' here is relying on undocumented behavior
> of AEL.
>
> So, between 1.8.1.1 and 1.8.3.rc2 it changed. Macros are no longer using
> the `s' extension as their entry point, rather `~~s~~'. That seems like a
> completely internal affair between AEL compiler and the dialplan, but
> thinking along these lines means there is no such an optional gosub feature
> in AEL at all.
>
> Or I can test for both `s' and `~~s~~' in the script, to maintain the hack
> compatible both with 1.8.1 and 1.8.3, but obviously I do not like that
> either.
>
> There should be a clean and documented way of doing exactly that. Going AEL
> should not mean self-limiting to fewer features of Asterisk.
>

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. My advise: don't mix AEL macro calls with gosubs.
Really, there should be little to no need. It'll only complicate things.
Need to use routines in extensions.conf? Take a few minutes and rewrite them
into AEL.

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).

 Best of luck!

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/00d7c60e/attachment-0001.htm>


More information about the asterisk-dev mailing list