parse only uuid specific presence data cols on bridge

This commit is contained in:
Anthony Minessale 2012-01-02 12:22:18 -06:00
parent bd87b188ab
commit 309c963dc7
1 changed files with 17 additions and 17 deletions

View File

@ -1421,24 +1421,25 @@ static void core_event_handler(switch_event_t *event)
} }
case SWITCH_EVENT_CHANNEL_BRIDGE: case SWITCH_EVENT_CHANNEL_BRIDGE:
{ {
const char *a_uuid, *b_uuid; const char *a_uuid, *b_uuid, *uuid;
a_uuid = switch_event_get_header(event, "Bridge-A-Unique-ID"); a_uuid = switch_event_get_header(event, "Bridge-A-Unique-ID");
b_uuid = switch_event_get_header(event, "Bridge-B-Unique-ID"); b_uuid = switch_event_get_header(event, "Bridge-B-Unique-ID");
uuid = switch_event_get_header(event, "unique-id");
if (zstr(a_uuid) || zstr(b_uuid)) { if (zstr(a_uuid) || zstr(b_uuid)) {
a_uuid = switch_event_get_header_nil(event, "caller-unique-id"); a_uuid = switch_event_get_header_nil(event, "caller-unique-id");
b_uuid = switch_event_get_header_nil(event, "other-leg-unique-id"); b_uuid = switch_event_get_header_nil(event, "other-leg-unique-id");
} }
if ((extra_cols = parse_presence_data_cols(event))) { if (uuid && (extra_cols = parse_presence_data_cols(event))) {
new_sql() = switch_mprintf("update channels set call_uuid='%q',%s where uuid='%s' or uuid='%s'", new_sql() = switch_mprintf("update channels set %s where uuid='%s'", extra_cols, uuid);
switch_event_get_header_nil(event, "channel-call-uuid"), extra_cols, a_uuid, b_uuid);
free(extra_cols); free(extra_cols);
} else { }
new_sql() = switch_mprintf("update channels set call_uuid='%q' where uuid='%s' or uuid='%s'",
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); 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," new_sql() = switch_mprintf("insert into calls (call_uuid,call_created,call_created_epoch,"
"caller_uuid,callee_uuid,hostname) " "caller_uuid,callee_uuid,hostname) "
@ -1454,20 +1455,19 @@ static void core_event_handler(switch_event_t *event)
break; break;
case SWITCH_EVENT_CHANNEL_UNBRIDGE: case SWITCH_EVENT_CHANNEL_UNBRIDGE:
{ {
char *uuid = switch_event_get_header_nil(event, "caller-unique-id"); char *cuuid = switch_event_get_header_nil(event, "caller-unique-id");
char *uuid = switch_event_get_header(event, "unique-id");
if ((extra_cols = parse_presence_data_cols(event))) { if (uuid && (extra_cols = parse_presence_data_cols(event))) {
new_sql() = switch_mprintf("update channels set call_uuid=uuid,%s where call_uuid='%s'", new_sql() = switch_mprintf("update channels set %s where uuid='%s'", extra_cols, uuid);
extra_cols,
switch_event_get_header_nil(event, "channel-call-uuid"));
free(extra_cols); free(extra_cols);
} else { }
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("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')", new_sql() = switch_mprintf("delete from calls where (caller_uuid='%q' or callee_uuid='%q')",
uuid, uuid); cuuid, cuuid);
break; break;
} }
case SWITCH_EVENT_SHUTDOWN: case SWITCH_EVENT_SHUTDOWN: