summaryrefslogtreecommitdiff
path: root/cel/cel_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_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_custom.c')
-rw-r--r--cel/cel_custom.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/cel/cel_custom.c b/cel/cel_custom.c
index 871408716..0f72bd6ce 100644
--- a/cel/cel_custom.c
+++ b/cel/cel_custom.c
@@ -64,7 +64,7 @@ struct cel_config {
AST_RWLIST_ENTRY(cel_config) list;
};
-static struct ast_event_sub *event_sub = NULL;
+#define CUSTOM_BACKEND_NAME "CEL Custom CSV Logging"
static AST_RWLIST_HEAD_STATIC(sinks, cel_config);
@@ -116,7 +116,7 @@ static int load_config(void)
return res;
}
-static void custom_log(const struct ast_event *event, void *userdata)
+static void custom_log(struct ast_event *event)
{
struct ast_channel *dummy;
struct ast_str *str;
@@ -167,19 +167,15 @@ static void custom_log(const struct ast_event *event, void *userdata)
static int unload_module(void)
{
- if (event_sub) {
- event_sub = ast_event_unsubscribe(event_sub);
- }
if (AST_RWLIST_WRLOCK(&sinks)) {
- event_sub = ast_event_subscribe(AST_EVENT_CEL, custom_log, "CEL Custom CSV Logging",
- NULL, AST_EVENT_IE_END);
ast_log(LOG_ERROR, "Unable to lock sink list. Unload failed.\n");
return -1;
}
free_config();
AST_RWLIST_UNLOCK(&sinks);
+ ast_cel_backend_unregister(CUSTOM_BACKEND_NAME);
return 0;
}
@@ -193,8 +189,9 @@ static enum ast_module_load_result load_module(void)
load_config();
AST_RWLIST_UNLOCK(&sinks);
- event_sub = ast_event_subscribe(AST_EVENT_CEL, custom_log, "CEL Custom CSV Logging",
- NULL, AST_EVENT_IE_END);
+ if (ast_cel_backend_register(CUSTOM_BACKEND_NAME, custom_log)) {
+ return AST_MODULE_LOAD_FAILURE;
+ }
return AST_MODULE_LOAD_SUCCESS;
}