Summary:ASTERISK-16785: [patch] Report what extension called a failed macro
Reporter:Rafael Prado Rocchi (prado)Labels:
Date Opened:2010-10-08 19:08:56Date Closed:2010-10-13 03:59:17
Versions:Frequency of
Environment:Attachments:( 0) app_macro-info.diff
Description:Suppose some extension calls a macro, but the macro was removed, renamed or it's name is incorrect. The log shows:

[Oct  8 17:51:36] WARNING[3070] app_macro.c: No such context 'macro-disca' for macro 'disca'.

It's difficult to tell by the log what extension called the macro. Specially if you have a big dialplan with lots of includes.

I propose a change, so the macro also shows who called it.
With the change, the log will show:

WARNING[3070] app_macro.c: No such context 'macro-disca' for macro 'disca'. Was called by 114194@default

Now it's easier to track the error and make the adjustments on the dialplan because we know we have to fix extension 114194@default.
It's simple, but I think it's very useful.
What do you think?

I did a patch agains trunk. How can I upload it here?

Comments:By: Rafael Prado Rocchi (prado) 2010-10-08 19:11:35

Patch attached!

By: Stefan Schmidt (schmidts) 2010-10-09 00:11:29


you are on the right way to get this into code ;)
i am just thinking about if there could be any situation where chan->exten or chan->context could be a null pointer but i dont think this could ever happens.

i will have a look at this.

By: Stefan Schmidt (schmidts) 2010-10-11 09:22:30

i have tried this and it looks good. both vars which are used here couldnt be null in this case so i think there could not be a problem out of this.

i will talk to other devs if they think there could be a problem with this.

By: Rafael Prado Rocchi (prado) 2010-10-12 14:05:17

Schmidts, thank you for looking at it!
I'll wait your feedback.

By: Russell Bryant (russell) 2010-10-12 14:55:30

Ship it!

By: Digium Subversion (svnbot) 2010-10-13 03:58:42

Repository: asterisk
Revision: 291361

U   trunk/apps/app_macro.c

r291361 | schmitds | 2010-10-13 03:58:42 -0500 (Wed, 13 Oct 2010) | 11 lines

Report what extension called a failed macro

Add the extension and context of the calling channel to the log output if a macro could not be found.

(closes issue ASTERISK-16785)
Reported by: prado
app_macro-info.diff uploaded by prado (license 510)
Tested by: schmidts



By: Stefan Schmidt (schmidts) 2010-10-13 03:59:17

thank you for the patch prado!

best regards