Asterisk with CDR Adaptive ODBC: Difference between revisions
From KlavoWiki
Jump to navigationJump to search
Line 23: | Line 23: | ||
<pre> | <pre> | ||
[MySQL-asterisk] | [MySQL-asterisk] | ||
Description | Description = Asterisk CDR | ||
Driver | Driver = MySQL | ||
Database | Database = asterisk | ||
User | User = root | ||
Server | Password = passw0rd | ||
Socket | Server = localhost | ||
Socket = /var/lib/mysql/mysql.sock | |||
</pre> | </pre> | ||
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
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