]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 13 Jul 2010 05:47:41 +0000 (00:47 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 13 Jul 2010 05:47:41 +0000 (00:47 -0500)
src/switch_channel.c
src/switch_core_sqldb.c

index 9a85d5efbd4324415d6d725eee76bcadccf9a57b..edf162c0fd8bd75b3a1e5607973c3edcf24c9a4c 100644 (file)
@@ -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 ||
index c67d553daa715234a39b5e58aff7b84c449626bd..810de2ddda5faca32e1a07dfd31a177c14a6fef1 100644 (file)
@@ -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;