[asterisk-commits] oej: branch oej/manager-set-function-fail r232770 - in /team/oej/manager-set-...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 3 01:27:02 CST 2009


Author: oej
Date: Thu Dec  3 01:26:58 2009
New Revision: 232770

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=232770
Log:
Trying to solve the manager setvar issue without changing the API by copying code from pbx_builtin_setvar_helper
into the manager function. In trunk, we'll change the API.

Thanks, Russell, for the feedback.

Modified:
    team/oej/manager-set-function-fail/include/asterisk/pbx.h
    team/oej/manager-set-function-fail/main/manager.c
    team/oej/manager-set-function-fail/main/pbx.c

Modified: team/oej/manager-set-function-fail/include/asterisk/pbx.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/manager-set-function-fail/include/asterisk/pbx.h?view=diff&rev=232770&r1=232769&r2=232770
==============================================================================
--- team/oej/manager-set-function-fail/include/asterisk/pbx.h (original)
+++ team/oej/manager-set-function-fail/include/asterisk/pbx.h Thu Dec  3 01:26:58 2009
@@ -824,7 +824,7 @@
 /*!
  * \note Will lock the channel.
  */
-int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value);
+void pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value);
 
 /*!
  * \note Will lock the channel.

Modified: team/oej/manager-set-function-fail/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/manager-set-function-fail/main/manager.c?view=diff&rev=232770&r1=232769&r2=232770
==============================================================================
--- team/oej/manager-set-function-fail/main/manager.c (original)
+++ team/oej/manager-set-function-fail/main/manager.c Thu Dec  3 01:26:58 2009
@@ -1490,7 +1490,7 @@
 	const char *name = astman_get_header(m, "Channel");
 	const char *varname = astman_get_header(m, "Variable");
 	const char *varval = astman_get_header(m, "Value");
-	int res;
+	int res = 0;
 	
 	if (ast_strlen_zero(varname)) {
 		astman_send_error(s, m, "No variable specified");
@@ -1504,8 +1504,12 @@
 			return 0;
 		}
 	}
-	
-	res = pbx_builtin_setvar_helper(c, varname, S_OR(varval, ""));
+	if (name[strlen(varname)-1] == ')') {
+		char *function = ast_strdupa(varname);
+		res = ast_func_write(c, function, value);
+	} else {
+		pbx_builtin_setvar_helper(c, varname, S_OR(varval, ""));
+	}
 	  
 	if (c)
 		ast_channel_unlock(c);

Modified: team/oej/manager-set-function-fail/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/manager-set-function-fail/main/pbx.c?view=diff&rev=232770&r1=232769&r2=232770
==============================================================================
--- team/oej/manager-set-function-fail/main/pbx.c (original)
+++ team/oej/manager-set-function-fail/main/pbx.c Thu Dec  3 01:26:58 2009
@@ -5892,7 +5892,7 @@
 		ast_mutex_unlock(&globalslock);
 }
 
-int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
+void pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
 {
 	struct ast_var_t *newvariable;
 	struct varshead *headp;




More information about the asterisk-commits mailing list