Configure asterisk 1.4 and odbc/mysql, ubuntu

Since asterisk 1.4, and mysql new licence,

cdr_mysql has been disabled from asterisk default source code.

However, you can still use ODBC to connect to mysql and update your cdr for example.

You will get here a great article about steps to follow to do so

http://schools.coe.ru.ac.za/wiki/Configure_An_Asterisk_Server

Basicly, you need to install libmyodbc and unixodbc  packages.

Then edit /etc/odbcinst.ini

[MySQL]
Description     = MySQL driver
Driver          = /usr/lib/odbc/libmyodbc.so
Setup           = /usr/lib/odbc/libodbcmyS.so
CPTimeout       =
CPReuse         =

Then create an ODBC resource in /etc/odbc.ini

[MySQL-asterisk]
Description     = Asterisk MySQL ODBC
Driver          = MySQL
Socket          = /var/run/mysqld/mysqld.sock
Server          = localhost
User            = user
Password        = password
Database        = asterisk
Option          = 3
#Port           =

Now, you need to configure asterisk to use those ressources :

Edit /etc/asterisk/res_odbc.conf

[mysql]
enabled => yes
dsn => MySQL-asterisk
username => user
password => password
pre-connect => yes

and /etc/asterisk/cdr_odbc.conf

[global]
dsn=MySQL-asterisk
loguniqueid=yes
dispositionstring=yes
table=cdr               ;”cdr” is default table name
usegmtime=no             ; set to “yes” to log in GMT

Run again

make menuselect

from asterisk source directories.

Go to “Call Details Recording”

and select cdr_odbc

If, you cannot select cdr_odbc, this means that libmyodbc devel package is not install.

You may need to download the source and compile them.

To do so :

- download http://www.unixodbc.org/unixODBC-2.2.12.tar.gz or the latest one

- extract it

- run :

./configure

make install

You should see header files like in /usr/include/sql.h

Return to asterisk source directory and run

./configure –with-odbc=/usr/

make menuselect

Now, you should be able to select cdr_odbc

When done, just run ‘make install’ and cdr_odbc.so will be compile.

Hope this help.

Comments

Leave a Reply