Install packages
apt-get install unixodbc-dev unixodbc-bin unixodbc
apt-get install unixodbc-dev unixodbc-bin unixodbc
/etc/odbc.ini
[asterisk-mysql]
Description = MySQL connection to ‘asterisk’ database
Driver = MySQL
Database = asterisk
Server = localhost
UserName = root
Password = ‘’
Port = 3306
Socket = /var/run/mysqld/mysqld.sock
[asterisk-mysql]
Description = MySQL connection to ‘asterisk’ database
Driver = MySQL
Database = asterisk
Server = localhost
UserName = root
Password = ‘’
Port = 3306
Socket = /var/run/mysqld/mysqld.sock
This lib need to be downloaded from MYSQL SITE
/etc/odbcinst.ini
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc8a.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc8S.so
FileUsage = 1
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc8a.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc8S.so
FileUsage = 1
/etc/asterisk/cdr_adaptive_odbc.conf
[asterisk-mysql]
connection=asterisk-mysql
table=cdr
alias start => calldate
connection=asterisk-mysql
table=cdr
alias start => calldate
/etc/asterisk/res_odbc.conf
[asterisk-mysql]
enabled => yes
dsn => asterisk-mysql
username => root
password => ‘’
pre-connect => yes
[asterisk-mysql]
enabled => yes
dsn => asterisk-mysql
username => root
password => ‘’
pre-connect => yes
assuming asterisk db exist create the table
CREATE TABLE cdr (
calldate datetime NULL ,
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 ‘’
);
restart asterisk
calldate datetime NULL ,
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 ‘’
);
restart asterisk
service asterisk restart
No hay comentarios:
Publicar un comentario