Tested the patch with asterisk 1.8.10 with this dialplan: ---------------------------------------------------------------------------------- context macrotest { s => { Answer(); ¯o_level1(); } h => { Noop(Catch h in context that invokes the macro); } } /* this test is successful */ macro macro_level1() { Noop(Running macro level 1); Noop(Hangup in macro_level1 should run h in context that invokes the macro); Wait(10); ¯o_level2(); } /* this test FAILS (se below) */ macro macro_level2() { Noop(Running macro level 2); Noop(Hangup in macro_level2 should run h in context that invokes the macro); Wait(10); ¯o_level3(); } /* this test is successful */ macro macro_level3() { Noop(Running macro level 3); Noop(Hangup in macro_level3 should run catch h in macro_level3); Wait(10); ¯o_level4(); catch h { Noop(catch h in macro level 3); } } /* this test is successful */ macro macro_level4() { Noop(Running macro level 4); Noop(Hangup in macro_level4 should run catch h in macro_level3); Wait(10); ¯o_level5(); } /* this test is successful */ macro macro_level5() { Noop(Running macro level 5); Noop(Hangup in macro_level5 should run catch h in macro_level5); Wait(20); catch h { Noop(catch h in macro level 5); } } ---------------------------------------------------------------------------------- I then modified the test and added a level2b like this: ---------------------------------------------------------------------------------- /* this test is successful */ macro macro_level1() { Noop(Running macro level 1); Noop(Hangup in macro_level1 should run h in context that invokes the macro); Wait(10); ¯o_level2(); } /* this test FAILS (se below) */ macro macro_level2() { Noop(Running macro level 2); Noop(Hangup in macro_level2 should run h in context that invokes the macro); Wait(10); ¯o_level2b(); } /* this test FAILS (se below) */ macro macro_level2b() { Noop(Running macro level 2b); Noop(Hangup in macro_level2b should run h in context that invokes the macro); Wait(10); ¯o_level3(); } And level2b results in the same error as level2. --------------------------------------------------------------------------------------------------------------------------------------------------------- MACRO_LEVEL 1: -- Executing [s@macrotest:1] Answer("SIP/trunk-00000000", "") in new stack -- Executing [s@macrotest:2] Gosub("SIP/trunk-00000000", "macro_level1,~~s~~,1") in new stack -- Executing [~~s~~@macro_level1:1] NoOp("SIP/trunk-00000000", "Running macro level 1") in new stack -- Executing [~~s~~@macro_level1:2] NoOp("SIP/trunk-00000000", "Hangup in macro_level1 should run h in context that invokes the macro") in new stack -- Executing [~~s~~@macro_level1:3] Wait("SIP/trunk-00000000", "10") in new stack == Spawn extension (macro_level1, ~~s~~, 3) exited non-zero on 'SIP/trunk-00000000' -- Executing [h@macro_level1:1] GotoIf("SIP/trunk-00000000", "1?macrotest,h,1") in new stack -- Goto (macrotest,h,1) -- Executing [h@macrotest:1] NoOp("SIP/trunk-00000000", "Catch h in context that invokes the macro") in new stack TEST1 : OK! --------------------------------------------------------------------------------------------------------------------------------------------------------- MACRO_LEVEL 2: -- Executing [s@macrotest:1] Answer("SIP/trunk-00000000", "") in new stack -- Executing [s@macrotest:2] Gosub("SIP/trunk-00000000", "macro_level1,~~s~~,1") in new stack -- Executing [~~s~~@macro_level1:1] NoOp("SIP/trunk-00000000", "Running macro level 1") in new stack -- Executing [~~s~~@macro_level1:2] NoOp("SIP/trunk-00000000", "Hangup in macro_level1 should run h in context that invokes the macro") in new stack -- Executing [~~s~~@macro_level1:3] Wait("SIP/trunk-00000000", "10") in new stack -- Executing [~~s~~@macro_level1:4] Gosub("SIP/trunk-00000000", "macro_level2,~~s~~,1") in new stack -- Executing [~~s~~@macro_level2:1] NoOp("SIP/trunk-00000000", "Running macro level 2") in new stack -- Executing [~~s~~@macro_level2:2] NoOp("SIP/trunk-00000000", "Hangup in macro_level2 should run h in context that invokes the macro") in new stack -- Executing [~~s~~@macro_level2:3] Wait("SIP/trunk-00000000", "10") in new stack == Spawn extension (macro_level2, ~~s~~, 3) exited non-zero on 'SIP/trunk-00000000' -- Executing [h@macro_level2:1] GotoIf("SIP/trunk-00000000", "1?macro_level1,h,1") in new stack -- Goto (macro_level1,h,1) -- Executing [h@macro_level1:1] GotoIf("SIP/trunk-00000000", "1?macro_level1,h,1") in new stack -- Goto (macro_level1,h,1) -- Executing [h@macro_level1:1] GotoIf("SIP/trunk-00000000", "1?macro_level1,h,1") in new stack -- Goto (macro_level1,h,1) -- Executing [h@macro_level1:1] GotoIf("SIP/trunk-00000000", "1?macro_level1,h,1") in new stack -- Goto (macro_level1,h,1) -- Executing [h@macro_level1:1] GotoIf("SIP/trunk-00000000", "1?macro_level1,h,1") in new stack -- Goto (macro_level1,h,1) -- Executing [h@macro_level1:1] GotoIf("SIP/trunk-00000000", "1?macro_level1,h,1") in new stack -- Goto (macro_level1,h,1) -- Executing [h@macro_level1:1] GotoIf("SIP/trunk-00000000", "1?macro_level1,h,1") in new stack -- Goto (macro_level1,h,1) -- Executing [h@macro_level1:1] GotoIf("SIP/trunk-00000000", "1?macro_level1,h,1") in new stack -- Goto (macro_level1,h,1) -- Executing [h@macro_level1:1] GotoIf("SIP/trunk-00000000", "1?macro_level1,h,1") in new stack -- Goto (macro_level1,h,1) -- Executing [h@macro_level1:1] GotoIf("SIP/trunk-00000000", "1?macro_level1,h,1") in new stack -- Goto (macro_level1,h,1) -- Executing [h@macro_level1:1] GotoIf("SIP/trunk-00000000", "1?macro_level1,h,1") in new stack -- Goto (macro_level1,h,1) . . . (and then it hangs, spitting out these messages, and has to be killed) TEST2 : FAIL! --------------------------------------------------------------------------------------------------------------------------------------------------------- MACRO_LEVEL 3: -- Executing [s@macrotest:1] Answer("SIP/trunk-00000000", "") in new stack -- Executing [s@macrotest:2] Gosub("SIP/trunk-00000000", "macro_level1,~~s~~,1") in new stack -- Executing [~~s~~@macro_level1:1] NoOp("SIP/trunk-00000000", "Running macro level 1") in new stack -- Executing [~~s~~@macro_level1:2] NoOp("SIP/trunk-00000000", "Hangup in macro_level1 should run h in context that invokes the macro") in new stack -- Executing [~~s~~@macro_level1:3] Wait("SIP/trunk-00000000", "10") in new stack -- Executing [~~s~~@macro_level1:4] Gosub("SIP/trunk-00000000", "macro_level2,~~s~~,1") in new stack -- Executing [~~s~~@macro_level2:1] NoOp("SIP/trunk-00000000", "Running macro level 2") in new stack -- Executing [~~s~~@macro_level2:2] NoOp("SIP/trunk-00000000", "Hangup in macro_level2 should run h in context that invokes the macro") in new stack -- Executing [~~s~~@macro_level2:3] Wait("SIP/trunk-00000000", "10") in new stack -- Executing [~~s~~@macro_level2:4] Gosub("SIP/trunk-00000000", "macro_level3,~~s~~,1") in new stack -- Executing [~~s~~@macro_level3:1] NoOp("SIP/trunk-00000000", "Running macro level 3") in new stack -- Executing [~~s~~@macro_level3:2] NoOp("SIP/trunk-00000000", "Hangup in macro_level3 should run catch h in macro_level3") in new stack -- Executing [~~s~~@macro_level3:3] Wait("SIP/trunk-00000000", "10") in new stack == Spawn extension (macro_level3, ~~s~~, 3) exited non-zero on 'SIP/trunk-00000000' -- Executing [h@macro_level3:1] NoOp("SIP/trunk-00000000", "catch h in macro level 3") in new stack TEST 3 : OK! --------------------------------------------------------------------------------------------------------------------------------------------------------- MACRO_LEVEL 4: -- Executing [s@macrotest:1] Answer("SIP/trunk-00000001", "") in new stack -- Executing [s@macrotest:2] Gosub("SIP/trunk-00000001", "macro_level1,~~s~~,1") in new stack -- Executing [~~s~~@macro_level1:1] NoOp("SIP/trunk-00000001", "Running macro level 1") in new stack -- Executing [~~s~~@macro_level1:2] NoOp("SIP/trunk-00000001", "Hangup in macro_level1 should run h in context that invokes the macro") in new stack -- Executing [~~s~~@macro_level1:3] Wait("SIP/trunk-00000001", "10") in new stack -- Executing [~~s~~@macro_level1:4] Gosub("SIP/trunk-00000001", "macro_level2,~~s~~,1") in new stack -- Executing [~~s~~@macro_level2:1] NoOp("SIP/trunk-00000001", "Running macro level 2") in new stack -- Executing [~~s~~@macro_level2:2] NoOp("SIP/trunk-00000001", "Hangup in macro_level2 should run h in context that invokes the macro") in new stack -- Executing [~~s~~@macro_level2:3] Wait("SIP/trunk-00000001", "10") in new stack -- Executing [~~s~~@macro_level2:4] Gosub("SIP/trunk-00000001", "macro_level3,~~s~~,1") in new stack -- Executing [~~s~~@macro_level3:1] NoOp("SIP/trunk-00000001", "Running macro level 3") in new stack -- Executing [~~s~~@macro_level3:2] NoOp("SIP/trunk-00000001", "Hangup in macro_level3 should run catch h in macro_level3") in new stack -- Executing [~~s~~@macro_level3:3] Wait("SIP/trunk-00000001", "10") in new stack -- Executing [~~s~~@macro_level3:4] Gosub("SIP/trunk-00000001", "macro_level4,~~s~~,1") in new stack -- Executing [~~s~~@macro_level4:1] NoOp("SIP/trunk-00000001", "Running macro level 4") in new stack -- Executing [~~s~~@macro_level4:2] NoOp("SIP/trunk-00000001", "Hangup in macro_level4 should run catch h in macro_level3") in new stack -- Executing [~~s~~@macro_level4:3] Wait("SIP/trunk-00000001", "10") in new stack == Spawn extension (macro_level4, ~~s~~, 3) exited non-zero on 'SIP/trunk-00000001' -- Executing [h@macro_level4:1] GotoIf("SIP/trunk-00000001", "1?macro_level3,h,1") in new stack -- Goto (macro_level3,h,1) -- Executing [h@macro_level3:1] NoOp("SIP/trunk-00000001", "catch h in macro level 3") in new stack TEST 4 : OK! --------------------------------------------------------------------------------------------------------------------------------------------------------- MACRO_LEVEL 5: -- Executing [s@macrotest:1] Answer("SIP/trunk-00000002", "") in new stack -- Executing [s@macrotest:2] Gosub("SIP/trunk-00000002", "macro_level1,~~s~~,1") in new stack -- Executing [~~s~~@macro_level1:1] NoOp("SIP/trunk-00000002", "Running macro level 1") in new stack -- Executing [~~s~~@macro_level1:2] NoOp("SIP/trunk-00000002", "Hangup in macro_level1 should run h in context that invokes the macro") in new stack -- Executing [~~s~~@macro_level1:3] Wait("SIP/trunk-00000002", "10") in new stack -- Executing [~~s~~@macro_level1:4] Gosub("SIP/trunk-00000002", "macro_level2,~~s~~,1") in new stack -- Executing [~~s~~@macro_level2:1] NoOp("SIP/trunk-00000002", "Running macro level 2") in new stack -- Executing [~~s~~@macro_level2:2] NoOp("SIP/trunk-00000002", "Hangup in macro_level2 should run h in context that invokes the macro") in new stack -- Executing [~~s~~@macro_level2:3] Wait("SIP/trunk-00000002", "10") in new stack -- Executing [~~s~~@macro_level2:4] Gosub("SIP/trunk-00000002", "macro_level3,~~s~~,1") in new stack -- Executing [~~s~~@macro_level3:1] NoOp("SIP/trunk-00000002", "Running macro level 3") in new stack -- Executing [~~s~~@macro_level3:2] NoOp("SIP/trunk-00000002", "Hangup in macro_level3 should run catch h in macro_level3") in new stack -- Executing [~~s~~@macro_level3:3] Wait("SIP/trunk-00000002", "10") in new stack -- Executing [~~s~~@macro_level3:4] Gosub("SIP/trunk-00000002", "macro_level4,~~s~~,1") in new stack -- Executing [~~s~~@macro_level4:1] NoOp("SIP/trunk-00000002", "Running macro level 4") in new stack -- Executing [~~s~~@macro_level4:2] NoOp("SIP/trunk-00000002", "Hangup in macro_level4 should run catch h in macro_level3") in new stack -- Executing [~~s~~@macro_level4:3] Wait("SIP/trunk-00000002", "10") in new stack -- Executing [~~s~~@macro_level4:4] Gosub("SIP/trunk-00000002", "macro_level5,~~s~~,1") in new stack -- Executing [~~s~~@macro_level5:1] NoOp("SIP/trunk-00000002", "Running macro level 5") in new stack -- Executing [~~s~~@macro_level5:2] NoOp("SIP/trunk-00000002", "Hangup in macro_level5 should run catch h in macro_level5") in new stack -- Executing [~~s~~@macro_level5:3] Wait("SIP/trunk-00000002", "20") in new stack == Spawn extension (macro_level5, ~~s~~, 3) exited non-zero on 'SIP/trunk-00000002' -- Executing [h@macro_level5:1] NoOp("SIP/trunk-00000002", "catch h in macro level 5") in new stack TEST 5 : OK!