Asterisk with CDR Adaptive ODBC: Difference between revisions

From KlavoWiki
Jump to navigationJump to search
Line 33: Line 33:


For MySQL and CentOS: /var/lib/mysql/mysql.sock<br>
For MySQL and CentOS: /var/lib/mysql/mysql.sock<br>
For MySQL and Debian: /var/run/mysqld/mysqld.sock
For MySQL and Debian: /var/run/mysqld/mysqld.sock<br>
 
Socket is only use when server is local host or 127.0.0.1


== VerifyConnectivity ==
== VerifyConnectivity ==

Revision as of 03:46, 15 October 2015

Prerequisite

yum -y install mysql-connector-odbc unixODBC-devel libtool-ltdl-devel

By default by installing ODBC it will automatically set up known driver connections to MySQL and PostgreSQL

odbcinst -q -d

The details of the driver conneciton can be found in:

cat /etc/odbcinst.ini

Create ODBC DSN Connection

vi /etc/odbc.ini

Add the following contents

[MySQL-asterisk]
Description  = Asterisk CDR
Driver       = MySQL
Database     = asterisk
User         = root
Password     = passw0rd
Server       = localhost
Socket       = /var/lib/mysql/mysql.sock

For MySQL and CentOS: /var/lib/mysql/mysql.sock
For MySQL and Debian: /var/run/mysqld/mysqld.sock

Socket is only use when server is local host or 127.0.0.1

VerifyConnectivity

echo "select 1" | isql -v MySQL-asterisk

Attach res_odbc to DSN

vi /etc/asterisk/res_odbc.conf

Add/Modify the following to the file.

[asterisk]
enabled => yes
dsn => MySQL-asterisk
pre-connect => yes

Attach cdr_adaptive_odbc to res_odbc

vi /etc/asterisk/cdr_adaptive_odbc.conf

Add the following

[cdr_adaptive_connection]
connection=asterisk
table=cdr

If you are using an older CDR table or applications that uses the calldate column rather than the newer start column then you will need to create an alias.

vi /etc/asterisk/cdr_adaptive_odbc.conf

In the cdr_adaptive_connection context add the following line.

alias start => calldate