[asterisk-users] Reporting for Asterisk Call Center

Warren Selby wcselby at selbytech.com
Tue Oct 25 11:12:01 CDT 2011


On Tue, Oct 25, 2011 at 7:30 AM, bilal ghayyad <bilmar_gh at yahoo.com> wrote:

> Dear Tark;
>
> The asterisk version I am running is 1.8 and I can select mysql from
> menuselect when I am compiling.
>
> But when I googled for cdr-mysql, I discovered that I have to login for
> mysql and create the database and run a script to create this and give the
> grants. All what I found in google is related to other asterisk versions,
> while mine is 1.8, so the problem is how to know the required script to
> create the database and give the right grants to be used for CDR that suite
> the version I am running? From where I can get this?
>
>

The following script will generate an "asterisk" database with a table named
"CDR" that will work with asterisk 1.8.  Be sure to change 'PASSWORD' with
whatever password you want to use.

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
CREATE DATABASE `asterisk` DEFAULT CHARACTER SET latin1 COLLATE
latin1_swedish_ci;
USE `asterisk`;

CREATE TABLE IF NOT EXISTS `cdr` (
`recid` mediumint(8) unsigned NOT NULL auto_increment COMMENT 'Record ID',
`calldate` datetime NOT NULL default '0000-00-00 00:00:00',
`clid` varchar(80) NOT NULL default '',
`src` varchar(80) NOT NULL default '',
`dst` varchar(80) NOT NULL default '',
`dcontext` varchar(80) NOT NULL default '',
`channel` varchar(80) NOT NULL default '',
`dstchannel` varchar(80) NOT NULL default '',
`lastapp` varchar(80) NOT NULL default '',
`lastdata` varchar(80) NOT NULL default '',
`duration` int(11) NOT NULL default '0',
`billsec` int(11) NOT NULL default '0',
`disposition` varchar(45) NOT NULL default '',
`amaflags` int(11) NOT NULL default '0',
`accountcode` varchar(20) NOT NULL default '',
`uniqueid` varchar(32) NOT NULL default '',
`userfield` varchar(255) NOT NULL default '',
PRIMARY KEY  (`recid`),
KEY `calldate` (`calldate`),
KEY `dst` (`dst`),
KEY `accountcode` (`accountcode`),
KEY `src` (`src`),
KEY `disposition` (`disposition`),
KEY `uniqueid` (`uniqueid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE USER 'asterisk'@'localhost' IDENTIFIED BY 'PASSWORD';
GRANT FILE ON * . * TO 'asterisk'@'localhost' IDENTIFIED BY 'PASSWORD'
WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0
MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
GRANT INSERT ON `asterisk`.`cdr` TO 'asterisk'@'localhost';


If you're going to be running the mysql database on the same server as the
asterisk box, the following cdr_mysql.conf should also work for 1.8:

[global]
hostname=localhost
dbname=asterisk
table=cdr
password=PASSWORD
user=asterisk
port=3306
sock=/var/lib/mysql/mysql.sock
userfield=1
loguniqueid=yes


-- 
Thanks,
--Warren Selby, dCAP
http://www.SelbyTech.com <http://www.selbytech.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20111025/c8aedf79/attachment.htm>


More information about the asterisk-users mailing list