aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGES1
-rw-r--r--configs/extconfig.conf.sample1
-rw-r--r--main/logger.c34
3 files changed, 27 insertions, 9 deletions
diff --git a/CHANGES b/CHANGES
index 47d24f51e..fcf27e7c8 100644
--- a/CHANGES
+++ b/CHANGES
@@ -384,6 +384,7 @@ Logger changes
command to be run after rotation. This is primarily useful with
rotatestrategry=rotate, to allow a limit on the number of logfiles kept
and to ensure that the oldest log file gets deleted.
+ * Added realtime support for the queue log
Miscellaneous
-------------
diff --git a/configs/extconfig.conf.sample b/configs/extconfig.conf.sample
index 3da9251bc..4c3899fcd 100644
--- a/configs/extconfig.conf.sample
+++ b/configs/extconfig.conf.sample
@@ -59,4 +59,5 @@
;queues => odbc,asterisk
;queue_members => odbc,asterisk
;musiconhold => mysql,asterisk
+;queue_log => mysql,aasterisk
diff --git a/main/logger.c b/main/logger.c
index c82862e6b..252b620b6 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -418,18 +418,34 @@ void ast_queue_log(const char *queuename, const char *callid, const char *agent,
va_list ap;
char qlog_msg[8192];
int qlog_len;
- if (qlog) {
+ char time_str[16];
+
+ if (ast_check_realtime("queue_log")) {
va_start(ap, fmt);
- qlog_len = snprintf(qlog_msg, sizeof(qlog_msg), "%ld|%s|%s|%s|%s|", (long)time(NULL), callid, queuename, agent, event);
- vsnprintf(qlog_msg + qlog_len, sizeof(qlog_msg) - qlog_len, fmt, ap);
+ vsnprintf(qlog_msg, sizeof(qlog_msg), fmt, ap);
va_end(ap);
+ snprintf(time_str, sizeof(time_str), "%ld", (long)time(NULL));
+ ast_store_realtime("queue_log", "time", time_str,
+ "callid", callid,
+ "queuename", queuename,
+ "agent", agent,
+ "event", event,
+ "data", qlog_msg,
+ NULL);
+ } else {
+ if (qlog) {
+ va_start(ap, fmt);
+ qlog_len = snprintf(qlog_msg, sizeof(qlog_msg), "%ld|%s|%s|%s|%s|", (long)time(NULL), callid, queuename, agent, event);
+ vsnprintf(qlog_msg + qlog_len, sizeof(qlog_msg) - qlog_len, fmt, ap);
+ va_end(ap);
+ }
+ AST_RWLIST_RDLOCK(&logchannels);
+ if (qlog) {
+ fprintf(qlog, "%s\n", qlog_msg);
+ fflush(qlog);
+ }
+ AST_RWLIST_UNLOCK(&logchannels);
}
- AST_RWLIST_RDLOCK(&logchannels);
- if (qlog) {
- fprintf(qlog, "%s\n", qlog_msg);
- fflush(qlog);
- }
- AST_RWLIST_UNLOCK(&logchannels);
}
static int rotate_file(const char *filename)