Asterisk 11 queue log to mysql

Nainemom picture Nainemom · May 11, 2015 · Viewed 8.8k times · Source

How can i change default storage of queue log from /var/log/asterisk/queue_log file to asteriskcdrdb.queue_log table in MySQL in Asterisk 11?

Answer

viktike picture viktike · May 13, 2015

You should have in /etc/asterisk/extconfig.conf:

[settings]
queue_log => mysql,dsn,tablename

and in /etc/asterisk/res_config_mysql.conf:

[dsn]
dbname = database_name
dbuser = database_user
dbpass = database_pass
dbcharset = utf8
requirements = warn

The schema for the table is:

CREATE TABLE `tablename` (
  `id` bigint(255) unsigned NOT NULL AUTO_INCREMENT,
  `time` varchar(26) NOT NULL DEFAULT '',
  `callid` varchar(40) NOT NULL DEFAULT '',
  `queuename` varchar(20) NOT NULL DEFAULT '',
  `agent` varchar(20) NOT NULL DEFAULT '',
  `event` varchar(20) NOT NULL DEFAULT '',
  `data` varchar(100) NOT NULL DEFAULT '',
  `data1` varchar(40) NOT NULL DEFAULT '',
  `data2` varchar(40) NOT NULL DEFAULT '',
  `data3` varchar(40) NOT NULL DEFAULT '',
  `data4` varchar(40) NOT NULL DEFAULT '',
  `data5` varchar(40) NOT NULL DEFAULT '',
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `queue` (`queuename`),
  KEY `event` (`event`)
) DEFAULT CHARSET=utf8;