SWITCH_STANDARD_API(break_function)
{
switch_core_session_t *psession = NULL;
- char *mycmd, *flag;
+ char *mycmd = NULL, *flag;
switch_channel_t *channel = NULL;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
if (switch_strlen_zero(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", BREAK_SYNTAX);
- return SWITCH_STATUS_SUCCESS;
+ goto done;
}
mycmd = strdup(cmd);
if (!(psession = switch_core_session_locate(mycmd))) {
stream->write_function(stream, "-ERR No Such Channel!\n");
- return SWITCH_STATUS_SUCCESS;
+ goto done;
}
if (flag && !strcasecmp(flag, "all")) {
} else {
switch_channel_set_flag(channel, CF_BREAK);
}
- switch_core_session_rwunlock(psession);
- return SWITCH_STATUS_SUCCESS;
+ done:
+ if (psession) {
+ switch_core_session_rwunlock(psession);
+ }
+
+ switch_safe_free(mycmd);
+
+ return status;
}
#define PAUSE_SYNTAX "<uuid> <on|off>"
if (api_task->recur) {
task->runtime = switch_epoch_time_now(NULL) + api_task->recur;
}
-
-
}
#define UNSCHED_SYNTAX "<task_id>"
if ((dcmd = strchr(group, ' '))) {
*dcmd++ = '\0';
-
if (*tm == '+') {
when = switch_epoch_time_now(NULL) + atol(tm + 1);
} else if (*tm == '@') {
char *arg;
switch_memory_pool_t *pool;
- if (!job)
+ if (!job) {
return NULL;
+ }
switch_thread_rwlock_rdlock(bgapi_rwlock);
#define COMPLETE_SYNTAX "add <word>|del [<word>|*]"
SWITCH_STANDARD_API(complete_function)
{
-
switch_status_t status;
if ((status = switch_console_set_complete(cmd)) == SWITCH_STATUS_SUCCESS) {
#define ALIAS_SYNTAX "add <alias> <command> | del [<alias>|*]"
SWITCH_STANDARD_API(alias_function)
{
-
switch_status_t status;
if ((status = switch_console_set_alias(cmd)) == SWITCH_STATUS_SUCCESS) {
switch_safe_free(mycmd);
stream->write_function(stream, "-ERR Usage: uuid_session_heartbeat %s", HEARTBEAT_SYNTAX);
return SWITCH_STATUS_SUCCESS;
-
}
SWITCH_STANDARD_API(uuid_flush_dtmf_function)
usage:
stream->write_function(stream, "-USAGE: %s\n", UUID_SEND_DTMF_SYNTAX);
- switch_safe_free(mycmd);
done:
if (psession) {
#define GLOBAL_GETVAR_SYNTAX "<var>"
SWITCH_STANDARD_API(global_getvar_function)
{
-
if (switch_strlen_zero(cmd)) {
switch_core_dump_variables(stream);
} else {
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_commands_shutdown)
{
int x;
-
for (x = 30; x > 0; x--) {
if (switch_thread_rwlock_trywrlock(bgapi_rwlock) == SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_SUCCESS;
}
-
SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
{
switch_api_interface_t *commands_api_interface;