Summary:ASTERISK-10785: [patch] Context tracing for channels
Reporter:Moises Silva (moy)Labels:
Date Opened:2007-11-15 21:11:19.000-0600Date Closed:2008-02-17 22:40:09.000-0600
Versions:Frequency of
Environment:Attachments:( 0) asterisk-context-trace-94934.patch
( 1) chantrace-datastored-encapsulated-rev94934.patch
( 2) context-trace-rev89277.diff
( 3) context-trace-rev89394.diff
Description:Once in a while I find myself wondering how a channel got to X context when is in the middle of a call or in a queue. I have added an option to allow tracing of contexts where the channel has been. Kind of a backtrace.

exten => _X.,n,Set(CHANNEL(trace)=1) //1 enable anything else stop tracing

core show channel tech/blah

will show at the end the backtrace

This has been useful to me, I hope I can stop patching my Asterisk in future releases if this is included in trunk.

Comments:By: Moises Silva (moy) 2007-11-15 21:13:08.000-0600

I have not tested the tracing behaviour when  ast_do_masquerade() is called. I will do so this week, but I think it should work OK, I just moved the trace list to the new channel erasing the one in the clone.

By: Eliel Sardanons (eliel) 2007-11-17 19:16:47.000-0600

You could use: ast_true(value) instead of strcmp(value, "1")

By: Moises Silva (moy) 2007-11-17 23:01:53.000-0600

Thanks for the reminder eliel, forgot that I could have used that function. I have updated the patch to use ast_true for revision 89394.

Also I tried to use Redirect, but seems broken on trunk??

I will try again starting the week.

By: Tilghman Lesher (tilghman) 2007-12-26 11:48:56.000-0600

I'd prefer that you use datastores to store this information, instead of altering the channel structure.

By: Moises Silva (moy) 2007-12-27 12:24:19.000-0600

Added patch using datastores for revision 94934.

By: Tilghman Lesher (tilghman) 2007-12-27 12:40:29.000-0600

There is some really poor encapsulation here.

1) The contents of the datastore should be kept in a .c file, not in a publically accessible header file.  APIs should be added as necessary so that the encapsulation is kept.

2) ast_channel_update_trace() should take only the channel as an argument and find the datastore itself and update if necessary.

3) All of the code should be enabled by a define, selectable from menuselect, default off.  The reason is that this code adds a fair amount of overhead, which would be preferable to be non-existent, especially on slow or low memory systems.

By: Moises Silva (moy) 2007-12-27 16:14:10.000-0600


By: Moises Silva (moy) 2008-01-12 15:05:34.000-0600

ping ... anything else needs to be done?

By: jmls (jmls) 2008-02-17 12:53:22.000-0600

Corydon76, please see comment above.

By: Digium Subversion (svnbot) 2008-02-17 22:40:09.000-0600

Repository: asterisk
Revision: 103754

U   trunk/CHANGES
U   trunk/build_tools/cflags.xml
U   trunk/funcs/func_channel.c
U   trunk/include/asterisk/channel.h
U   trunk/main/channel.c
U   trunk/main/cli.c
U   trunk/main/pbx.c

r103754 | tilghman | 2008-02-17 22:40:08 -0600 (Sun, 17 Feb 2008) | 6 lines

Context tracing for channels
(closes issue ASTERISK-10785)
Reported by: moy
      chantrace-datastored-encapsulated-rev94934.patch uploaded by moy (license 222)