diff -u -r ./Makefile.sav ./Makefile
--- ./Makefile.sav	2006-12-22 16:33:46.000000000 -0600
+++ ./Makefile	2007-01-07 10:19:04.000000000 -0600
@@ -183,6 +183,8 @@
 ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
 
 ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/autoconfig.h
+ASTCFLAGS+=-I/usr/include/mysql 
+ASTLDFLAGS+=-L/usr/lib/mysql -lmysqlclient
 
 ifeq ($(AST_DEVMODE),yes)
   ASTCFLAGS+=-Werror -Wunused
diff -u -r ./main/logger.c.sav ./main/logger.c
--- ./main/logger.c.sav	2006-11-10 20:04:28.000000000 -0600
+++ ./main/logger.c	2007-01-07 02:51:54.000000000 -0600
@@ -86,6 +86,9 @@
 static int filesize_reload_needed = 0;
 static int global_logmask = -1;
 
+/* Added for mysql */
+#include "logger-mysql.c"
+
 static struct {
 	unsigned int queue_log:1;
 	unsigned int event_log:1;
@@ -337,6 +340,9 @@
 	if ((s = ast_variable_retrieve(cfg, "general", "event_log")))
 		logfiles.event_log = ast_true(s);
 
+/* Added for mysql */
+	init_mysql_logger(cfg);
+
 	AST_LIST_LOCK(&logchannels);
 	var = ast_variable_browse(cfg, "logfiles");
 	for (; var; var = var->next) {
@@ -359,6 +365,8 @@
 		fprintf(qlog, "%ld|%s|%s|%s|%s|", (long)time(NULL), callid, queuename, agent, event);
 		vfprintf(qlog, fmt, ap);
 		fprintf(qlog, "\n");
+/* Added for mysql */
+		write_mysql_logger(queuename,callid,agent,event,fmt, ap);
 		va_end(ap);
 		fflush(qlog);
 	}
