Asterisk with CDR Adaptive ODBC: Difference between revisions

From KlavoWiki
Jump to navigationJump to search
(Created page with "= Prerequisite = <pre> yum -y install mysql-connector-odbc unixODBC-devel libtool-ltdl-devel </pre> By default by installing ODBC it will automatically set up known driver co...")
 
 
(5 intermediate revisions by the same user not shown)
Line 23: Line 23:
<pre>
<pre>
[MySQL-asterisk]
[MySQL-asterisk]
Description         = Asterisk CDR
Description = Asterisk CDR
Driver             = MySQL
Driver       = MySQL
Database           = asterisk
Database     = asterisk
User               = root
User         = root
Server             = localhost
Password    = passw0rd
Socket             = /var/lib/mysql/mysql.sock
Server       = localhost
Socket       = /var/lib/mysql/mysql.sock
</pre>
</pre>


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>
 
<b>Note:</b> Socket is only use when server is localhost or 127.0.0.1
 
== VerifyConnectivity ==
<pre>
echo "select 1" | isql -v MySQL-asterisk
</pre>


= Attach res_odbc to DSN =
= Attach res_odbc to DSN =
Line 45: Line 53:
enabled => yes
enabled => yes
dsn => MySQL-asterisk
dsn => MySQL-asterisk
username => root
password =>
pre-connect => yes
pre-connect => yes
</pre>
</pre>


= Attach cdr_adaptive_odbc to res_odbc =
= Attach cdr_adaptive_odbc to res_odbc =

Latest revision as of 03:47, 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

Note: Socket is only use when server is localhost 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