mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
Adding support for storing the queue log entries in a realtime backend.
(closes issue #11625, reported and patched by sergee) Thank you very much to sergee for adding this new feature! git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@94782 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -384,6 +384,7 @@ Logger changes
|
|||||||
command to be run after rotation. This is primarily useful with
|
command to be run after rotation. This is primarily useful with
|
||||||
rotatestrategry=rotate, to allow a limit on the number of logfiles kept
|
rotatestrategry=rotate, to allow a limit on the number of logfiles kept
|
||||||
and to ensure that the oldest log file gets deleted.
|
and to ensure that the oldest log file gets deleted.
|
||||||
|
* Added realtime support for the queue log
|
||||||
|
|
||||||
Miscellaneous
|
Miscellaneous
|
||||||
-------------
|
-------------
|
||||||
|
@@ -59,4 +59,5 @@
|
|||||||
;queues => odbc,asterisk
|
;queues => odbc,asterisk
|
||||||
;queue_members => odbc,asterisk
|
;queue_members => odbc,asterisk
|
||||||
;musiconhold => mysql,asterisk
|
;musiconhold => mysql,asterisk
|
||||||
|
;queue_log => mysql,aasterisk
|
||||||
|
|
||||||
|
@@ -418,6 +418,21 @@ void ast_queue_log(const char *queuename, const char *callid, const char *agent,
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
char qlog_msg[8192];
|
char qlog_msg[8192];
|
||||||
int qlog_len;
|
int qlog_len;
|
||||||
|
char time_str[16];
|
||||||
|
|
||||||
|
if (ast_check_realtime("queue_log")) {
|
||||||
|
va_start(ap, fmt);
|
||||||
|
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) {
|
if (qlog) {
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
qlog_len = snprintf(qlog_msg, sizeof(qlog_msg), "%ld|%s|%s|%s|%s|", (long)time(NULL), callid, queuename, agent, event);
|
qlog_len = snprintf(qlog_msg, sizeof(qlog_msg), "%ld|%s|%s|%s|%s|", (long)time(NULL), callid, queuename, agent, event);
|
||||||
@@ -430,6 +445,7 @@ void ast_queue_log(const char *queuename, const char *callid, const char *agent,
|
|||||||
fflush(qlog);
|
fflush(qlog);
|
||||||
}
|
}
|
||||||
AST_RWLIST_UNLOCK(&logchannels);
|
AST_RWLIST_UNLOCK(&logchannels);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rotate_file(const char *filename)
|
static int rotate_file(const char *filename)
|
||||||
|
Reference in New Issue
Block a user