mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-13 12:40:17 +00:00
line endings.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5608 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
15beec4895
commit
77d753fe8b
@ -1281,51 +1281,51 @@ SWITCH_STANDARD_API(help_function)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#define SETVAR_SYNTAX "<uuid> <var> <value>"
|
||||
SWITCH_STANDARD_API(uuid_setvar_function)
|
||||
{
|
||||
switch_core_session_t *psession = NULL;
|
||||
char *mycmd = NULL, *argv[3] = { 0 };
|
||||
int argc = 0;
|
||||
|
||||
if (session) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
|
||||
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||
if (argc == 3) {
|
||||
char *uuid = argv[0];
|
||||
char *var_name = argv[1];
|
||||
char *var_value = argv[2];
|
||||
|
||||
if ((psession = switch_core_session_locate(uuid))) {
|
||||
switch_channel_t *channel;
|
||||
channel = switch_core_session_get_channel(psession);
|
||||
|
||||
assert(channel != NULL);
|
||||
|
||||
if (switch_strlen_zero(var_name)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No variable name specified.\n");
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SET [%s]=[%s]\n", var_name, var_value ? var_value : "UNDEF");
|
||||
switch_channel_set_variable(channel, var_name, var_value);
|
||||
}
|
||||
|
||||
switch_core_session_rwunlock(psession);
|
||||
|
||||
} else {
|
||||
stream->write_function(stream, "No Such Channel!\n");
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
stream->write_function(stream, "USAGE: %s\n", SETVAR_SYNTAX);
|
||||
|
||||
done:
|
||||
switch_safe_free(mycmd);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
#define SETVAR_SYNTAX "<uuid> <var> <value>"
|
||||
SWITCH_STANDARD_API(uuid_setvar_function)
|
||||
{
|
||||
switch_core_session_t *psession = NULL;
|
||||
char *mycmd = NULL, *argv[3] = { 0 };
|
||||
int argc = 0;
|
||||
|
||||
if (session) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
|
||||
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||
if (argc == 3) {
|
||||
char *uuid = argv[0];
|
||||
char *var_name = argv[1];
|
||||
char *var_value = argv[2];
|
||||
|
||||
if ((psession = switch_core_session_locate(uuid))) {
|
||||
switch_channel_t *channel;
|
||||
channel = switch_core_session_get_channel(psession);
|
||||
|
||||
assert(channel != NULL);
|
||||
|
||||
if (switch_strlen_zero(var_name)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No variable name specified.\n");
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SET [%s]=[%s]\n", var_name, var_value ? var_value : "UNDEF");
|
||||
switch_channel_set_variable(channel, var_name, var_value);
|
||||
}
|
||||
|
||||
switch_core_session_rwunlock(psession);
|
||||
|
||||
} else {
|
||||
stream->write_function(stream, "No Such Channel!\n");
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
stream->write_function(stream, "USAGE: %s\n", SETVAR_SYNTAX);
|
||||
|
||||
done:
|
||||
switch_safe_free(mycmd);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
|
||||
|
Loading…
x
Reference in New Issue
Block a user