[asterisk-dev] Gosub and Macro

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Tue May 27 16:25:58 CDT 2008

On Tuesday 27 May 2008 15:37:46 Vadim Lebedev wrote:
> Le 27 mai 08 à 06:36, Tilghman Lesher a écrit :
> > One of the most fundamental differences between Macro and Gosub,
> > which is the
> > primary reason why Macro cannot be implemented with Gosub is the
> > behavior of a
> > completely different application, Goto.  If you call a Goto with a
> > context
> > other than the currently executing Macro, then the Macro exits
> > implicitly and
> > execution continues at the location the Goto specified.  However, as
> > there is
> > no Gosub code executing at the time a Goto is executed (all Gosub
> > really does
> > is to create a "gosub stack frame" which may be later referenced by
> > Return),
> > it is unable to destroy the stack frame.
> I don't know about other possible problems
> but it seems that this specific one can be easily fixed by adding
> MacroMode flag to the stack frame
> and modifying Goto application to unwind the stack if the flag is set
> and extracontext jump is executed
> Am i missing something?

It's not just Goto.  ANY application which does that would need to be
modified.  Or we'd have to change the core, which is something that
we really frown upon doing, especially for a set of applications which
run just fine as a separate module.


More information about the asterisk-dev mailing list