summaryrefslogtreecommitdiff
path: root/cel/cel_sqlite3_custom.c
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2013-08-17 14:46:44 +0000
committerKinsey Moore <kmoore@digium.com>2013-08-17 14:46:44 +0000
commitd7f1f3127084e4b7b204141c0b40c28c327f74b0 (patch)
treedf54e4afb05375633f67c2cefe694eddbf2f146e /cel/cel_sqlite3_custom.c
parent59753b1ea10a83ea770c35b24cd443620913349c (diff)
Refactor CEL to avoid using the event system core
This removes usage of the event system for CEL backend data distribution and strips unused pieces out of the event system. Review: https://reviewboard.asterisk.org/r/2732/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396888 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'cel/cel_sqlite3_custom.c')
-rw-r--r--cel/cel_sqlite3_custom.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/cel/cel_sqlite3_custom.c b/cel/cel_sqlite3_custom.c
index 6c4a82226..8ff3bd702 100644
--- a/cel/cel_sqlite3_custom.c
+++ b/cel/cel_sqlite3_custom.c
@@ -57,6 +57,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/options.h"
#include "asterisk/stringfields.h"
+#define SQLITE_BACKEND_NAME "CEL sqlite3 custom backend"
+
AST_MUTEX_DEFINE_STATIC(lock);
static const char config_file[] = "cel_sqlite3_custom.conf";
@@ -69,7 +71,6 @@ static char table[80];
* \bug Handling of this var is crash prone on reloads
*/
static char *columns;
-static struct ast_event_sub *event_sub = NULL;
struct values {
char *expression;
@@ -229,7 +230,7 @@ static void free_config(void)
}
}
-static void write_cel(const struct ast_event *event, void *userdata)
+static void write_cel(struct ast_event *event)
{
char *error = NULL;
char *sql = NULL;
@@ -293,9 +294,7 @@ static void write_cel(const struct ast_event *event, void *userdata)
static int unload_module(void)
{
- if (event_sub) {
- event_sub = ast_event_unsubscribe(event_sub);
- }
+ ast_cel_backend_unregister(SQLITE_BACKEND_NAME);
free_config();
@@ -339,8 +338,7 @@ static int load_module(void)
}
}
- event_sub = ast_event_subscribe(AST_EVENT_CEL, write_cel, "CEL sqlite3 custom backend", NULL, AST_EVENT_IE_END);
- if (!event_sub) {
+ if (ast_cel_backend_register(SQLITE_BACKEND_NAME, write_cel)) {
ast_log(LOG_ERROR, "Unable to register custom SQLite3 CEL handling\n");
free_config();
return AST_MODULE_LOAD_DECLINE;