aboutsummaryrefslogtreecommitdiffstats
path: root/funcs/func_channel.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-02-18 04:43:33 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-02-18 04:43:33 +0000
commita5efdcb36154ed5c5d6325ccc1b4dd99490b48e9 (patch)
tree1f70ab1c1a8d010ade37a053edebff107ad9fcc9 /funcs/func_channel.c
parentfc61184a360cc7cbbf3c4678368cfa045ff33d31 (diff)
Context tracing for channels
(closes issue #11268) Reported by: moy Patches: chantrace-datastored-encapsulated-rev94934.patch uploaded by moy (license 222) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@103754 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs/func_channel.c')
-rw-r--r--funcs/func_channel.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/funcs/func_channel.c b/funcs/func_channel.c
index d920ac21f..42b3c68c9 100644
--- a/funcs/func_channel.c
+++ b/funcs/func_channel.c
@@ -71,6 +71,13 @@ static int func_channel_read(struct ast_channel *chan, const char *function,
ast_copy_string(buf, ast_getformatname(chan->readformat), len);
else if (!strcasecmp(data, "audiowriteformat"))
ast_copy_string(buf, ast_getformatname(chan->writeformat), len);
+#ifdef CHANNEL_TRACE
+ else if (!strcasecmp(data, "trace")) {
+ ast_channel_lock(chan);
+ ast_copy_string(buf, ast_channel_trace_is_enabled(chan) ? "1" : "0", len);
+ ast_channel_unlock(chan);
+ }
+#endif
else if (!strcasecmp(data, "tonezone") && chan->zone)
locked_copy_string(chan, buf, chan->zone->country, len);
else if (!strcasecmp(data, "language"))
@@ -105,6 +112,20 @@ static int func_channel_write(struct ast_channel *chan, const char *function,
locked_string_field_set(chan, language, value);
else if (!strcasecmp(data, "musicclass"))
locked_string_field_set(chan, musicclass, value);
+#ifdef CHANNEL_TRACE
+ else if (!strcasecmp(data, "trace")) {
+ ast_channel_lock(chan);
+ if (ast_true(value))
+ ret = ast_channel_trace_enable(chan);
+ else if (ast_false(value))
+ ret = ast_channel_trace_disable(chan);
+ else {
+ ret = -1;
+ ast_log(LOG_WARNING, "Invalid value for CHANNEL(trace).");
+ }
+ ast_channel_unlock(chan);
+ }
+#endif
else if (!strcasecmp(data, "tonezone")) {
struct ind_tone_zone *new_zone;
if (!(new_zone = ast_get_indication_zone(value))) {
@@ -156,6 +177,9 @@ static struct ast_custom_function channel_function = {
"R/W tonezone zone for indications played\n"
"R/W txgain set txgain level on channel drivers that support it\n"
"R/O videonativeformat format used natively for video\n"
+#ifdef CHANNEL_TRACE
+ "R/W trace whether or not context tracing is enabled\n"
+#endif
"\n"
"chan_sip provides the following additional options:\n"
"R/O rtpqos Get QOS information about the RTP stream\n"