提交 1de65cbc authored 作者: Michael Jerris's avatar Michael Jerris

handle state update for hangup

上级 74dbbb01
...@@ -927,6 +927,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_set_user(switch_core_session_t *sessi ...@@ -927,6 +927,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_set_user(switch_core_session_t *sessi
SWITCH_DECLARE(switch_status_t) switch_ivr_sound_test(switch_core_session_t *session); SWITCH_DECLARE(switch_status_t) switch_ivr_sound_test(switch_core_session_t *session);
SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname, const char *prefix); SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname, const char *prefix);
SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_exists(const char *uuid); SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_exists(const char *uuid);
SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_force_exists(const char *uuid);
......
...@@ -1755,7 +1755,8 @@ static char *parse_presence_data_cols(switch_event_t *event) ...@@ -1755,7 +1755,8 @@ 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++]
static void core_event_handler(switch_event_t *event) static void core_event_handler(switch_event_t *event)
{ {
...@@ -1763,6 +1764,7 @@ static void core_event_handler(switch_event_t *event) ...@@ -1763,6 +1764,7 @@ 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);
...@@ -1784,7 +1786,10 @@ static void core_event_handler(switch_event_t *event) ...@@ -1784,7 +1786,10 @@ 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"))) {
exists = switch_ivr_uuid_exists(uuid); force_exists = exists = switch_ivr_uuid_exists(uuid);
if (!exists) {
force_exists = switch_ivr_uuid_force_exists(uuid);
}
} }
} }
break; break;
...@@ -2033,7 +2038,7 @@ static void core_event_handler(switch_event_t *event) ...@@ -2033,7 +2038,7 @@ static void core_event_handler(switch_event_t *event)
} }
break; break;
default: default:
new_sql() = switch_mprintf("update channels set state='%s' where uuid='%s'", new_sql_f() = 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;
......
...@@ -3209,6 +3209,19 @@ SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_exists(const char *uuid) ...@@ -3209,6 +3209,19 @@ SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_exists(const char *uuid)
return exists; return exists;
} }
SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_force_exists(const char *uuid)
{
switch_bool_t exists = SWITCH_FALSE;
switch_core_session_t *psession = NULL;
if ((psession = switch_core_session_force_locate(uuid))) {
switch_core_session_rwunlock(psession);
exists = 1;
}
return exists;
}
SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *session, const char *cmd, switch_file_handle_t *fhp) SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *session, const char *cmd, switch_file_handle_t *fhp)
{ {
if (zstr(cmd)) { if (zstr(cmd)) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论