summaryrefslogtreecommitdiff
path: root/cel/cel_manager.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_manager.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_manager.c')
-rw-r--r--cel/cel_manager.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/cel/cel_manager.c b/cel/cel_manager.c
index 245c7800d..2fc001fe1 100644
--- a/cel/cel_manager.c
+++ b/cel/cel_manager.c
@@ -57,12 +57,12 @@ static int enablecel;
/*! \brief show_user_def is off by default */
#define CEL_SHOW_USERDEF_DEFAULT 0
+#define MANAGER_BACKEND_NAME "Manager Event Logging"
+
/*! TRUE if we should set the EventName header to USER_DEFINED on user events. */
static unsigned char cel_show_user_def;
-static struct ast_event_sub *event_sub;
-
-static void manager_log(const struct ast_event *event, void *userdata)
+static void manager_log(struct ast_event *event)
{
struct ast_tm timeresult;
char start_time[80] = "";
@@ -180,12 +180,9 @@ static int load_config(int reload)
cel_show_user_def = new_cel_show_user_def;
if (enablecel && !newenablecel) {
- if (event_sub) {
- event_sub = ast_event_unsubscribe(event_sub);
- }
+ ast_cel_backend_unregister(MANAGER_BACKEND_NAME);
} else if (!enablecel && newenablecel) {
- event_sub = ast_event_subscribe(AST_EVENT_CEL, manager_log, "Manager Event Logging", NULL, AST_EVENT_IE_END);
- if (!event_sub) {
+ if (ast_cel_backend_register(MANAGER_BACKEND_NAME, manager_log)) {
ast_log(LOG_ERROR, "Unable to register Asterisk Call Manager CEL handling\n");
}
}
@@ -196,9 +193,7 @@ static int load_config(int reload)
static int unload_module(void)
{
- if (event_sub) {
- event_sub = ast_event_unsubscribe(event_sub);
- }
+ ast_cel_backend_unregister(MANAGER_BACKEND_NAME);
return 0;
}