From 32f6aa3b9e81ec230556a59fc02276d138ebe7cb Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 13 Jul 2010 00:47:41 -0500 Subject: [PATCH] update --- src/switch_channel.c | 13 ++++++++++--- src/switch_core_sqldb.c | 38 ++++++++++---------------------------- 2 files changed, 20 insertions(+), 31 deletions(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index 9a85d5efbd..edf162c0fd 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1761,6 +1761,11 @@ SWITCH_DECLARE(void) switch_channel_event_set_basic_data(switch_channel_t *chann switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Presence-Data", v); } + + if ((v = switch_channel_get_variable(channel, "presence_data_cols"))) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Presence-Data-Cols", v); + } + if ((v = switch_channel_get_variable(channel, "call_uuid"))) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Call-UUID", v); } @@ -1813,13 +1818,15 @@ SWITCH_DECLARE(void) switch_channel_event_set_basic_data(switch_channel_t *chann SWITCH_DECLARE(void) switch_channel_event_set_extended_data(switch_channel_t *channel, switch_event_t *event) { switch_event_header_t *hi; - int x, global_verbos_events = 0; + int x, global_verbose_events = 0; switch_mutex_lock(channel->profile_mutex); - switch_core_session_ctl(SCSC_VERBOSE_EVENTS, &global_verbos_events); + switch_core_session_ctl(SCSC_VERBOSE_EVENTS, &global_verbose_events); - if (global_verbos_events || switch_channel_test_flag(channel, CF_VERBOSE_EVENTS) || + if (global_verbose_events || + switch_channel_test_flag(channel, CF_VERBOSE_EVENTS) || + switch_event_get_header(event, "presence-data-cols") || event->event_id == SWITCH_EVENT_CHANNEL_CREATE || event->event_id == SWITCH_EVENT_CHANNEL_ORIGINATE || event->event_id == SWITCH_EVENT_CHANNEL_UUID || diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index c67d553daa..810de2ddda 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -973,7 +973,7 @@ static char *parse_presence_data_cols(switch_event_t *event) int i; char *r; char col_name[128] = ""; - const char *data = switch_event_get_header(event, "variable_presence_data_cols"); + const char *data = switch_event_get_header(event, "presence-data-cols"); if (zstr(data)) { return NULL; @@ -1094,34 +1094,16 @@ static void core_event_handler(switch_event_t *event) case SWITCH_EVENT_CHANNEL_HOLD: case SWITCH_EVENT_CHANNEL_UNHOLD: case SWITCH_EVENT_CHANNEL_EXECUTE: { - - if ((extra_cols = parse_presence_data_cols(event))) { - - new_sql() = switch_mprintf("update channels set application='%q',application_data='%q'," - "presence_id='%q',presence_data='%q',%s where uuid='%q' and hostname='%q'", - switch_event_get_header_nil(event, "application"), - switch_event_get_header_nil(event, "application-data"), - switch_event_get_header_nil(event, "channel-presence-id"), - switch_event_get_header_nil(event, "channel-presence-data"), - extra_cols, - switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname") - - ); - - free(extra_cols); - - } else { - new_sql() = switch_mprintf("update channels set application='%q',application_data='%q'," - "presence_id='%q',presence_data='%q' where uuid='%q' and hostname='%q'", - switch_event_get_header_nil(event, "application"), - switch_event_get_header_nil(event, "application-data"), - switch_event_get_header_nil(event, "channel-presence-id"), - switch_event_get_header_nil(event, "channel-presence-data"), - switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname") - - ); - } + new_sql() = switch_mprintf("update channels set application='%q',application_data='%q'," + "presence_id='%q',presence_data='%q' where uuid='%q' and hostname='%q'", + switch_event_get_header_nil(event, "application"), + switch_event_get_header_nil(event, "application-data"), + switch_event_get_header_nil(event, "channel-presence-id"), + switch_event_get_header_nil(event, "channel-presence-data"), + switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname") + ); + } break;