提交 4fcf7c34 authored 作者: Michael Jerris's avatar Michael Jerris

always update state to CS_HANGUP for now, even if the channel is gone to handle…

always update state to CS_HANGUP for now, even if the channel is gone to handle race where we miss this update
上级 ab99143d
...@@ -1756,7 +1756,7 @@ static char *parse_presence_data_cols(switch_event_t *event) ...@@ -1756,7 +1756,7 @@ static char *parse_presence_data_cols(switch_event_t *event)
#define MAX_SQL 5 #define MAX_SQL 5
#define new_sql() switch_assert(sql_idx+1 < MAX_SQL); if (exists) sql[sql_idx++] #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) static void core_event_handler(switch_event_t *event)
{ {
...@@ -1764,7 +1764,6 @@ 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; int sql_idx = 0;
char *extra_cols; char *extra_cols;
int exists = 1; int exists = 1;
int force_exists = 1;
char *uuid = NULL; char *uuid = NULL;
switch_assert(event); switch_assert(event);
...@@ -1786,10 +1785,7 @@ static void core_event_handler(switch_event_t *event) ...@@ -1786,10 +1785,7 @@ static void core_event_handler(switch_event_t *event)
case SWITCH_EVENT_CALL_SECURE: case SWITCH_EVENT_CALL_SECURE:
{ {
if ((uuid = switch_event_get_header(event, "unique-id"))) { if ((uuid = switch_event_get_header(event, "unique-id"))) {
force_exists = exists = switch_ivr_uuid_exists(uuid); exists = switch_ivr_uuid_exists(uuid);
if (!exists) {
force_exists = switch_ivr_uuid_force_exists(uuid);
}
} }
} }
break; break;
...@@ -1980,6 +1976,11 @@ static void core_event_handler(switch_event_t *event) ...@@ -1980,6 +1976,11 @@ static void core_event_handler(switch_event_t *event)
//case CS_HANGUP: /* marked for deprication */ //case CS_HANGUP: /* marked for deprication */
case CS_INIT: case CS_INIT:
break; 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: case CS_EXECUTE:
if ((extra_cols = parse_presence_data_cols(event))) { if ((extra_cols = parse_presence_data_cols(event))) {
new_sql() = switch_mprintf("update channels set state='%s',%s where uuid='%q'", 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) ...@@ -2038,7 +2039,7 @@ static void core_event_handler(switch_event_t *event)
} }
break; break;
default: 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, "channel-state"),
switch_event_get_header_nil(event, "unique-id")); switch_event_get_header_nil(event, "unique-id"));
break; break;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论