Hi All

What happens if I, inside of a while/endwhile loop, call recursively a
macro that itself has another while/endwhile loop and calls exitwhile() inside 
the
recursive call?

[macro-recursive]
instance=$ARG1
if instance>3
        macroexit
X=1
_var1=""
; recursive loop
while(Dcondition)
        _var1=value_${X}
        recursive(instance+1)
        if var1==""
                ExitWhile()
        X=X+1
        some_Dcondition_changing
        bla...
        bla...
EndWhile
macroexit

[some_running_context]
; Main loop
while(Zcondition) 
        recursive(1)
        if (var1=="")
            ExitWhile
        some_Zcondition_changing
        bla...
        bla...
endwhile
more_intructions
MacroExit

The problem I see is if I reentry "macro-recursive" a the second time,
Macroexit returns to "more_instructions" at "some_running_context" (just after
the Main Loop endWhile). It should return to 'if (var1=="")' at the previous
"macro-recursive" call.

It is like the second call to "macro-recursive" overwrites the first
"macro-recursive" while/endwhile loop return point, and the second ExitWhile
exits from the while/endwhile at "some_running_context" and not from first
"macro-recursive" instance.

In short: second (and subsequent??) call to macro-recursive is ExitWhile()ing
from "some_running_context" while loop. First call exits ok.

Any directions to share?

Is this explanation too complicated to understand?

Regards

Ethy

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
      https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to