update call_uuid stuff

This commit is contained in:
Anthony Minessale
2011-08-04 01:04:21 -05:00
parent 8caef22b6c
commit b946ee94b2
6 changed files with 33 additions and 30 deletions

View File

@@ -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;