|
|
@ -174,10 +174,14 @@ struct ast_custom_function regex_function = {
|
|
|
|
|
|
|
|
|
|
|
|
static void builtin_function_array(struct ast_channel *chan, char *cmd, char *data, const char *value)
|
|
|
|
static void builtin_function_array(struct ast_channel *chan, char *cmd, char *data, const char *value)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char *varv[100];
|
|
|
|
AST_DECLARE_APP_ARGS(arg1,
|
|
|
|
char *valuev[100];
|
|
|
|
AST_APP_ARG(var)[100];
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
AST_DECLARE_APP_ARGS(arg2,
|
|
|
|
|
|
|
|
AST_APP_ARG(val)[100];
|
|
|
|
|
|
|
|
);
|
|
|
|
char *var, *value2;
|
|
|
|
char *var, *value2;
|
|
|
|
int varcount, valuecount, i;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
|
|
var = ast_strdupa(data);
|
|
|
|
var = ast_strdupa(data);
|
|
|
|
value2 = ast_strdupa(value);
|
|
|
|
value2 = ast_strdupa(value);
|
|
|
@ -192,25 +196,27 @@ static void builtin_function_array(struct ast_channel *chan, char *cmd, char *da
|
|
|
|
* want them to be surprised by the result. Hence, we prefer commas as the
|
|
|
|
* want them to be surprised by the result. Hence, we prefer commas as the
|
|
|
|
* delimiter, but we'll fall back to vertical bars if commas aren't found.
|
|
|
|
* delimiter, but we'll fall back to vertical bars if commas aren't found.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
ast_log(LOG_ERROR, "arrary (%s=%s)\n", var, value2);
|
|
|
|
if (strchr(var, ',')) {
|
|
|
|
if (strchr(var, ',')) {
|
|
|
|
varcount = ast_app_separate_args(var, ',', varv, 100);
|
|
|
|
AST_NONSTANDARD_APP_ARGS(arg1, var, ',');
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
varcount = ast_app_separate_args(var, '|', varv, 100);
|
|
|
|
AST_STANDARD_APP_ARGS(arg1, var);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (strchr(value2, ',')) {
|
|
|
|
if (strchr(value2, ',')) {
|
|
|
|
valuecount = ast_app_separate_args(value2, ',', valuev, 100);
|
|
|
|
AST_NONSTANDARD_APP_ARGS(arg2, value2, ',');
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
valuecount = ast_app_separate_args(value2, '|', valuev, 100);
|
|
|
|
AST_STANDARD_APP_ARGS(arg2, value2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < varcount; i++) {
|
|
|
|
for (i = 0; i < arg1.argc; i++) {
|
|
|
|
if (i < valuecount) {
|
|
|
|
ast_log(LOG_ERROR, "arrary set value (%s=%s)\n", arg1.var[i], arg2.val[i]);
|
|
|
|
pbx_builtin_setvar_helper(chan, varv[i], valuev[i]);
|
|
|
|
if (i < arg2.argc) {
|
|
|
|
|
|
|
|
pbx_builtin_setvar_helper(chan, arg1.var[i], arg2.val[i]);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
/* We could unset the variable, by passing a NULL, but due to
|
|
|
|
/* We could unset the variable, by passing a NULL, but due to
|
|
|
|
* pushvar semantics, that could create some undesired behavior. */
|
|
|
|
* pushvar semantics, that could create some undesired behavior. */
|
|
|
|
pbx_builtin_setvar_helper(chan, varv[i], "");
|
|
|
|
pbx_builtin_setvar_helper(chan, arg1.var[i], "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|