--resolve FS-5478

This commit is contained in:
Marc Olivier Chouinard 2013-07-08 00:55:48 -04:00
parent 5110e28486
commit c613c65446

View File

@ -1525,7 +1525,15 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa
/* Switch the agent session */
if (real_uuid) {
switch_core_session_rwunlock(agent_session);
agent_session = switch_core_session_locate(real_uuid);
if (!(agent_session = switch_core_session_locate(real_uuid))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Real session is already gone (agent '%s')\n", h->agent_name);
sql = switch_mprintf("UPDATE members SET state = '%q', serving_agent = '', serving_system = ''"
" WHERE serving_agent = '%q' AND serving_system = '%q' AND uuid = '%q' AND system = 'single_box'",
cc_member_state2str(CC_MEMBER_STATE_WAITING), h->agent_name, h->agent_system, h->member_uuid);
cc_execute_sql(NULL, sql, NULL);
switch_safe_free(sql);
goto done;
}
agent_uuid = switch_core_session_get_uuid(agent_session);
agent_channel = switch_core_session_get_channel(agent_session);