[asterisk-commits] russell: branch group/newcdr r202101 - /team/group/newcdr/main/cel.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jun 19 17:25:01 CDT 2009
Author: russell
Date: Fri Jun 19 17:24:57 2009
New Revision: 202101
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=202101
Log:
Reset date format on reload, also make sure we don't lose events during a reload
Modified:
team/group/newcdr/main/cel.c
Modified: team/group/newcdr/main/cel.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/main/cel.c?view=diff&rev=202101&r1=202100&r2=202101
==============================================================================
--- team/group/newcdr/main/cel.c (original)
+++ team/group/newcdr/main/cel.c Fri Jun 19 17:24:57 2009
@@ -260,9 +260,10 @@
ast_mutex_lock(&reload_lock);
+ /* Reset all settings before reloading configuration */
cel_enabled = CEL_ENALBED_DEFAULT;
eventset = CEL_DEFAULT_EVENTS;
-
+ *cel_dateformat = '\0';
ao2_callback(appset, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, NULL, NULL);
config = ast_config_load2("cel.conf", "cel", config_flags);
@@ -495,7 +496,9 @@
return tchan;
}
-void ast_cel_report_event(const struct ast_channel *chan, enum ast_cel_event_type event_type, char *userdefevname, const char *extra, const struct ast_channel *peer2)
+void ast_cel_report_event(const struct ast_channel *chan,
+ enum ast_cel_event_type event_type, char *userdefevname,
+ const char *extra, const struct ast_channel *peer2)
{
struct timeval eventtime;
struct ast_event *ev;
@@ -503,6 +506,11 @@
const char *peername = "";
struct ast_channel *peer = ast_bridged_channel((struct ast_channel *) chan);
+ /* Make sure a reload is not occurring while we're checking to see if this
+ * is an event that we care about. We could lose an important event in this
+ * process otherwise. */
+ ast_mutex_lock(&reload_lock);
+
if (!ast_cel_track_event(event_type)) {
ast_debug(1, "CEL event UNtracked: %s\n", ast_cel_get_type_name(event_type));
}
@@ -516,6 +524,8 @@
}
ao2_ref(app, -1);
}
+
+ ast_mutex_unlock(&reload_lock);
if (peer) {
peername = peer->name;
More information about the asterisk-commits
mailing list