[asterisk-commits] pbx.c: Post AMI VarSet event if delete a non-empty dialplan ... (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jul 19 09:54:39 CDT 2015


Joshua Colp has submitted this change and it was merged.

Change subject: pbx.c: Post AMI VarSet event if delete a non-empty dialplan variable.
......................................................................


pbx.c: Post AMI VarSet event if delete a non-empty dialplan variable.

ASTERISK-25256 #close
Reported by: Richard Mudgett

Change-Id: I0b6be720b66fa956f6a798cd22ef8934eb0c0ff3
---
M main/pbx.c
1 file changed, 6 insertions(+), 0 deletions(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved



diff --git a/main/pbx.c b/main/pbx.c
index 8f5ee64..f23dff7 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -11591,6 +11591,8 @@
 	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);
@@ -11617,6 +11619,7 @@
 		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;
 		}
@@ -11629,6 +11632,9 @@
 		}
 		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)

-- 
To view, visit https://gerrit.asterisk.org/927
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0b6be720b66fa956f6a798cd22ef8934eb0c0ff3
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list