]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-4625 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 20 Sep 2012 14:57:58 +0000 (09:57 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 20 Sep 2012 14:57:58 +0000 (09:57 -0500)
src/mod/applications/mod_dptools/mod_dptools.c
src/switch_channel.c
src/switch_ivr_async.c

index b481ca9f0560b7e3342e06cd0f5ae1ca86da887a..4fec5c32697a1b445e1a5d7062b00d0a89a19327 100755 (executable)
@@ -567,6 +567,22 @@ SWITCH_STANDARD_APP(mkdir_function)
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s MKDIR: %s\n",
                                          switch_channel_get_name(switch_core_session_get_channel(session)), data);
 }
+#define RENAME_SYNTAX "<from_path> <to_path>"
+SWITCH_STANDARD_APP(rename_function)
+{
+       char *argv[2] = { 0 };
+       char *lbuf = NULL;
+
+       if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
+               && switch_split(lbuf, ' ', argv) == 2) {
+               switch_file_rename(argv[0], argv[1], switch_core_session_get_pool(session));
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s RENAME: %s %s\n",
+                                                 switch_channel_get_name(switch_core_session_get_channel(session)), argv[0], argv[1]);
+       
+       } else {
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", RENAME_SYNTAX);
+       }
+}
 
 #define SOFT_HOLD_SYNTAX "<unhold key> [<moh_a>] [<moh_b>]"
 SWITCH_STANDARD_APP(soft_hold_function)
@@ -5103,6 +5119,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
        SWITCH_ADD_APP(app_interface, "enable_heartbeat", "Enable Media Heartbeat", "Enable Media Heartbeat",
                                   heartbeat_function, HEARTBEAT_SYNTAX, SAF_SUPPORT_NOMEDIA);
        SWITCH_ADD_APP(app_interface, "mkdir", "Create a directory", "Create a directory", mkdir_function, MKDIR_SYNTAX, SAF_SUPPORT_NOMEDIA);
+       SWITCH_ADD_APP(app_interface, "rename", "Rename file", "Rename file", rename_function, RENAME_SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC);
        SWITCH_ADD_APP(app_interface, "soft_hold", "Put a bridged channel on hold", "Put a bridged channel on hold", soft_hold_function, SOFT_HOLD_SYNTAX,
                                   SAF_NONE);
        SWITCH_ADD_APP(app_interface, "bind_meta_app", "Bind a key to an application", "Bind a key to an application", dtmf_bind_function, BIND_SYNTAX,
index f823b22e498f7a6e7d53a7183c5737ebe0eb3149..5606d81fe0af5ada94b4e8a7d8a64518a673918a 100644 (file)
@@ -3274,7 +3274,7 @@ static void do_execute_on(switch_channel_t *channel, const char *variable)
        app = switch_core_session_strdup(channel->session, variable);
        
        for(p = app; p && *p; p++) {
-               if (*p == ' ') {
+               if (*p == ' ' || (*p == ':' && (*(p+1) != ':'))) {
                        *p++ = '\0';
                        arg = p;
                        break;
index 03f9839f7866657597b3f80556f520e15b23641d..314b41a5ed85741368eb486018831ae29e185cca 100644 (file)
@@ -1083,16 +1083,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
                                switch_event_fire(&event);
                        }
 
-                       if ((var = switch_channel_get_variable(channel, "record_post_process_exec_app"))) {
-                               char *app = switch_core_session_strdup(session, var);
-                               char *data;
-
-                               if ((data = strchr(app, ':'))) {
-                                       *data++ = '\0';
-                               }
-
-                               switch_core_session_execute_application(session, app, data);
-                       }
+                       switch_channel_execute_on(channel, "record_post_process_exec_app");
 
                        if ((var = switch_channel_get_variable(channel, "record_post_process_exec_api"))) {
                                char *cmd = switch_core_session_strdup(session, var);