FS-7758 #resolve

emit an event if a loopback bowout occurs
This commit is contained in:
karl anderson 2015-04-02 19:05:13 -04:00 committed by Luis Azedo
parent c6ccf1c513
commit e336ca8c37
1 changed files with 8 additions and 0 deletions

View File

@ -458,6 +458,8 @@ static switch_status_t channel_on_execute(switch_core_session_t *session)
switch_core_session_t *other_session = NULL;
switch_caller_profile_t *cp, *clone;
const char *other_uuid = NULL;
switch_event_t *event = NULL;
switch_set_flag(tech_pvt, TFLAG_BOWOUT);
if ((find_non_loopback_bridge(tech_pvt->other_session, &other_session, &other_uuid) == SWITCH_STATUS_SUCCESS)) {
@ -468,6 +470,12 @@ static switch_status_t channel_on_execute(switch_core_session_t *session)
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_INFO, "BOWOUT Replacing loopback channel with real channel: %s\n",
switch_channel_get_name(other_channel));
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, "loopback::bowout") == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Resigning-UUID", switch_channel_get_uuid(channel));
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Acquired-UUID", switch_channel_get_uuid(other_channel));
switch_event_fire(&event);
}
if ((cp = switch_channel_get_caller_profile(channel))) {
clone = switch_caller_profile_clone(other_session, cp);
clone->originator_caller_profile = NULL;