dect
/
asterisk
Archived
13
0
Fork 0

Make HASHes inheritable across channel creation.

git-svn-id: http://svn.digium.com/svn/asterisk/trunk@241012 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
tilghman 2010-01-18 19:26:07 +00:00
parent 5f69fa847c
commit 7e17adbbd8
2 changed files with 22 additions and 2 deletions

View File

@ -183,6 +183,9 @@ Dialplan Functions
* Added PASSTHRU, which literally passes the same argument back as its return
value. The intent is to be able to use a literal string argument to
functions that currently require a variable name as an argument.
* HASH-associated variables now can be inherited across channel creation, by
prefixing the name of the hash at assignment with the appropriate number of
underscores, just like variables.
Dialplan Variables
------------------

View File

@ -831,7 +831,16 @@ static int array(struct ast_channel *chan, const char *cmd, char *var,
arg2.val[i]);
if (i < arg2.argc) {
if (ishash) {
snprintf(varname, sizeof(varname), HASH_FORMAT, origvar, arg1.var[i]);
if (origvar[0] == '_') {
if (origvar[1] == '_') {
snprintf(varname, sizeof(varname), "__" HASH_FORMAT, origvar + 2, arg1.var[i]);
} else {
snprintf(varname, sizeof(varname), "_" HASH_FORMAT, origvar + 1, arg1.var[i]);
}
} else {
snprintf(varname, sizeof(varname), HASH_FORMAT, origvar, arg1.var[i]);
}
pbx_builtin_setvar_helper(chan, varname, arg2.val[i]);
} else {
pbx_builtin_setvar_helper(chan, arg1.var[i], arg2.val[i]);
@ -909,7 +918,15 @@ static int hash_write(struct ast_channel *chan, const char *cmd, char *var, cons
}
AST_STANDARD_APP_ARGS(arg, var);
snprintf(varname, sizeof(varname), HASH_FORMAT, arg.hashname, arg.hashkey);
if (arg.hashname[0] == '_') {
if (arg.hashname[1] == '_') {
snprintf(varname, sizeof(varname), "__" HASH_FORMAT, arg.hashname + 2, arg.hashkey);
} else {
snprintf(varname, sizeof(varname), "_" HASH_FORMAT, arg.hashname + 1, arg.hashkey);
}
} else {
snprintf(varname, sizeof(varname), HASH_FORMAT, arg.hashname, arg.hashkey);
}
pbx_builtin_setvar_helper(chan, varname, value);
return 0;