]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
always update state to CS_HANGUP for now, even if the channel is gone to handle race...
authorMichael Jerris <mike@jerris.com>
Wed, 31 Oct 2012 14:44:38 +0000 (10:44 -0400)
committerMichael Jerris <mike@jerris.com>
Wed, 31 Oct 2012 14:44:38 +0000 (10:44 -0400)
src/switch_core_sqldb.c

index e0c60ee584627c5c495a31fad6b5182333b360df..64fc933d331f162251f9974b3aedd18d4a94775a 100644 (file)
@@ -1756,7 +1756,7 @@ static char *parse_presence_data_cols(switch_event_t *event)
 
 #define MAX_SQL 5
 #define new_sql()   switch_assert(sql_idx+1 < MAX_SQL); if (exists) sql[sql_idx++]
-#define new_sql_f() switch_assert(sql_idx+1 < MAX_SQL); if (force_exists) sql[sql_idx++]
+#define new_sql_a() switch_assert(sql_idx+1 < MAX_SQL); sql[sql_idx++]
 
 static void core_event_handler(switch_event_t *event)
 {
@@ -1764,7 +1764,6 @@ static void core_event_handler(switch_event_t *event)
        int sql_idx = 0;
        char *extra_cols;
        int exists = 1;
-       int force_exists = 1;
        char *uuid = NULL;
 
        switch_assert(event);
@@ -1786,10 +1785,7 @@ static void core_event_handler(switch_event_t *event)
        case SWITCH_EVENT_CALL_SECURE:
                {
                        if ((uuid = switch_event_get_header(event, "unique-id"))) {
-                               force_exists = exists = switch_ivr_uuid_exists(uuid);
-                               if (!exists) {
-                                       force_exists = switch_ivr_uuid_force_exists(uuid);
-                               }
+                               exists = switch_ivr_uuid_exists(uuid);
                        }
                }
                break;
@@ -1980,6 +1976,11 @@ static void core_event_handler(switch_event_t *event)
                                //case CS_HANGUP: /* marked for deprication */
                        case CS_INIT:
                                break;
+                       case CS_HANGUP: /* marked for deprication */
+                               new_sql_a() = switch_mprintf("update channels set state='%s' where uuid='%s'",
+                                                                                        switch_event_get_header_nil(event, "channel-state"),
+                                                                                        switch_event_get_header_nil(event, "unique-id"));
+                               break;
                        case CS_EXECUTE:
                                if ((extra_cols = parse_presence_data_cols(event))) {
                                        new_sql() = switch_mprintf("update channels set state='%s',%s where uuid='%q'",
@@ -2038,7 +2039,7 @@ static void core_event_handler(switch_event_t *event)
                                }
                                break;
                        default:
-                               new_sql_f() = switch_mprintf("update channels set state='%s' where uuid='%s'",
+                               new_sql() = switch_mprintf("update channels set state='%s' where uuid='%s'",
                                                                                   switch_event_get_header_nil(event, "channel-state"),
                                                                                   switch_event_get_header_nil(event, "unique-id"));
                                break;