[asterisk-commits] branch oej/test-this-branch r14109 - in /team/oej/test-this-branch: ./ funcs/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Mar 22 00:30:50 MST 2006


Author: oej
Date: Wed Mar 22 01:30:47 2006
New Revision: 14109

URL: http://svn.digium.com/view/asterisk?rev=14109&view=rev
Log:
Merge bwechke's changes to make the REALTIME function work :-) Thanks.

Modified:
    team/oej/test-this-branch/README.test-this-branch
    team/oej/test-this-branch/funcs/func_realtime.c

Modified: team/oej/test-this-branch/README.test-this-branch
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/README.test-this-branch?rev=14109&r1=14108&r2=14109&view=diff
==============================================================================
--- team/oej/test-this-branch/README.test-this-branch (original)
+++ team/oej/test-this-branch/README.test-this-branch Wed Mar 22 01:30:47 2006
@@ -73,9 +73,7 @@
 
 * Open BUGS (fixes welcome!)
 ----------------------------
-- func_realtime doesn't load properly on some systems.
-  add noload=func_realtime.so in modules.conf if you see this
-  and report to the bug tracker
+- ???
 
 * Metermaids
 ------------

Modified: team/oej/test-this-branch/funcs/func_realtime.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/funcs/func_realtime.c?rev=14109&r1=14108&r2=14109&view=diff
==============================================================================
--- team/oej/test-this-branch/funcs/func_realtime.c (original)
+++ team/oej/test-this-branch/funcs/func_realtime.c Wed Mar 22 01:30:47 2006
@@ -42,12 +42,20 @@
 #include "asterisk/utils.h"
 #include "asterisk/app.h"
 
+LOCAL_USER_DECL;
+
+static char *tdesc = "Read/Write values from a RealTime repository";
+
 static int function_realtime_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) 
 {
 
 	struct ast_variable *var=NULL,*head=NULL;
 	char *results;
 	size_t resultslen=0;
+	struct localuser *u;
+
+	LOCAL_USER_ADD(u);
+
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(family);
 		AST_APP_ARG(metamatch);
@@ -85,13 +93,19 @@
 	else
 		return -1;
 	ast_copy_string(buf, results, len);
+
+	LOCAL_USER_REMOVE(u);
 	
 	return 0;
 }
 
 static int function_realtime_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
 {
+        struct localuser *u;
 	int res = 0;
+
+	LOCAL_USER_ADD(u);
+
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(family);
 		AST_APP_ARG(metamatch);
@@ -110,6 +124,8 @@
 	if (res < 0) {
 		ast_log(LOG_WARNING, "Failed to update. Check the debug log for possible data repository related entries.\n");
 	}
+
+	LOCAL_USER_REMOVE(u);
 
 	return 0;
 }
@@ -132,3 +148,40 @@
 	.write = function_realtime_write,
 };
 
+int unload_module(void)
+{
+        int res = 0;
+
+        res |= ast_custom_function_unregister(&realtime_function);
+
+        STANDARD_HANGUP_LOCALUSERS;
+
+        return res;
+}
+
+int load_module(void)
+{
+        int res = 0;
+
+        res |= ast_custom_function_register(&realtime_function);
+
+        return res;
+}
+
+char *description(void)
+{
+        return tdesc;
+}
+
+int usecount(void)
+{
+        int res;
+        STANDARD_USECOUNT(res);
+        return res;
+}
+
+char *key()
+{
+        return ASTERISK_GPL_KEY;
+}
+



More information about the asterisk-commits mailing list