]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
tweak to confirm blind transfer patch
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 9 May 2012 00:33:53 +0000 (19:33 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 9 May 2012 00:33:53 +0000 (19:33 -0500)
src/include/switch_ivr.h
src/mod/applications/mod_dptools/mod_dptools.c
src/switch_core_state_machine.c
src/switch_ivr.c

index 9d3d5f2ea531097957e0901fe49340f5beb0bd46..9299c584d9e96da441283f7524473712eb605169 100644 (file)
@@ -970,6 +970,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_insert_file(switch_core_session_t *se
 SWITCH_DECLARE(switch_status_t) switch_ivr_create_message_reply(switch_event_t **reply, switch_event_t *message, const char *new_proto);
 SWITCH_DECLARE(char *) switch_ivr_check_presence_mapping(const char *exten_name, const char *domain_name);
 SWITCH_DECLARE(switch_status_t) switch_ivr_kill_uuid(const char *uuid, switch_call_cause_t cause);
+SWITCH_DECLARE(switch_status_t) switch_ivr_blind_transfer_ack(switch_core_session_t *session, switch_bool_t success);
 
 /** @} */
 
index 8ae6e6f221a7cf2b847c01e9990afb42928013fc..b07f1a21ed344dddbce55643347beff1ea0d0b9a 100755 (executable)
@@ -4464,28 +4464,13 @@ static char *file_string_supported_formats[SWITCH_MAX_CODECS] = { 0 };
 
 SWITCH_STANDARD_APP(blind_transfer_ack_function)
 {
-       switch_channel_t *channel = switch_core_session_get_channel(session);
        switch_bool_t val = 0;
 
        if (data) {
                val = switch_true((char *) val);
        }
 
-       if (switch_channel_test_flag(channel, CF_CONFIRM_BLIND_TRANSFER)) {
-               switch_core_session_t *other_session;
-               const char *uuid = switch_channel_get_variable(channel, "blind_transfer_uuid");
-
-               switch_channel_clear_flag(channel, CF_CONFIRM_BLIND_TRANSFER);
-
-               if (!zstr(uuid) && (other_session = switch_core_session_locate(uuid))) {
-                       switch_core_session_message_t msg = { 0 };                      
-                       msg.message_id = SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE;
-                       msg.from = __FILE__;
-                       msg.numeric_arg = val;
-                       switch_core_session_receive_message(other_session, &msg);
-                       switch_core_session_rwunlock(other_session);
-               }
-       }
+       switch_ivr_blind_transfer_ack(session, val);
 }
 
 
index 61fa9290e546649f6cb24f7909990ca0d3c57d4d..e567daa9fb3647373700bd2cdbe80cd65fa66600 100644 (file)
@@ -174,8 +174,11 @@ static void switch_core_standard_on_routing(switch_core_session_t *session)
        }
 
        if (!extension) {
-               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "No Route, Aborting\n");
-               switch_channel_hangup(session->channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
+
+               if (switch_ivr_blind_transfer_ack(session, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS) {
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "No Route, Aborting\n");
+                       switch_channel_hangup(session->channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
+               }
        }
 
   end:
index 7a24eff1935beaed5d6e1bd1f4789a9dabf8043c..325a8083a2c63dab643cfb237ee615b4300d1ae3 100644 (file)
@@ -3501,6 +3501,31 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_kill_uuid(const char *uuid, switch_ca
        }
 }
 
+SWITCH_DECLARE(switch_status_t) switch_ivr_blind_transfer_ack(switch_core_session_t *session, switch_bool_t success)
+{
+       switch_channel_t *channel = switch_core_session_get_channel(session);
+       switch_status_t status = SWITCH_STATUS_FALSE;
+
+       if (switch_channel_test_flag(channel, CF_CONFIRM_BLIND_TRANSFER)) {
+               switch_core_session_t *other_session;
+               const char *uuid = switch_channel_get_variable(channel, "blind_transfer_uuid");
+
+               switch_channel_clear_flag(channel, CF_CONFIRM_BLIND_TRANSFER);
+
+               if (!zstr(uuid) && (other_session = switch_core_session_locate(uuid))) {
+                       switch_core_session_message_t msg = { 0 };                      
+                       msg.message_id = SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE;
+                       msg.from = __FILE__;
+                       msg.numeric_arg = success;
+                       switch_core_session_receive_message(other_session, &msg);
+                       switch_core_session_rwunlock(other_session);
+                       status = SWITCH_STATUS_SUCCESS;
+               }
+       }
+
+       return status;
+
+}
 
 /* For Emacs:
  * Local Variables: