summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2015-07-19 09:55:01 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2015-07-19 09:55:01 -0500
commitbd3515abafd09e66a8397117876468cfab7a9ad9 (patch)
tree624105d26ef177a4f509b664a72d6ba38536ffc2
parent9475dc9492bbb0921e27ac33398faaa81a6eae08 (diff)
parent4a875e80826dfaabe8e44d20ab21a713984d3e2d (diff)
Merge "pbx.c: Post AMI VarSet event if delete a non-empty dialplan variable."
-rw-r--r--main/pbx.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/main/pbx.c b/main/pbx.c
index 8e298bd2c..fcf0aa64e 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -11588,6 +11588,8 @@ int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const
struct ast_var_t *newvariable;
struct varshead *headp;
const char *nametail = name;
+ /*! True if the old value was not an empty string. */
+ int old_value_existed = 0;
if (name[strlen(name) - 1] == ')') {
char *function = ast_strdupa(name);
@@ -11614,6 +11616,7 @@ int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const
if (strcmp(ast_var_name(newvariable), nametail) == 0) {
/* there is already such a variable, delete it */
AST_LIST_REMOVE_CURRENT(entries);
+ old_value_existed = !ast_strlen_zero(ast_var_value(newvariable));
ast_var_delete(newvariable);
break;
}
@@ -11626,6 +11629,9 @@ int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const
}
AST_LIST_INSERT_HEAD(headp, newvariable, entries);
ast_channel_publish_varset(chan, name, value);
+ } else if (old_value_existed) {
+ /* We just deleted a non-empty dialplan variable. */
+ ast_channel_publish_varset(chan, name, "");
}
if (chan)