]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7758 #resolve
authorkarl anderson <karl@2600hz.com>
Thu, 2 Apr 2015 23:05:13 +0000 (19:05 -0400)
committerLuis Azedo <luis@2600hz.com>
Thu, 2 Jul 2015 15:28:54 +0000 (16:28 +0100)
emit an event if a loopback bowout occurs

src/mod/endpoints/mod_loopback/mod_loopback.c

index 6724b0cea2237fb08d606b2de92822d2c4c5f172..7f8d7a6284f1cbbd50fa407cf95e0519ee8aa9ad 100644 (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;