Asterisk with CDR Adaptive ODBC: Difference between revisions
From KlavoWiki
Jump to navigationJump to search
(3 intermediate revisions by the same user not shown) | |||
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> | ||
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 == | == VerifyConnectivity == |
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