From 38e54bd39d4af1538ebf2757d6b3b1d12079b107 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Thu, 13 Nov 2008 20:26:15 +0000 Subject: [PATCH] add new syntax to uuid_setvar to allow you to unset a var. New syntax is: [value] Previously value was required, now if it is omitted it will unset the var. (MODAPP-167) git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10381 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/applications/mod_commands/mod_commands.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index ea0dbdb384..3b4537f9a1 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -2593,7 +2593,7 @@ SWITCH_STANDARD_API(uuid_flush_dtmf_function) return SWITCH_STATUS_SUCCESS; } -#define SETVAR_SYNTAX " " +#define SETVAR_SYNTAX " [value]" SWITCH_STANDARD_API(uuid_setvar_function) { switch_core_session_t *psession = NULL; @@ -2606,10 +2606,14 @@ SWITCH_STANDARD_API(uuid_setvar_function) 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;