]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
put caller back into the fifo if the agent hangs up before they are bridged
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 17 Apr 2012 21:12:14 +0000 (16:12 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 17 Apr 2012 21:12:14 +0000 (16:12 -0500)
src/mod/applications/mod_fifo/mod_fifo.c

index 3d99740e6825590bef002599acc90c514f12e6f8..8b4905f60c59dc7053ce0f7153649828576e3c80 100644 (file)
@@ -2926,12 +2926,27 @@ SWITCH_STANDARD_APP(fifo_function)
                                if (!(switch_channel_ready(channel))) {
                                        const char *app = switch_channel_get_variable(other_channel, "current_application");
                                        const char *arg = switch_channel_get_variable(other_channel, "current_application_data");
-                                       switch_caller_extension_t *extension = NULL;
+                                       switch_caller_extension_t *extension = NULL;                
 
-                                       send_presence(node);
-                                       check_cancel(node);
 
+                                       switch_channel_set_variable_printf(channel, "last_sent_callee_id_name", "%s (AGENT FAIL)", 
+                                                                                                          switch_channel_get_variable(other_channel, "caller_id_name"));
+                                       switch_channel_set_variable(channel, "last_sent_callee_id_number", switch_channel_get_variable(other_channel, "caller_id_number"));
+
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, 
+                                                                         "Customer %s %s [%s] appears to be abandoned by agent %s [%s] "
+                                                                         "but is still on the line, redirecting them back to the queue with VIP status.\n",
+                                                                         switch_channel_get_name(other_channel), 
+                                                                         switch_channel_get_variable(other_channel, "caller_id_name"), 
+                                                                         switch_channel_get_variable(other_channel, "caller_id_number"),
+                                                                         switch_channel_get_variable(channel, "caller_id_name"),
+                                                                         switch_channel_get_variable(channel, "caller_id_number"));
+
+                                       switch_channel_wait_for_state_timeout(other_channel, CS_HIBERNATE, 5000);
 
+                                       send_presence(node);
+                                       check_cancel(node);
+                                       
                                        if (app) {
                                                extension = switch_caller_extension_new(other_session, app, arg);
                                                switch_caller_extension_add_application(other_session, extension, app, arg);
@@ -2940,6 +2955,7 @@ SWITCH_STANDARD_APP(fifo_function)
                                        } else {
                                                switch_channel_hangup(other_channel, SWITCH_CAUSE_NORMAL_CLEARING);
                                        }
+                                       switch_channel_set_variable(other_channel, "fifo_vip", "true");
 
                                        switch_core_session_rwunlock(other_session);
                                        break;
@@ -3098,6 +3114,7 @@ SWITCH_STANDARD_APP(fifo_function)
 
                                send_presence(node);
                                check_cancel(node);
+
                                switch_core_session_rwunlock(other_session);
 
 
@@ -3230,7 +3247,6 @@ SWITCH_STANDARD_APP(fifo_function)
        switch_channel_clear_app_flag_key(FIFO_APP_KEY, channel, FIFO_APP_BRIDGE_TAG);
 
        switch_core_media_bug_resume(session);
-
 }
 
 struct xml_helper {