[asterisk-dev] AEL macro backward compatibility for 1.6

Steve Murphy murf at digium.com
Mon Jan 19 10:48:53 CST 2009

On Mon, 2009-01-19 at 14:03 +0300, Dmitry Andrianov wrote:
> Hello.
> Playing with AEL in 1.6 I discovered incompatibility with configs 
> I used for 1.4. I filled issue for that 
> (http://bugs.digium.com/view.php?id=14267) but it was closed because 
> "bug tracker is not a discussion forum". So I'm mailing the same 
> stuff here as it was suggested.
> In 1.4 AEL used to generate macro- prefix for all macro contexts 
> and transform &m1() calls to Macro(m1). Now 1.6 Macro is deprecated 
> and AEL generates Gosub instead and does NOT generate macro- prefix. 
> The problem is that if you call AEL macros from regular dialplan - 
> it will not work because AEL-generated macros do NOT have macro- 
> prefix anymore while Macro application will add it. For the same 
> reason features like
>         myfeature => #,self,Macro,feature1
> will not work either if feature1 is defined in the AEL. Even if 
> you manually add "macro-" prefix to your AEL macro it will not work 
> because Asterisk will complaint there is return without Gosub.
> This may break things for lots of people.
> My suggestion to fix the issue is:
> 1. When Macro(xxx) is called, it checks it can find "macro-xxx".
> 2. If macro-xxx exists, it is called in "traditional macro way"
> 3. If macro-xxx does not exist, the application checks if just 
> "xxx" exist and if it does - application Gosubs there.
> Thoughts?
There are two different ways the ael compiler is called. One
is via the pbx_ael module, which is loaded on Asterisk start-up;
the other way is via aelparse, which is a standalone, and runs
independently of Asterisk.

The tough part of your suggestion is where we are running internal
to Asterisk; the order in which modules are loaded is not 
guaranteed. If AEL loads after extensions.conf has been loaded,
we might be able to traverse the dialplan and see if a macro
is defined; but if extensions.conf is not loaded, we cannot tell
how these macros might be defined.

I haven't tried it yet, but another approach is just to hardcode the
Macro() call. I'm sure AEL will complain about these, but they should
be warnings, and not errors. If they are errors, we can fix that.

So, instead of saying "&macname();', you say "Macro(macname);"
and that will probably work. Let me know if otherwise, as I've
not tried this.

> Regards,
> Dmitry Andrianov
> PS: if you guys deprecate Macro stuff, it would be good idea to 
> remove all macros from sample dialplans too. Currently - it is 
> full of macros.

That is not a bad idea!


Steve Murphy <murf at digium.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3227 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-dev/attachments/20090119/b383edea/attachment-0001.bin 

More information about the asterisk-dev mailing list