diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index b481ca9f05..4fec5c3269 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -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 " " +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 " [] []" 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, diff --git a/src/switch_channel.c b/src/switch_channel.c index f823b22e49..5606d81fe0 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -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; diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 03f9839f78..314b41a5ed 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -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);