]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add video_refresh dp and uuid_video_refresh fsapi
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 9 May 2012 14:06:21 +0000 (09:06 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 9 May 2012 14:06:21 +0000 (09:06 -0500)
src/mod/applications/mod_commands/mod_commands.c
src/mod/applications/mod_dptools/mod_dptools.c

index a812c8b994ef5280d694090aa82a00d71c50502a..470c7b02c9fdc63247ed457ccce495267f7cca6b 100644 (file)
@@ -3089,6 +3089,45 @@ SWITCH_STANDARD_API(uuid_send_info_function)
 }
 
 
+#define VIDEO_REFRESH_SYNTAX "<uuid>"
+SWITCH_STANDARD_API(uuid_video_refresh_function)
+{
+       switch_status_t status = SWITCH_STATUS_FALSE;
+       char *mycmd = NULL, *argv[2] = { 0 };
+       int argc = 0;
+
+       if (!zstr(cmd) && (mycmd = strdup(cmd))) {
+               argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+       }
+
+       if (argc < 1) {
+               stream->write_function(stream, "-USAGE: %s\n", VIDEO_REFRESH_SYNTAX);
+       } else {
+               switch_core_session_message_t msg = { 0 };
+               switch_core_session_t *lsession = NULL;
+
+               msg.message_id = SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ;
+               msg.string_array_arg[2] = argv[1];
+               msg.from = __FILE__;
+
+               if ((lsession = switch_core_session_locate(argv[0]))) {
+                       status = switch_core_session_receive_message(lsession, &msg);
+                       switch_core_session_rwunlock(lsession);
+               }
+       }
+
+       if (status == SWITCH_STATUS_SUCCESS) {
+               stream->write_function(stream, "+OK Success\n");
+       } else {
+               stream->write_function(stream, "-ERR Operation Failed\n");
+       }
+
+       switch_safe_free(mycmd);
+
+       return SWITCH_STATUS_SUCCESS;
+}
+
+
 #define DEBUG_AUDIO_SYNTAX "<uuid> <read|write|both> <on|off>"
 SWITCH_STANDARD_API(uuid_debug_audio_function)
 {
@@ -5436,6 +5475,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
        SWITCH_ADD_API(commands_api_interface, "uuid_hold", "hold", uuid_hold_function, HOLD_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "uuid_kill", "Kill Channel", kill_function, KILL_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "uuid_send_info", "Send info to the endpoint", uuid_send_info_function, INFO_SYNTAX);
+       SWITCH_ADD_API(commands_api_interface, "uuid_video_refresh", "Send video refresh.", uuid_video_refresh_function, VIDEO_REFRESH_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "uuid_outgoing_answer", "Answer Outgoing Channel", outgoing_answer_function, OUTGOING_ANSWER_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "uuid_limit", "Increase limit resource", uuid_limit_function, LIMIT_SYNTAX);
        SWITCH_ADD_API(commands_api_interface, "uuid_limit_release", "Release limit resource", uuid_limit_release_function, LIMIT_RELEASE_SYNTAX);
index 7cf262acbe98fa1be5517910f7c70368612bc5be..0e441dc731d22cbd84f7363e90d0806eaed7ff24 100755 (executable)
@@ -1185,6 +1185,17 @@ SWITCH_STANDARD_APP(redirect_function)
        switch_core_session_receive_message(session, &msg);
 }
 
+SWITCH_STANDARD_APP(video_refresh_function)
+{
+       switch_core_session_message_t msg = { 0 };
+
+       /* Tell the channel to refresh video */
+       msg.from = __FILE__;
+       msg.string_arg = data;
+       msg.message_id = SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ;
+       switch_core_session_receive_message(session, &msg);
+}
+
 SWITCH_STANDARD_APP(send_info_function)
 {
        switch_core_session_message_t msg = { 0 };
@@ -4633,6 +4644,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
        SWITCH_ADD_APP(app_interface, "ivr", "Run an ivr menu", "Run an ivr menu.", ivr_application_function, "<menu_name>", SAF_NONE);
        SWITCH_ADD_APP(app_interface, "redirect", "Send session redirect", "Send a redirect message to a session.", redirect_function, "<redirect_data>",
                                   SAF_SUPPORT_NOMEDIA);
+       SWITCH_ADD_APP(app_interface, "video_refresh", "Send video refresh.", "Send video refresh.", video_refresh_function, "",
+                                  SAF_SUPPORT_NOMEDIA);
        SWITCH_ADD_APP(app_interface, "send_info", "Send info", "Send info", send_info_function, "<info>", SAF_SUPPORT_NOMEDIA);
        SWITCH_ADD_APP(app_interface, "jitterbuffer", "Send session jitterbuffer", "Send a jitterbuffer message to a session.", 
                                   jitterbuffer_function, "<jitterbuffer_data>", SAF_SUPPORT_NOMEDIA);