Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv15440

Modified Files:
        ChangeLog manager.c 
Log Message:
issue #5571


Index: ChangeLog
===================================================================
RCS file: /usr/cvsroot/asterisk/ChangeLog,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- ChangeLog   8 Nov 2005 03:31:45 -0000       1.62
+++ ChangeLog   8 Nov 2005 03:35:40 -0000       1.63
@@ -1,5 +1,7 @@
 2005-11-07  Kevin P. Fleming  <[EMAIL PROTECTED]>
 
+       * manager.c (action_setvar): add support for setting global variables 
(issue #5571)
+
        * Makefile: correct cross-compilation issue introduced in Cygwin 
patches (issue #5572)
 
        * apps/app_voicemail.c: upgrade to new arg/option API and implement 
priority jumping control (issue #5649)

Index: manager.c
===================================================================
RCS file: /usr/cvsroot/asterisk/manager.c,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -d -r1.132 -r1.133
--- manager.c   8 Nov 2005 02:11:42 -0000       1.132
+++ manager.c   8 Nov 2005 03:35:40 -0000       1.133
@@ -664,9 +664,9 @@
 }
 
 static char mandescr_setvar[] = 
-"Description: Set a local channel variable.\n"
+"Description: Set a global or local channel variable.\n"
 "Variables: (Names marked with * are required)\n"
-"      *Channel: Channel to set variable for\n"
+"      Channel: Channel to set variable for\n"
 "      *Variable: Variable name\n"
 "      *Value: Value\n";
 
@@ -677,25 +677,24 @@
         char *varname = astman_get_header(m, "Variable");
         char *varval = astman_get_header(m, "Value");
        
-       if (!strlen(name)) {
-               astman_send_error(s, m, "No channel specified");
-               return 0;
-       }
-       if (!strlen(varname)) {
+       if (ast_strlen_zero(varname)) {
                astman_send_error(s, m, "No variable specified");
                return 0;
        }
 
-       c = ast_get_channel_by_name_locked(name);
-       if (!c) {
-               astman_send_error(s, m, "No such channel");
-               return 0;
+       if (!ast_strlen_zero(name)) {
+               c = ast_get_channel_by_name_locked(name);
+               if (!c) {
+                       astman_send_error(s, m, "No such channel");
+                       return 0;
+               }
        }
        
        pbx_builtin_setvar_helper(c,varname,varval);
          
        ast_mutex_unlock(&c->lock);
        astman_send_ack(s, m, "Variable Set");
+
        return 0;
 }
 

_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to