[asterisk-dev] Gosub and Macro

Russell Bryant russell at digium.com
Tue May 27 09:44:02 CDT 2008


Atis Lezdins wrote:
> Well, it would be good if I could write AEL code into realtime, but
> unfortunately it's not possible, as realtime dialplan is generally
> changing data that's generated by custom frontend. Replacing Macro
> calls to GoSub would mean that I have to change frontend. In my case I
> actually can do that easily, but I raised this because of
> compatibility. Probably there are lot of users out there who will have
> exactly the same problem.

A lot of users?  We're both guessing here, but I suspect that there are very few 
people that would encounter this issue.

> What I would want here is a clean upgrade path from 1.4 to 1.6 without
> changing anything else. I want first to upgrade Asterisk and then
> slowly clean up from deprecated things. Of course I could change all
> the macros to GoSubs and try that out for 1.4 but AEL parser for 1.4
> won't support that automatically. So I could use parser from 1.6 and
> risk running into other compatibility problems.
 >
> I clearly understand differences between Macro and GoSub (and after
> this explanation even more of those details), but what I was proposing
> - is to write simple wrapper for app_macro to use GoSub just the same
> way as AEL parser does that. That is - to maintain compatibility just
> between generated code.

Unfortunately, as Tilghman described, it is not possible to write a "simple" 
wrapper.

By the way, this is noted as the first entry in UPGRADE.txt.  Hopefully people 
will read this, and become aware of the issue if affects them, before attempting 
a blind upgrade.

AEL:

* Macros are now implemented underneath with the Gosub() application.
   Heaven Help You if you wrote code depending on any aspect of this!
   Previous to 1.6, macros were implemented with the Macro() app, which
   provided a nice feature of auto-returning. The compiler will do its
   best to insert a Return() app call at the end of your macro if you did
   not include it, but really, you should make sure that all execution
   paths within your macros end in "return;".

-- 
Russell Bryant
Senior Software Engineer
Open Source Team Lead
Digium, Inc.



More information about the asterisk-dev mailing list