]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add recovery_refresh app and api and use it in mod_conference to send a message to...
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 29 Dec 2010 19:15:14 +0000 (13:15 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 29 Dec 2010 19:15:14 +0000 (13:15 -0600)
src/include/switch_types.h
src/mod/applications/mod_commands/mod_commands.c
src/mod/applications/mod_conference/mod_conference.c
src/mod/applications/mod_dptools/mod_dptools.c
src/mod/endpoints/mod_sofia/mod_sofia.c

index 830ea409e85b08069bef4d6c62acfeba863abaf2..bb5f59865fefb64c124c2cd1cde1fcc80dfb62b1 100644 (file)
@@ -791,6 +791,7 @@ typedef enum {
        SWITCH_MESSAGE_INDICATE_UDPTL_MODE,
        SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS,
        SWITCH_MESSAGE_INDICATE_JITTER_BUFFER,
+       SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH,
        SWITCH_MESSAGE_INVALID
 } switch_core_session_message_types_t;
 
index 1c2e3ebfb9ce4e9b0d2b568efd9bcc4c1b97ea2b..8daaace7f3989d40afc63142249373a2c8f560ff 100644 (file)
@@ -2226,6 +2226,40 @@ SWITCH_STANDARD_API(uuid_deflect)
        return SWITCH_STATUS_SUCCESS;
 }
 
+#define UUID_RECOVERY_REFRESH_SYNTAX "<uuid> <uri>"
+SWITCH_STANDARD_API(uuid_recovery_refresh)
+{
+       switch_core_session_t *tsession = NULL;
+       char *uuid = NULL, *text = NULL;
+
+       if (!zstr(cmd) && (uuid = strdup(cmd))) {
+               if ((text = strchr(uuid, ' '))) {
+                       *text++ = '\0';
+               }
+       }
+
+       if (zstr(uuid) || zstr(text)) {
+               stream->write_function(stream, "-USAGE: %s\n", UUID_RECOVERY_REFRESH_SYNTAX);
+       } else {
+               if ((tsession = switch_core_session_locate(uuid))) {
+                       switch_core_session_message_t msg = { 0 };
+
+                       /* Tell the channel to recovery_refresh the call */
+                       msg.from = __FILE__;
+                       msg.string_arg = text;
+                       msg.message_id = SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH;
+                       switch_core_session_receive_message(tsession, &msg);
+                       stream->write_function(stream, "+OK:%s\n", msg.string_reply);
+                       switch_core_session_rwunlock(tsession);
+               } else {
+                       stream->write_function(stream, "-ERR No Such Channel %s!\n", uuid);
+               }
+       }
+
+       switch_safe_free(uuid);
+       return SWITCH_STATUS_SUCCESS;
+}
+
 #define SCHED_TRANSFER_SYNTAX "[+]<time> <uuid> <extension> [<dialplan>] [<context>]"
 SWITCH_STANDARD_API(sched_transfer_function)
 {
@@ -4858,6 +4892,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
        SWITCH_ADD_API(commands_api_interface, "uuid_phone_event", "Send and event to the phone", uuid_phone_event_function, PHONE_EVENT_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "uuid_preprocess", "Pre-process Channel", preprocess_function, PREPROCESS_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "uuid_record", "session record", session_record_function, SESS_REC_SYNTAX);
+       SWITCH_ADD_API(commands_api_interface, "uuid_recovery_refresh", "Send a recovery_refresh", uuid_recovery_refresh, UUID_RECOVERY_REFRESH_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "uuid_recv_dtmf", "receive dtmf digits", uuid_recv_dtmf_function, UUID_RECV_DTMF_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "uuid_send_dtmf", "send dtmf digits", uuid_send_dtmf_function, UUID_SEND_DTMF_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "uuid_session_heartbeat", "uuid_session_heartbeat", uuid_session_heartbeat_function, HEARTBEAT_SYNTAX);
@@ -4983,6 +5018,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
        switch_console_set_complete("add uuid_phone_event ::console::list_uuid hold");
        switch_console_set_complete("add uuid_preprocess ::console::list_uuid");
        switch_console_set_complete("add uuid_record ::console::list_uuid ::[start:stop");
+       switch_console_set_complete("add uuid_recovery_refresh ::console::list_uuid");
        switch_console_set_complete("add uuid_recv_dtmf ::console::list_uuid");
        switch_console_set_complete("add uuid_send_dtmf ::console::list_uuid");
        switch_console_set_complete("add uuid_session_heartbeat ::console::list_uuid");
index bdf565952e5cab1921a86cdfc13e3f4fae97ea14..ead0bea6137d3dfa734a2ebc273dfab9ab8b4ef1 100644 (file)
@@ -4284,6 +4284,7 @@ static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switc
        switch_event_t *params = NULL;
        conference_obj_t *new_conference = NULL;
        int locked = 0;
+       switch_core_session_message_t msg = { 0 };
 
        switch_assert(conference != NULL);
        switch_assert(stream != NULL);
@@ -4409,6 +4410,11 @@ static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switc
 
                        switch_channel_set_variable(channel, "last_transfered_conference", argv[2]);
 
+                       /* Sync the recovery data */
+                       msg.from = __FILE__;
+                       msg.message_id = SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH;
+                       switch_core_session_receive_message(member->session, &msg);
+
                        unlock_member(member);
 
                        stream->write_function(stream, "OK Member '%d' sent to conference %s.\n", member->id, argv[2]);
index d5d0cb7576f153f0f40bea0c50352b53add465e7..6fbf70bdfd078b85b2c4492be2ed0548a9f8f956 100755 (executable)
@@ -1001,6 +1001,17 @@ SWITCH_STANDARD_APP(deflect_function)
        switch_core_session_receive_message(session, &msg);
 }
 
