update call_uuid stuff
This commit is contained in:
parent
8caef22b6c
commit
b946ee94b2
|
@ -2121,6 +2121,8 @@ SWITCH_DECLARE(void) switch_channel_event_set_basic_data(switch_channel_t *chann
|
|||
|
||||
if ((v = switch_channel_get_variable(channel, "call_uuid"))) {
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Call-UUID", v);
|
||||
} else {
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Call-UUID", switch_core_session_get_uuid(channel->session));
|
||||
}
|
||||
|
||||
if (switch_channel_down(channel)) {
|
||||
|
|
|
@ -1427,6 +1427,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_uuid(switch_core_session
|
|||
profile->uuid = switch_core_strdup(profile->pool, use_uuid);
|
||||
}
|
||||
|
||||
switch_channel_set_variable(session->channel, "uuid", use_uuid);
|
||||
switch_channel_set_variable(session->channel, "call_uuid", use_uuid);
|
||||
|
||||
switch_event_create(&event, SWITCH_EVENT_CHANNEL_UUID);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Old-Unique-ID", session->uuid_str);
|
||||
switch_core_hash_delete(session_manager.session_table, session->uuid_str);
|
||||
|
@ -1729,6 +1732,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_
|
|||
}
|
||||
|
||||
switch_channel_set_variable(session->channel, "uuid", session->uuid_str);
|
||||
switch_channel_set_variable(session->channel, "call_uuid", session->uuid_str);
|
||||
|
||||
session->endpoint_interface = endpoint_interface;
|
||||
session->raw_write_frame.data = session->raw_write_buf;
|
||||
|
|
|
@ -1221,6 +1221,11 @@ static void core_event_handler(switch_event_t *event)
|
|||
switch_event_get_header_nil(event, "unique-id"),
|
||||
switch_event_get_header_nil(event, "old-unique-id")
|
||||
);
|
||||
|
||||
new_sql() = switch_mprintf("update channels set call_uuid='%q' where call_uuid='%q'",
|
||||
switch_event_get_header_nil(event, "unique-id"),
|
||||
switch_event_get_header_nil(event, "old-unique-id")
|
||||
);
|
||||
break;
|
||||
}
|
||||
case SWITCH_EVENT_CHANNEL_CREATE:
|
||||
|
@ -1402,9 +1407,9 @@ static void core_event_handler(switch_event_t *event)
|
|||
b_uuid = switch_event_get_header_nil(event, "other-leg-unique-id");
|
||||
}
|
||||
|
||||
new_sql() = switch_mprintf("update channels set call_uuid='%q' where uuid='%s'",
|
||||
switch_event_get_header_nil(event, "channel-call-uuid"),
|
||||
switch_event_get_header_nil(event, "unique-id"));
|
||||
new_sql() = switch_mprintf("update channels set call_uuid='%q' where uuid='%s' or uuid='%s'",
|
||||
switch_event_get_header_nil(event, "channel-call-uuid"), a_uuid, b_uuid);
|
||||
|
||||
|
||||
new_sql() = switch_mprintf("insert into calls (call_uuid,call_created,call_created_epoch,"
|
||||
"caller_uuid,callee_uuid,hostname) "
|
||||
|
@ -1422,6 +1427,9 @@ static void core_event_handler(switch_event_t *event)
|
|||
{
|
||||
char *uuid = switch_event_get_header_nil(event, "caller-unique-id");
|
||||
|
||||
new_sql() = switch_mprintf("update channels set call_uuid=uuid where call_uuid='%s'",
|
||||
switch_event_get_header_nil(event, "channel-call-uuid"));
|
||||
|
||||
new_sql() = switch_mprintf("delete from calls where (caller_uuid='%q' or callee_uuid='%q')",
|
||||
uuid, uuid);
|
||||
break;
|
||||
|
|
|
@ -62,6 +62,7 @@ static void switch_core_standard_on_destroy(switch_core_session_t *session)
|
|||
|
||||
static void switch_core_standard_on_reset(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_set_variable(session->channel, "call_uuid", switch_core_session_get_uuid(session));
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard RESET\n", switch_channel_get_name(session->channel));
|
||||
}
|
||||
|
@ -76,6 +77,8 @@ static void switch_core_standard_on_routing(switch_core_session_t *session)
|
|||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard ROUTING\n", switch_channel_get_name(session->channel));
|
||||
|
||||
switch_channel_set_variable(session->channel, "call_uuid", switch_core_session_get_uuid(session));
|
||||
|
||||
if ((switch_channel_test_flag(session->channel, CF_ANSWERED) ||
|
||||
switch_channel_test_flag(session->channel, CF_EARLY_MEDIA) ||
|
||||
switch_channel_test_flag(session->channel, CF_SIGNAL_BRIDGE_TTL)) && switch_channel_test_flag(session->channel, CF_PROXY_MODE)) {
|
||||
|
@ -156,6 +159,8 @@ static void switch_core_standard_on_execute(switch_core_session_t *session)
|
|||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard EXECUTE\n", switch_channel_get_name(session->channel));
|
||||
|
||||
switch_channel_set_variable(session->channel, "call_uuid", switch_core_session_get_uuid(session));
|
||||
|
||||
if (switch_channel_get_variable(session->channel, "recovered") && !switch_channel_test_flag(session->channel, CF_RECOVERED)) {
|
||||
switch_channel_set_flag(session->channel, CF_RECOVERED);
|
||||
}
|
||||
|
|
|
@ -968,6 +968,7 @@ static switch_status_t signal_bridge_on_hangup(switch_core_session_t *session)
|
|||
|
||||
switch_channel_set_variable(other_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
|
||||
switch_channel_set_variable(other_channel, SWITCH_BRIDGE_VARIABLE, NULL);
|
||||
switch_channel_set_variable(other_channel, "call_uuid", switch_core_session_get_uuid(other_session));
|
||||
|
||||
if (switch_channel_up(other_channel)) {
|
||||
|
||||
|
@ -1044,6 +1045,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t *
|
|||
|
||||
switch_channel_set_variable(caller_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, switch_core_session_get_uuid(peer_session));
|
||||
switch_channel_set_variable(peer_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, switch_core_session_get_uuid(session));
|
||||
switch_channel_set_variable(peer_channel, "call_uuid", switch_core_session_get_uuid(session));
|
||||
|
||||
switch_channel_set_flag_recursive(caller_channel, CF_BRIDGE_ORIGINATOR);
|
||||
switch_channel_clear_flag(peer_channel, CF_BRIDGE_ORIGINATOR);
|
||||
|
@ -1152,6 +1154,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
|
|||
|
||||
switch_channel_set_state(peer_channel, CS_CONSUME_MEDIA);
|
||||
|
||||
switch_channel_set_variable(peer_channel, "call_uuid", switch_core_session_get_uuid(session));
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(session));
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", switch_core_session_get_uuid(peer_session));
|
||||
|
@ -1303,6 +1307,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
|
|||
|
||||
done:
|
||||
|
||||
switch_channel_set_variable(peer_channel, "call_uuid", switch_core_session_get_uuid(peer_session));
|
||||
|
||||
if (br && switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_event_set_data(caller_channel, event);
|
||||
switch_event_fire(&event);
|
||||
|
|
|
@ -1843,33 +1843,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||
}
|
||||
}
|
||||
|
||||
if (var_event) {
|
||||
switch_uuid_t uuid;
|
||||
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
|
||||
char *use_uuid;
|
||||
|
||||
if (caller_channel) {
|
||||
use_uuid = switch_core_session_get_uuid(session);
|
||||
} else {
|
||||
switch_uuid_get(&uuid);
|
||||
switch_uuid_format(uuid_str, &uuid);
|
||||
use_uuid = uuid_str;
|
||||
}
|
||||
|
||||
switch_event_del_header(var_event, "call_uuid");
|
||||
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "call_uuid", use_uuid);
|
||||
|
||||
if (caller_channel) {
|
||||
switch_channel_set_variable(caller_channel, "call_uuid", use_uuid);
|
||||
}
|
||||
}
|
||||
|
||||
if (caller_channel) {
|
||||
switch_channel_process_export(caller_channel, NULL, var_event, SWITCH_EXPORT_VARS_VARIABLE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* strip leading spaces */
|
||||
while (data && *data && *data == ' ') {
|
||||
data++;
|
||||
|
@ -2479,6 +2452,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||
|
||||
switch_channel_set_flag(originate_status[i].peer_channel, CF_ORIGINATING);
|
||||
|
||||
if (caller_channel) {
|
||||
switch_channel_set_variable(originate_status[i].peer_channel, "call_uuid", switch_channel_get_variable(caller_channel, "call_uuid"));
|
||||
}
|
||||
|
||||
|
||||
if ((lc = switch_event_get_header(var_event, "local_var_clobber"))) {
|
||||
local_clobber = switch_true(lc);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue