From 91e270907bca622ca4bd10cab2d9a1a6cd682a59 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Thu, 22 May 2008 01:08:30 +0000 Subject: [PATCH] add disable_app_log variable git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8517 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/include/switch_types.h | 1 + src/switch_core_session.c | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 978df43b12..d0532e3592 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -140,6 +140,7 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE "exec_after_bridge_app" #define SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE "exec_after_bridge_arg" #define SWITCH_MAX_FORWARDS_VARIABLE "max_forwards" +#define SWITCH_DISABLE_APP_LOG_VARIABLE "disable_app_log" #define SWITCH_SPEECH_KEY "speech" #define SWITCH_UUID_BRIDGE "uuid_bridge" #define SWITCH_BITS_PER_BYTE 8 diff --git a/src/switch_core_session.c b/src/switch_core_session.c index f3d82e32e9..d3bef3019c 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1013,22 +1013,25 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t * const switch_application_interface_t *application_interface, const char *arg) { switch_app_log_t *log, *lp; switch_event_t *event; + const char *var; if (!arg) { arg = ""; } - log = switch_core_session_alloc(session, sizeof(*log)); + if (!(var = switch_channel_get_variable(session->channel, SWITCH_DISABLE_APP_LOG_VARIABLE)) || (!(switch_true(var)))) { + log = switch_core_session_alloc(session, sizeof(*log)); - log->app = switch_core_session_strdup(session, application_interface->interface_name); - log->arg = switch_core_session_strdup(session, arg); + log->app = switch_core_session_strdup(session, application_interface->interface_name); + log->arg = switch_core_session_strdup(session, arg); - for(lp = session->app_log; lp && lp->next; lp = lp->next); + for(lp = session->app_log; lp && lp->next; lp = lp->next); - if (lp) { - lp->next = log; - } else { - session->app_log = log; + if (lp) { + lp->next = log; + } else { + session->app_log = log; + } } if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) {