put presence-data in events

This commit is contained in:
Anthony Minessale
2012-05-10 12:15:25 -05:00
parent 921de9446f
commit e54ab070f4
5 changed files with 92 additions and 10 deletions

View File

@@ -968,9 +968,16 @@ static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session
if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) {
switch_core_session_t *other_session;
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", msg.string_arg);
switch_channel_event_set_data(channel, event);
if ((other_session = switch_core_session_locate(msg.string_arg))) {
switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
switch_event_add_presence_data_cols(other_channel, event, "Bridge-B-PD-");
switch_core_session_rwunlock(other_session);
}
switch_event_fire(&event);
}
}
@@ -1052,16 +1059,27 @@ static switch_status_t signal_bridge_on_hangup(switch_core_session_t *session)
}
}
switch_core_session_rwunlock(other_session);
}
if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
switch_channel_clear_flag_recursive(channel, CF_BRIDGE_ORIGINATOR);
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == 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", uuid);
switch_event_add_presence_data_cols(other_channel, event, "Bridge-B-PD-");
switch_channel_event_set_data(channel, event);
switch_event_fire(&event);
}
}
if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
switch_channel_clear_flag_recursive(channel, CF_BRIDGE_ORIGINATOR);
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == 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", uuid);
switch_channel_event_set_data(channel, event);
switch_event_fire(&event);
switch_core_session_rwunlock(other_session);
} else {
if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
switch_channel_clear_flag_recursive(channel, CF_BRIDGE_ORIGINATOR);
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == 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", uuid);
switch_channel_event_set_data(channel, event);
switch_event_fire(&event);
}
}
}
@@ -1242,6 +1260,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
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));
switch_channel_event_set_data(caller_channel, event);
switch_event_add_presence_data_cols(peer_channel, event, "Bridge-B-PD-");
switch_event_fire(&event);
br = 1;
}
@@ -1425,6 +1444,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
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));
switch_channel_event_set_data(caller_channel, event);
switch_event_add_presence_data_cols(peer_channel, event, "Bridge-B-PD-");
switch_event_fire(&event);
}