FS-7750 #resolve
This commit is contained in:
parent
3533c653c4
commit
3274853b00
|
@ -5463,7 +5463,7 @@ SWITCH_STANDARD_API(uuid_setvar_function)
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
|
||||||
stream->write_function(stream, "-ERR No variable specified\n");
|
stream->write_function(stream, "-ERR No variable specified\n");
|
||||||
} else {
|
} else {
|
||||||
switch_channel_set_variable(channel, var_name, var_value);
|
switch_channel_add_variable_var_check(channel, var_name, var_value, SWITCH_FALSE, SWITCH_STACK_BOTTOM);
|
||||||
stream->write_function(stream, "+OK\n");
|
stream->write_function(stream, "+OK\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5572,7 +5572,24 @@ SWITCH_STANDARD_API(uuid_getvar_function)
|
||||||
stream->write_function(stream, "-ERR No variable name specified!\n");
|
stream->write_function(stream, "-ERR No variable name specified!\n");
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
|
||||||
} else {
|
} else {
|
||||||
|
if (strchr(var_name, '[')) {
|
||||||
|
char *ptr = NULL;
|
||||||
|
int idx = -1;
|
||||||
|
char *vname = strdup(var_name);
|
||||||
|
|
||||||
|
if ((ptr = strchr(vname, '[')) && strchr(ptr, ']')) {
|
||||||
|
*ptr++ = '\0';
|
||||||
|
idx = atoi(ptr);
|
||||||
|
var_value = switch_channel_get_variable_dup(channel, vname, SWITCH_TRUE, idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(vname);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!var_value) {
|
||||||
var_value = switch_channel_get_variable(channel, var_name);
|
var_value = switch_channel_get_variable(channel, var_name);
|
||||||
|
}
|
||||||
|
|
||||||
if (var_value != NULL) {
|
if (var_value != NULL) {
|
||||||
stream->write_function(stream, "%s", var_value);
|
stream->write_function(stream, "%s", var_value);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue