In Asterisk 1.8 and above are recommended as the backend for the CDR, use the ODBC driver. This driver is a layer between the Asterisk and the database. This allows connection between Asterisk and unify the various databases, I easily. Consider the record CDR log files using ODBC.
Install the required packages
1
|
yum install mysql-server mysql mysql-devel mysql-connector-odbc unixODBC unixODBC-devel -y |
Add to the file “/etc/odbc.ini“, the following lines
1
2
3
4
5
6
7
8
9
10
11
12
|
; ; DSN definitions ; [asterisk-cdr] Description = Asterisk CDR Backend ODBC Driver = MySQL Socket = /var/lib/mysql/mysql.sock Server = localhost User = asterisk Pass = Your-Password Database = asterisk Option = 3 |
At the end of the file “/etc/asterisk/res_odbc.conf“ Add line
1
2
3
4
5
6
7
8
9
10
11
12
|
; ; CDR ODBC Backend ; Environment variables [ENV] ; Connections [asterisk-cdr] enabled => yes dsn => asterisk-cdr username => asterisk password => Your-Password pre-connect => yes idlecheck => 600 |
Check the file “/etc/asterisk/cdr_odbc.conf” that he was of this type. It only changes the DSN.
1
2
3
4
5
6
7
|
[global] dsn=asterisk-cdr loguniqueid=yes dispositionstring=yes table=cdr ;"cdr" is default table name usegmtime=no ; set to "yes" to log in GMT hrtime=yes ;Enables microsecond accuracy with the billsec and duration fields |
Create a base under the CDR.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
create database asterisk default charset utf8; use asterisk; CREATE TABLE
int (11) unsigned NOT NULL AUTO_INCREMENT,
NOT NULL DEFAULT '0000-00-00 00:00:00' ,
varchar (80) NOT NULL DEFAULT '' ,
varchar (80) NOT NULL DEFAULT '' ,
varchar (80) NOT NULL DEFAULT '' ,
varchar (80) NOT NULL DEFAULT '' ,
varchar (80) NOT NULL DEFAULT '' ,
varchar (80) NOT NULL DEFAULT '' ,
varchar (80) NOT NULL DEFAULT '' ,
varchar (80) NOT NULL DEFAULT '' ,
int (11) NOT NULL DEFAULT '0' ,
int (11) NOT NULL DEFAULT '0' ,
varchar (45) NOT NULL DEFAULT '' ,
int (11) NOT NULL DEFAULT '0' ,
varchar (20) NOT NULL DEFAULT '' ,
varchar (32) NOT NULL DEFAULT '' ,
varchar (20) NOT NULL DEFAULT '' ,
varchar (32) NOT NULL DEFAULT '' ,
int (11) NOT NULL DEFAULT '0' ,
varchar (255) NOT NULL DEFAULT '' , PRIMARY KEY ( KEY
KEY
KEY
KEY
KEY
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; grant all on asterisk.cdr to asterisk@ 'localhost' identified by 'Your-Password' ; flsuh priveleges; |
Now, Reboot your Astersik
1
|
service asterisk restart |
Make the call and look at how to form the base of the CDRs.