+SWITCH_STANDARD_APP(recovery_refresh_function)
+{
+       switch_core_session_message_t msg = { 0 };
+
+       /* Tell the channel to recovery_refresh the call */
+       msg.from = __FILE__;
+       msg.string_arg = data;
+       msg.message_id = SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH;
+       switch_core_session_receive_message(session, &msg);
+}
+
 
 SWITCH_STANDARD_APP(sched_cancel_function)
 {
@@ -3547,6 +3558,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
        SWITCH_ADD_APP(app_interface, "respond", "Send session respond", "Send a respond message to a session.", respond_function, "<respond_data>",
                                   SAF_SUPPORT_NOMEDIA);
        SWITCH_ADD_APP(app_interface, "deflect", "Send call deflect", "Send a call deflect.", deflect_function, "<deflect_data>", SAF_SUPPORT_NOMEDIA);
+       SWITCH_ADD_APP(app_interface, "recovery_refresh", "Send call recovery_refresh", "Send a call recovery_refresh.", recovery_refresh_function, "", SAF_SUPPORT_NOMEDIA);
        SWITCH_ADD_APP(app_interface, "queue_dtmf", "Queue dtmf to be sent", "Queue dtmf to be sent from a session", queue_dtmf_function, "<dtmf_data>",
                                   SAF_SUPPORT_NOMEDIA);
        SWITCH_ADD_APP(app_interface, "send_dtmf", "Send dtmf to be sent", "Send dtmf to be sent from a session", send_dtmf_function, "<dtmf_data>",
index af7149b8c8112e4e4ab7fae435b0f6f97fea47fc..6dda4a74f8fbed9ed66d97c0bac22065190191c7 100644 (file)
@@ -1319,6 +1319,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
 
        /* ones that do not need to lock sofia mutex */
        switch (msg->message_id) {
+       case SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH:
        case SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC:
                {
                        sofia_glue_tech_track(tech_pvt->profile, session);
@@ -1335,6 +1336,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                        }
                }
                break;
+
        case SWITCH_MESSAGE_INDICATE_JITTER_BUFFER:
                {
                        if (switch_rtp_ready(tech_pvt->rtp_session)) {