[asterisk-users] Replacement of Macro() with Gosub()

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Wed Apr 29 12:47:21 CDT 2009


On Wednesday 29 April 2009 11:45:13 Steve Davies wrote:
> 2009/4/29 Tilghman Lesher <tilghman at mail.jeffandtilghman.com>:
> > Let's also be clear about what Gosub is replacing.  Gosub replaces Macro
> > for AEL2.  The side effects of this are relatively unfelt, unless you're
> > doing something unusual like defining subroutines in AEL and calling them
> > from extensions.conf.  The big gain in this is the ability to have
> > infinite depths of subroutines, as opposed to a maximum of about 7 in
> > 1.4's AEL.
> >
> > Macro is not going away.  If you want to continue to use Macro, it's
> > there for you to use, warts and all.  Macro continues to have the depth
> > limit of 7 levels deep, and that won't change.  It's a fundamental limit
> > of the application, which is one of the reasons why its functionality has
> > been replaced in AEL with Gosub.  Also, I think Gosub is a bit easier to
> > learn, and its behavior is more straightforward.  There aren't corner
> > cases and special behaviors that you have to learn about Gosub; it just
> > works like a subroutine.
>
> Many thanks for the clarification - I do use both Macro() and Gosub()
> at present, and understand the difference ( I try to tell myself I do
> ;-) ). I do not use AEL dialplans.
>
> I had misunderstood the description on the changelog, and I had not
> noticed that it was an AEL change, rather than a generic dialplan
> change. There is clearly more of a difference between extensions.ael
> usage and extensions.conf usage than I realised. I can see now that
> AEL2 parses Macro (&) as a builtin, whereas extensions.conf will treat
> it as an application, and they have little in common.

Well, Macro is officially deprecated, but not in the "it's going away" sense
of deprecated, merely in the way that we encourage new users to use
Gosub, when they implement dialplan subroutines.

-- 
Tilghman



More information about the asterisk-users mailing list