Asterisk + odbc

Hello All,
I am currently trying to get asterisk working using odbc connection with external database without much luck. It connects fine for a realtime switch with mysql but i want to get it working with odbc as it means i can use an oracle database later but for the moment i’m using mysql database. I have all the odbc ini’s correct as i can connect from command using “isql -v MySQL-asterisk root passw0rd isql -v MySQL-asterisk username usernamepassword” so it seems to be an asterisk odbc issue does any1 have an ideas. This is doing my head in!
Have any of ye done this?
Any help would be great lads.
Regards Brian.

Got that sorted, did’nt realise asterisk is unstable when you pre-load both

Just incase any1 else has the problem.


could you post your step by step implementation of asterisk with external
data base… im looking for some hints in net but i have no luck


here is my plan…

database box<------->Aterisk,Apache,Php,TE110P<-------->Channel Bank with 8FXO and 16FXS

Well kerberos,
Sorry for such slow reply very busy last few weeks and really havent been checking the forums as such.
Its a bit awkward to know where to start.

First do you have the files odbc.ini & odbcinst.ini stet up in your /etc directory

where odbc.ini is like such

Description = MySQL Asterisk database
Trace = Off
TraceFile = stderr
Driver = MySQL
SERVER = address of server with mysql db on it)
USER = root
PASSWORD = xxxxx(password)
PORT = 3306
DATABASE = xxx (name of DB on above server you wish to query)

and where odbcinst.ini is like such

Example driver definitinions

Included in the unixODBC package

Description = ODBC for PostgreSQL
Driver = /usr/lib/
Setup = /usr/lib/
FileUsage = 1

Description = ODBC for MySQL
Driver = /usr/lib/
Setup = /usr/lib/
FileUsage = 1

You then need to make sure the above driver files are there in the /usr/lib/ directory.

You then need to edit the etc/asterisk file odbc.conf to

[Database name]
enabled => yes
dsn => MySQL-asterisk
username => root
password =>xxxx (password used for database)
pre-connect => yes

enabled => yes
dsn => MySQL-asterisk
username => root
password => xxxx(password used for database)
pre-connect => yes

alsohave to set up the files res_odbc.conf & in the /etc/asterisk directory.

I’m after loosing these files from my configuration with all the messing i’m at but you can get them off the web i’m sure an then just edit them thats what i did i think!!

Then in you modules.conf file preload

preload =>
preload =>

then just have a read of this site

And you should be able to work your way from there.
At the moment that all i can remember as of now i dont have my asterisk configured for realtime odbc database stuff. But i did have it working fine.

One other thing too is you need to allow the pc you have the asterisk running on to connect to the sever with the database.

This is done with some command line stuff which can be found on the folowing site … -mysql.php

As of now thats all i can remember kerberos but it should work if you play around with these things enough.Hope thats ok & sorry for delay.

Kind Regards,

Thank you Sir for enrich knowldge reply. now i can play around and start
configuring according to my desire.

in way out there and find trouble i shall PM you with extected reply:)

Thanks a lot Sir and More Power!!!


here is my /etc/asteisk directory

webcam:/etc/asterisk# dir ;;;and i dont have only res_odbc.conf

adsi.conf cdr_tds.conf indications.conf privacy.conf
adtranvofr.conf codecs.conf logger.conf queues.conf
agents.conf dnsmgr.conf manager.conf res_odbc.conf
alarmreceiver.conf dundi.conf meetme.conf rpt.conf
alsa.conf enum.conf mgcp.conf rtp.conf
asterisk.adsi extconfig.conf misdn.conf sip.conf
asterisk.conf extensions.ael modem.conf sip_notify.conf
cdr.conf extensions.conf modules.conf skinny.conf
cdr_custom.conf features.conf musiconhold.conf telcordia-1.adsi
cdr_manager.conf festival.conf osp.conf voicemail.conf
cdr_odbc.conf iax.conf oss.conf vpb.conf
cdr_pgsql.conf iaxprov.conf phone.conf zapata.conf

here is my /usr/lib directory

webcam:/etc/asterisk# cd /usr/lib
webcam:/usr/lib# dir
crt1.o libltdl.a
gconv libm.a
gettext libmcheck.a
glib libmenu.a
libanl.a libncurses.a libncurses++.a libnewt.a libnsl.a
libasprintf.a libodbc.a libodbccr.a libodbcextras.a
libboundparam.a libodbcinst.a libodbcinstQ.a
libcurses.a libpanel.a
libfl.a libpq.a
libform.a libpri.a libpthread.a libpthread_nonshared.a
libg.a libreadline.a libresolv.a librpcsvc.a
libgdk.a librt.a libslang.a
libgettextpo.a libspeex.a libsqlite.a libssl.a libssl_pic.a
libgmodule.a libtemplate.a libtermcap.a
libgnuefi.a libutil.a
libgthread.a liby.a libz.a libzap.a
libgtkodbcconfig.a locale
libgtrtst.a locate mailagent man-db Mcrt1.o menu
libhistory.a mime odbc perl perl5 php4 pkgconfig postgresql pppd
libieee.a pt_chown python2.3 qt3 sasl2 Scrt1.o sendmail sftp-server ssh-keysign ssl tabset tasksel tcl8.4 terminfo
libl.a tk8.4 valgrind w3m X11

here is my /usr/lib/odbc directory

webcam:/usr/lib/odbc# dir

i have installed odbc follow PostgreSql installatio from here … pgsql.html

here is my /etc/odbcinst.ini

Description = PostgreSQL ODBC driver
Driver = /usr/lib/odbc/
Setup = /usr/lib/odbc/
Debug = 0
CommLog = 1
FileUsage = 2

here is my /etc/odbc.ini

Description = PostgreSQL template1
Driver = PostgreSQL
Trace = No
TraceFile = /tmp/psqlodbc.log
Database = template1
Servername = localhost
UserName =
Password =
Port = 5432
Protocol = 6.4
ReadOnly = Yes
RowVersioning = No
ShowSystemTables = No
ShowOidColumn = No
FakeOidIndex = No
ConnSettings =

i believe we have not equal value in /etc/odbcinst.ini as my FileUsage = 2.

Sir could you please check what i have lucking to make it run

Thanks and Happy Weekend

Did you ever have any luck getting this installed? I would love a little more detail on how to install this correctly. I have unixODBC working correctly but when I start asterisk it says “Asterisk Ready” but never answers the phone. If I comment out the odbcstorage line in voicemail.conf my asterisk system will answer the phone. I get no errors in the log entry.

brianquinn’s explanation was as much detail as I could find on implementing this method. The problem is it starts to get vauge towards the end of his post which is where I think I’m running into problems.

Thanks for any advice

sorry for the late reply,

the thing is i have not yet installed it, im on the stage of gathering info on how to install ARA using unixodbc with postgresql but im planning to place my
PostgreSQL on separate machine because im thinking for many asterisk server later on, thus i want to have a centralized ARA just like my a2billing Database where i place it in separate machine, yet i have not tested as im still aquiring VOIP provider account.

However, i shall post it here whenever i make it.

hi brianquinn & every1!
please have a look it too n help me