From 3cf238fc9a1370a45d362c2193b8d3634ccd1d11 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 19 Sep 2012 10:49:50 -0500 Subject: [PATCH] add skip_cdr_causes variable to list call hangup causes that should not trigger cdr processing --- src/include/switch_types.h | 1 + src/switch_core_state_machine.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 9fa47ac2b8..5f3a4fa258 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -163,6 +163,7 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_API_REPORTING_HOOK_VARIABLE "api_reporting_hook" #define SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE "session_in_hangup_hook" #define SWITCH_PROCESS_CDR_VARIABLE "process_cdr" +#define SWITCH_SKIP_CDR_CAUSES_VARIABLE "skip_cdr_causes" #define SWITCH_FORCE_PROCESS_CDR_VARIABLE "force_process_cdr" #define SWITCH_BRIDGE_CHANNEL_VARIABLE "bridge_channel" #define SWITCH_CHANNEL_NAME_VARIABLE "channel_name" diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index a3c7079dbb..0288df11a6 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -662,6 +662,7 @@ SWITCH_DECLARE(void) switch_core_session_reporting_state(switch_core_session_t * int silly = 0; int index = 0; const char *var = switch_channel_get_variable(session->channel, SWITCH_PROCESS_CDR_VARIABLE); + const char *skip_var = switch_channel_get_variable(session->channel, SWITCH_SKIP_CDR_CAUSES_VARIABLE); const char *hook_var; int use_session = 0; switch_event_t *event; @@ -695,6 +696,22 @@ SWITCH_DECLARE(void) switch_core_session_reporting_state(switch_core_session_t * } } + + if (!zstr(skip_var)) { + int x, ttl = 0; + char *list[128] = { 0 }; + char *dup = switch_core_session_strdup(session, skip_var); + + ttl = switch_split(dup, '|', list); + + for(x = 0; x < ttl; x++) { + if (switch_channel_str2cause(list[x]) == cause) { + do_extra_handlers = 0; + break; + } + } + } + if (switch_channel_test_flag(session->channel, CF_NO_CDR)) { do_extra_handlers = 0; }