[Freeswitch-svn] [commit] r10381 - freeswitch/trunk/src/mod/applications/mod_commands

FreeSWITCH SVN mikej at freeswitch.org
Thu Nov 13 12:26:15 PST 2008


Author: mikej
Date: Thu Nov 13 15:26:15 2008
New Revision: 10381

Log:
add new syntax to uuid_setvar to allow you to unset a var.  

New syntax is:
<uuid> <var> [value]

Previously value was required, now if it is omitted it will unset the var.
(MODAPP-167)

Modified:
   freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c

Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	Thu Nov 13 15:26:15 2008
@@ -2593,7 +2593,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-#define SETVAR_SYNTAX "<uuid> <var> <value>"
+#define SETVAR_SYNTAX "<uuid> <var> [value]"
 SWITCH_STANDARD_API(uuid_setvar_function)
 {
 	switch_core_session_t *psession = NULL;
@@ -2606,10 +2606,14 @@
 
 	if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
 		argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
-		if (argc == 3 && !switch_strlen_zero(argv[0])) {
+		if ((argc == 2 || argc == 3) && !switch_strlen_zero(argv[0])) {
 			char *uuid = argv[0];
 			char *var_name = argv[1];
-			char *var_value = argv[2];
+			char *var_value = NULL;
+
+			if (argc == 3) {
+				var_value =	argv[2];
+			}
 
 			if ((psession = switch_core_session_locate(uuid))) {
 				switch_channel_t *channel;



More information about the Freeswitch-svn mailing list