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

Modified Files:
        func_logic.c 
Log Message:
Add SET function (bug #4335)


Index: func_logic.c
===================================================================
RCS file: /usr/cvsroot/asterisk/funcs/func_logic.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- func_logic.c        17 May 2005 16:45:42 -0000      1.3
+++ func_logic.c        19 May 2005 20:38:51 -0000      1.4
@@ -72,6 +72,29 @@
        return ret;
 }
 
+static char *builtin_function_set(struct ast_channel *chan, char *cmd, char 
*data, char *buf, size_t len) 
+{
+       char *ret = NULL, *varname, *val;
+
+       if ((varname = ast_strdupa(data))) {
+               if ((val = strchr(varname, '='))) {
+                       *val = '\0';
+                       val++;
+                       varname = ast_strip(varname);
+                       val = ast_strip(val);
+                       pbx_builtin_setvar_helper(chan, varname, val);
+                       ast_copy_string(buf, val, len);
+               } else {
+                       ast_log(LOG_WARNING, "Syntax Error!\n");
+               }
+               
+       } else {
+        ast_log(LOG_WARNING, "Memory Error!\n");
+    }
+
+       return ret;
+}
+
 #ifndef BUILTIN_FUNC
 static
 #endif
@@ -85,6 +108,16 @@
 #ifndef BUILTIN_FUNC
 static
 #endif
+struct ast_custom_function set_function = {
+       .name = "SET",
+       .synopsis = "SET assigns a value to a function call.",
+       .syntax = "SET(<varname>=<value>)",
+       .read = builtin_function_set,
+};
+
+#ifndef BUILTIN_FUNC
+static
+#endif
 struct ast_custom_function exists_function = {
        .name = "EXISTS",
        .synopsis = "Existence Test: Returns 1 if exists, 0 otherwise",

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

Reply via email to