[asterisk-bugs] [Asterisk 0014411]: calling Gosub in macro does not work if the invalid extension is triggered

Asterisk Bug Tracker noreply at bugs.digium.com
Thu Feb 5 23:23:50 CST 2009


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=14411 
====================================================================== 
Reported By:                klaus3000
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   14411
Category:                   Applications/app_macro
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     feedback
Asterisk Version:           1.4.23 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2009-02-05 05:39 CST
Last Modified:              2009-02-05 23:23 CST
====================================================================== 
Summary:                    calling Gosub in macro does not work if the invalid
extension is triggered
Description: 
Hi!

Consider the following example:

macro blacklistMakro() {
  Gosub(blacklist_${BLACKLIST}|${MACRO_EXTEN}|1);
  return;
}

context blacklist_SIMPLE {
  _+49. => Hangup();
  i =>Return();
}

If the Gosub call inside the macro triggers the i extension, MACRO_DEPTH
is set to 0, the macro "forgets" that it is a macrom, and does not return
(auto fallthrough happens)


====================================================================== 

---------------------------------------------------------------------- 
 (0099582) klaus3000 (reporter) - 2009-02-05 23:23
 http://bugs.digium.com/view.php?id=14411#c99582 
---------------------------------------------------------------------- 
No problem: (I am using Asterisk 1.4.23)

context fromPhone {
        _+. => {
                NoOp(fromPhone: Calling test1 (valid extension) ...);
                Gosub(test1,${EXTEN},1);
                NoOp(fromPhone: Returned from test1 ...);

                NoOp(fromPhone: Calling test2 (invalid extension) ...);
                Gosub(test2,${EXTEN},1);
                NoOp(fromPhone: Returned from test2 ...);

                NoOp(fromPhone: Calling macro1 ...);
                &testMacro1();
                NoOp(fromPhone: Returned from macro1 ...);

                NoOp(fromPhone: Calling macro2 ...);
                &testMacro2();
                NoOp(fromPhone: Returned from macro2 ...);
        }
}

macro testMacro1() {
        NoOp(testMacro1: Calling test1 (valid extension) ...);
        Gosub(test1,${MACRO_EXTEN},1);
        NoOp(testMacro1: Returned from test1 ...);

        return;
}

macro testMacro2() {
        NoOp(testMacro2: Calling test2 (invalid extension) ...);
        Gosub(test2,${MACRO_EXTEN},1);
        NoOp(testMacro2: Returned from test2 ...);

        return;
}

context test1 {
        _+. => {
                NoOp(test1: test1 entered (valid extension) ...);
                Return();
        }
}
context test2 {
        i => {
                NoOp(test2: test2 entered (invalid extension) ...);
                Return();
        }
}



  -- Executing [+12345 at fromPhone:1] NoOp("SIP/u+437206200730151-b58028b8",
"fromPhone: Calling test1 (valid extension) ...") in new stack
  -- Executing [+12345 at fromPhone:2]
Gosub("SIP/u+437206200730151-b58028b8", "test1|+12345|1") in new stack
  -- Executing [+12345 at test1:1] NoOp("SIP/u+437206200730151-b58028b8",
"test1: test1 entered (valid extension) ...") in new stack
  -- Executing [+12345 at test1:2] Return("SIP/u+437206200730151-b58028b8",
"") in new stack
  -- Executing [+12345 at fromPhone:3] NoOp("SIP/u+437206200730151-b58028b8",
"fromPhone: Returned from test1 ...") in new stack
  -- Executing [+12345 at fromPhone:4] NoOp("SIP/u+437206200730151-b58028b8",
"fromPhone: Calling test2 (invalid extension) ...") in new stack
  -- Executing [+12345 at fromPhone:5]
Gosub("SIP/u+437206200730151-b58028b8", "test2|+12345|1") in new stack
  -- Sent into invalid extension '+12345' in context 'test2' on
SIP/u+437206200730151-b58028b8
  -- Executing [i at test2:1] NoOp("SIP/u+437206200730151-b58028b8", "test2:
test2 entered (invalid extension) ...") in new stack
  -- Executing [i at test2:2] Return("SIP/u+437206200730151-b58028b8", "") in
new stack
  -- Executing [+12345 at fromPhone:6] NoOp("SIP/u+437206200730151-b58028b8",
"fromPhone: Returned from test2 ...") in new stack
  -- Executing [+12345 at fromPhone:7] NoOp("SIP/u+437206200730151-b58028b8",
"fromPhone: Calling macro1 ...") in new stack
  -- Executing [+12345 at fromPhone:8]
Macro("SIP/u+437206200730151-b58028b8", "testMacro1") in new stack
  -- Executing [s at macro-testMacro1:1]
NoOp("SIP/u+437206200730151-b58028b8", "testMacro1: Calling test1 (valid
extension) ...") in new stack
  -- Executing [s at macro-testMacro1:2]
Gosub("SIP/u+437206200730151-b58028b8", "test1|+12345|1") in new stack
  -- Executing [+12345 at test1:1] NoOp("SIP/u+437206200730151-b58028b8",
"test1: test1 entered (valid extension) ...") in new stack
  -- Executing [+12345 at test1:2] Return("SIP/u+437206200730151-b58028b8",
"") in new stack
  -- Executing [s at macro-testMacro1:3]
NoOp("SIP/u+437206200730151-b58028b8", "testMacro1: Returned from test1
...") in new stack
  -- Executing [s at macro-testMacro1:4]
Goto("SIP/u+437206200730151-b58028b8", "5") in new stack
  -- Goto (macro-testMacro1,s,5)
  -- Executing [s at macro-testMacro1:5]
NoOp("SIP/u+437206200730151-b58028b8", "End of Macro testMacro1-s") in new
stack
  -- Executing [+12345 at fromPhone:9] NoOp("SIP/u+437206200730151-b58028b8",
"fromPhone: Returned from macro1 ...") in new stack
  -- Executing [+12345 at fromPhone:10]
NoOp("SIP/u+437206200730151-b58028b8", "fromPhone: Calling macro2 ...") in
new stack
  -- Executing [+12345 at fromPhone:11]
Macro("SIP/u+437206200730151-b58028b8", "testMacro2") in new stack
  -- Executing [s at macro-testMacro2:1]
NoOp("SIP/u+437206200730151-b58028b8", "testMacro2: Calling test2 (invalid
extension) ...") in new stack
  -- Executing [s at macro-testMacro2:2]
Gosub("SIP/u+437206200730151-b58028b8", "test2|+12345|1") in new stack
  -- Sent into invalid extension '+12345' in context 'test2' on
SIP/u+437206200730151-b58028b8
  -- Executing [i at test2:1] NoOp("SIP/u+437206200730151-b58028b8", "test2:
test2 entered (invalid extension) ...") in new stack
  -- Executing [i at test2:2] Return("SIP/u+437206200730151-b58028b8", "") in
new stack
  -- Executing [s at macro-testMacro2:3]
NoOp("SIP/u+437206200730151-b58028b8", "testMacro2: Returned from test2
...") in new stack
  -- Executing [s at macro-testMacro2:4]
Goto("SIP/u+437206200730151-b58028b8", "5") in new stack
  -- Goto (macro-testMacro2,s,5)
  -- Executing [s at macro-testMacro2:5]
NoOp("SIP/u+437206200730151-b58028b8", "End of Macro testMacro2-s") in new
stack
== Auto fallthrough, channel 'SIP/u+437206200730151-b58028b8' status is
'UNKNOWN' 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-02-05 23:23 klaus3000      Note Added: 0099582                          
======================================================================




More information about the asterisk-bugs mailing list