Summary:ASTERISK-15097: [patch] Asterisk Asterisk crashes when running dialplan app macro on a macro that does not exist.
Reporter:Jered Sutton (jsutton)Labels:
Date Opened:2009-11-06 16:28:29.000-0600Date Closed:2010-05-11 14:36:23
Versions:Frequency of
Environment:Attachments:( 0) 20100504__issue16202.diff.txt
( 1) backtrace.txt
( 2) chan_sip.c.rej.txt
Description:I see this issue running with asterisk addons with realtime extensions configured. This is a problem as a typo in an extension can cause a crash. See CLI output below.

   -- Executing macro("SIP/4692538023-086383e8", "non-exist")
[Nov  6 15:13:04] WARNING[5916]: app_macro.c:239 _macro_exec: No such context 'macro-non-exist' for macro 'non-exist'
Disconnected from Asterisk server


To reproduce run dialplan app macro with a non-existent macro. i.e.
exten => 123,1,macro(non-exist)
Comments:By: Jered Sutton (jsutton) 2009-11-06 16:29:47.000-0600

The issue should have the severity changed to crash.

By: Leif Madsen (lmadsen) 2009-11-09 08:55:12.000-0600

Since you have this classified as "Older 1.6.0" what is the version you've reproduced this on? Are you able to reproduce this on the latest release or from the 1.6.0 branch from SVN directly?

By: Jered Sutton (jsutton) 2009-11-09 09:05:30.000-0600

We have replicated the bug on We have not tried later versions as this is a production system.

By: sohosys (sohosys) 2009-11-10 13:39:39.000-0600

easily reproducible in following jsuttons instructions.

By: sohosys (sohosys) 2010-04-02 14:15:38

has this ever been patched?

By: Jered Sutton (jsutton) 2010-04-05 15:44:43

This continues to be an issue in See below.
-- Executing macro("SIP/<removed>-00000002", "notexist,1,2")
[Apr  5 14:39:56] WARNING[14379]: app_macro.c:302 _macro_exec: No such context 'macro-notexist' for macro 'notexist'
Disconnected from Asterisk server

By: Leif Madsen (lmadsen) 2010-04-15 10:29:21

Debugging a crash without a backtrace is going to make getting this issue resolved nearly impossible. Please follow the instructions in doc/backtrace.txt.

Alternatively, you can check out the updated backtrace.txt file I worked on this morning in issue ASTERISK-15962

By: Jered Sutton (jsutton) 2010-04-20 15:02:06

I have attached the backtrace file. Below is the corresponding console output to the crash.

Connected to Asterisk currently running on <removed> (pid = 9408)
Verbosity is at least 3
 == Using SIP RTP CoS mark 5
 == Using UDPTL CoS mark 5
   -- Executing [7208427024@ser-inbound:1] GotoIf("SIP/<removed>-00000000", "1?4:2") in new stack
   -- Goto (ser-inbound,7208427024,4)
   -- Executing [7208427024@ser-inbound:4] NoOp("SIP/<removed>-00000000", "") in new stack
   -- Executing [7208427024@ser-inbound:5] Goto("SIP/<removed>-00000000", "subscriber-numbers,7208427024,1") in new stack
   -- Goto (subscriber-numbers,7208427024,1)
   -- Executing macro("SIP/<removed>-00000000", "incontact-out,+14003642678,1")
[Apr 20 13:40:51] WARNING[9544]: app_macro.c:302 _macro_exec: No such context 'macro-incontact-out' for macro 'incontact-out'
Disconnected from Asterisk server
[root@<removed> asterisk-]#

By: Tilghman Lesher (tilghman) 2010-05-04 19:25:54

Issue has been reproduced, and this patch fixes it for me.  Does it also fix the problem for you?  Please test and report back.

By: Jered Sutton (jsutton) 2010-05-11 14:14:14

patching file channels/chan_sip.c
Hunk #1 FAILED at 3345.
Hunk #2 FAILED at 3377.
Hunk #3 FAILED at 4693.
3 out of 3 hunks FAILED -- saving rejects to file channels/chan_sip.c.rej

By: Jered Sutton (jsutton) 2010-05-11 14:15:11

Patch was run against both and

By: Tilghman Lesher (tilghman) 2010-05-11 14:20:45

Are you patching against 1.6.0 or 1.6.2?  Your report says 1.6.0, but a recent bugnote says 1.6.2.  These are RADICALLY different versions.

By: Jered Sutton (jsutton) 2010-05-11 14:24:16

Sry in the time since we submitted the bug we tried upgrading to 1.6.2 to see if the issue was still present. Which it is. I will try the patch against 1.6.0

By: Tilghman Lesher (tilghman) 2010-05-11 14:27:50

Looks like this has already been fixed in the 1.6.2 branch, and the fix is in

By: Digium Subversion (svnbot) 2010-05-11 14:35:45

Repository: asterisk
Revision: 262418

U   branches/1.6.0/channels/chan_sip.c

r262418 | tilghman | 2010-05-11 14:35:37 -0500 (Tue, 11 May 2010) | 8 lines

Backport fix for issue ASTERISK-15581 to 1.6.0 (refcount leak with provisional responses)

(closes issue ASTERISK-15097)
Reported by: jsutton
      20100504__issue16202.diff.txt uploaded by tilghman (license 14)
Tested by: tilghman