[asterisk-dev] Gosub and Macro

Vadim Lebedev vadim at mbdsys.com
Tue May 27 15:37:46 CDT 2008

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?


More information about the asterisk-dev mailing list