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.
Thanks
Regards Brian.

Got that sorted, did’nt realise asterisk is unstable when you pre-load both
res_config_odbc.so
and
res_config_mysql.so

Just incase any1 else has the problem.
Regards,
Brian

hello

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

Thanks

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

[MySQL-asterisk]
Description = MySQL Asterisk database
Trace = Off
TraceFile = stderr
Driver = MySQL
SERVER = xx.xxx.xxx.xxx(ip 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

[PostgreSQL]
Description = ODBC for PostgreSQL
Driver = /usr/lib/libodbcpsql.so
Setup = /usr/lib/libodbcpsqlS.so
FileUsage = 1

[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc.so
Setup = /usr/lib/libodbcmyS.so
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

[global]
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 & res_config_odbc.so 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 => res_odbc.so
preload => res_config_odbc.so

then just have a read of this site

voip-info.org/wiki/view/Asterisk+RealTime

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

cyberciti.biz/nixcraft/vivek … -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,
Brian.

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!!!

Sir

here is my /etc/asteisk directory

webcam:/etc/asterisk# dir ;;;and i dont have res_config_odbc.so 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
webcam:/etc/asterisk#

here is my /usr/lib directory

webcam:/etc/asterisk# cd /usr/lib
webcam:/usr/lib# dir
apache2 liblcms.so.1.0.13
apt libldap_r.so.2
asterisk libldap_r.so.2.0.130
AuErrorDB libldap.so.2
base-config libldap.so.2.0.130
cgi-bin liblockfile.so.1
crt0-efi-ia32.o liblockfile.so.1.0
crt1.o libltdl.a
crti.o libltdl.la
crtn.o libltdl.so
dpkg libltdl.so.3
e2initrd_helper libltdl.so.3.1.0
elf_ia32_efi.lds liblwres.so.1
emacsen-common liblwres.so.1.1.2
exim4 liblzo.so.1
gcc-lib liblzo.so.1.0.0
gconv libm.a
gcrt1.o libmagic.so.1
gdk-imlib1 libmagic.so.1.0.0
gettext libmcheck.a
glib libmenu.a
graphviz libmenu.so
groff libmenu.so.5
hotplug libmenu.so.5.4
i486 libmenuw.so.5
i586 libmenuw.so.5.4
i686 libmng.la
ispell libmng.so.1
ldscripts libmng.so.1.0.0
libanl.a libm.so
libanl.so libncurses.a
libapr-0.so.0 libncurses++.a
libapr-0.so.0.9.6 libncurses.so
libapr.so.0 libncurses.so.5
libaprutil-0.so.0 libncursesw.so.5
libaprutil-0.so.0.9.6 libncursesw.so.5.4
libaprutil.so.0 libnewt.a
libapt-inst-libc6.3-5.so.1.0 libnewt.so
libapt-inst-libc6.3-5.so.1.0.0 libnewt.so.0.51
libapt-pkg-libc6.3-5.so.3.3 libnewt.so.0.51.6
libapt-pkg-libc6.3-5.so.3.3.0 libnsl.a
libart_lgpl.so.2 libnsl.so
libart_lgpl.so.2.2.0 libnss_compat.so
libasound.a libnss_db.so
libasound.la libnss_dns.so
libasound.so libnss_files.so
libasound.so.2 libnss_hesiod.so
libasound.so.2.0.0 libnss_nisplus.so
libasprintf.a libnss_nis.so
libasprintf.la libodbc.a
libasprintf.so libodbccr.a
libasprintf.so.0 libodbccr.la
libasprintf.so.0.0.0 libodbccr.so
libaudiofile.so.0 libodbccr.so.1
libaudiofile.so.0.0.2 libodbccr.so.1.0.0
libaudio.so.2 libodbcextras.a
libaudio.so.2.3 libodbcextras.la
libbfd-2.15.so libodbcextras.so
libboundparam.a libodbcextras.so.1
libboundparam.la libodbcextras.so.1.0.0
libboundparam.so libodbcinst.a
libboundparam.so.1 libodbcinst.la
libboundparam.so.1.0.0 libodbcinstQ.a
libBrokenLocale.a libodbcinstQ.la
libBrokenLocale.so libodbcinstQ.so
libbsd-compat.a libodbcinstQ.so.1
libbz2.so.1.0 libodbcinstQ.so.1.0.0
libbz2.so.1.0.2 libodbcinst.so
libc.a libodbcinst.so.1
libc_nonshared.a libodbcinst.so.1.0.0
libcrypt.a libodbc.la
libcrypto.a libodbc.so
libcrypto_pic.a libodbc.so.1
libcrypto.so libodbc.so.1.0.0
libcrypto.so.0.9.7 libopcodes-2.15.so
libcrypt.so libopencdk.so.8
libc.so libopencdk.so.8.0.1
libcurses.a libORBitCosNaming.so.0
libcurses.so libORBitCosNaming.so.0.5.17
libdb-3.2.so libORBit.so.0
libdb-3.so libORBit.so.0.5.17
libdb3.so.3 libORBitutil.so.0
libdb3.so.3.0.2 libORBitutil.so.0.5.17
libdb-4.2.so libpanel.a
libdb-4.3.so libpanel.so
libdes425.so.3 libpanel.so.5
libdes425.so.3.0 libpanel.so.5.4
libdiscover.so.1 libpanelw.so.5
libdiscover.so.1.0.0 libpanelw.so.5.4
libdl.a libpcap.so.0.7
libdl.so libpcap.so.0.7.2
libdns.so.16 libpci.so
libdns.so.16.0.0 libpci.so.2
libefi.a libpcreposix.so.3
libesddsp.so.0 libpcreposix.so.3.10.0
libesddsp.so.0.2.35 libpcre.so.3
libesd.so.0 libpcre.so.3.10.0
libesd.so.0.2.35 libperl.so.5.8
libevent.so.1 libperl.so.5.8.4
libevent.so.1.0.1 libpng10.so.0
libexpat.so.0 libpng10.so.0.1.0.18
libexpat.so.1 libpng12.so.0
libexpat.so.1.0.0 libpng12.so.0.1.2.8
libfl.a libpq.a
libfontconfig.so.1 libpq.so
libfontconfig.so.1.0.4 libpq.so.3
libform.a libpq.so.3.1
libform.so libpri.a
libform.so.5 libpri.so
libform.so.5.4 libpri.so.1
libformw.so.5 libpri.so.1.0
libformw.so.5.4 libpthread.a
libfreetype.so.6 libpthread_nonshared.a
libfreetype.so.6.3.5 libpthread.so
libg.a libpython2.3.so.1
libgccpp.so.1 libpython2.3.so.1.0
libgccpp.so.1.0.2 libqt-mt.so.3
libgcrypt.so.11 libqt-mt.so.3.3
libgcrypt.so.11.1.1 libqt-mt.so.3.3.4
libgc.so.1 libqui.so.1
libgc.so.1.0.2 libqui.so.1.0
libgdbm_compat.so.3 libqui.so.1.0.0
libgdbm_compat.so.3.0.0 libreadline.a
libgdbm.so.3 libreadline.so
libgdbm.so.3.0.0 libresolv.a
libgdk-1.2.so.0 libresolv.so
libgdk-1.2.so.0.9.1 librpcsvc.a
libgdk.a librt.a
libgdk_imlib.so.1 librt.so
libgdk_imlib.so.1.9.14 libsasl2.so.2
libgdk.la libsasl2.so.2.0.19
libgdk.so libsigc-1.2.so.5
libgettextlib-0.14.4.so libsigc-1.2.so.5.0.5
libgettextlib.la libslang.a
libgettextlib.so libslang.so
libgettextpo.a libspeex.a
libgettextpo.la libspeex.la
libgettextpo.so libspeex.so
libgettextpo.so.0 libspeex.so.1
libgettextpo.so.0.1.0 libspeex.so.1.2.0
libgettextsrc-0.14.4.so libsqlite.a
libgettextsrc.la libsqlite.la
libgettextsrc.so libsqlite.so
libgif.so.4 libsqlite.so.0
libgif.so.4.1.3 libsqlite.so.0.8.6
libglib-1.2.so.0 libssl.a
libglib-1.2.so.0.0.10 libssl_pic.a
libglib.a libssl.so
libglib.la libssl.so.0.9.7
libglib.so libstdc++.so.5
libgmodule-1.2.so.0 libstdc++.so.5.0.7
libgmodule-1.2.so.0.0.10 libtasn1.so.0
libgmodule.a libtasn1.so.0.0.2
libgmodule.la libtasn1.so.2
libgmodule.so libtasn1.so.2.0.10
libgnome.so.32 libtcl8.4.so.0
libgnome.so.32.4.3 libtemplate.a
libgnomesupport.so.0 libtemplate.la
libgnomesupport.so.0.0.0 libtemplate.so
libgnomeui.so.32 libtemplate.so.1
libgnomeui.so.32.14.1 libtemplate.so.1.0.0
libgnorbagtk.so.0 libtermcap.a
libgnorbagtk.so.0.0.0 libtermcap.so
libgnorba.so.27 libtextwrap.so.1
libgnorba.so.27.1.8 libtextwrap.so.1.0.0
libgnuefi.a libthread_db.so
libgnutls-extra.so.11 libtiff.so.4
libgnutls-extra.so.11.1.16 libtiff.so.4.1.2
libgnutls-openssl.so.11 libtk8.4.so.0
libgnutls-openssl.so.11.1.16 libtonezone.so
libgnutls.so.11 libtonezone.so.1
libgnutls.so.11.1.16 libtonezone.so.1.0
libgpg-error.so.0 libungif.so.4
libgpg-error.so.0.1.3 libungif.so.4.1.3
libgpm.so.1 libutil.a
libgpm.so.1.19.6 libutil.so
libgsm.a libXcursor.so.1
libgsm.so libXcursor.so.1.0.2
libgsm.so.1 libXft.so.2
libgsm.so.1.0.10 libXft.so.2.1.2
libgssapi_krb5.so.2 libxml2.so.2
libgssapi_krb5.so.2.2 libxml2.so.2.6.16
libgthread-1.2.so.0 libXrender.so.1
libgthread-1.2.so.0.0.10 libXrender.so.1.2.2
libgthread.a liby.a
libgthread.la libz.a
libgthread.so libzap.a
libgtk-1.2.so.0 libzap.so
libgtk-1.2.so.0.9.1 libzap.so.1
libgtk.a libz.so
libgtk.la libz.so.1
libgtkodbcconfig.a libz.so.1.2.2
libgtkodbcconfig.la libzzip-0.so.12
libgtkodbcconfig.so libzzip-0.so.12.0.83
libgtkodbcconfig.so.0 libzzipwrap-0.so.12
libgtkodbcconfig.so.0.0.0 libzzipwrap-0.so.12.0.83
libgtk.so locale
libgtrtst.a locate
libgtrtst.la mailagent
libgtrtst.so man-db
libgtrtst.so.1 Mcrt1.o
libgtrtst.so.1.0.0 menu
libhistory.a mime
libhistory.so odbc
libident.so.0 perl
libident.so.0.22 perl5
libIDL-0.6.so.0 php4
libIDL-0.6.so.0.4.4 pkgconfig
libidn.la postgresql
libidn.so.11 pppd
libidn.so.11.5.6 preloadable_libintl.so
libieee.a pt_chown
libIIOP.so.0 python2.3
libIIOP.so.0.5.17 qt3
libisc.so.7 sasl2
libisc.so.7.1.5 Scrt1.o
libjpeg.so.62 sendmail
libjpeg.so.62.0.0 sftp-server
libk5crypto.so.3 ssh-keysign
libk5crypto.so.3.0 ssl
libkrb4.so.2 tabset
libkrb4.so.2.0 tasksel
libkrb5.so.3 tcl8.4
libkrb5.so.3.2 terminfo
libl.a tk8.4
liblber.so.2 valgrind
liblber.so.2.0.130 w3m
liblcms.so.1 X11
webcam:/usr/lib#


here is my /usr/lib/odbc directory

webcam:/usr/lib/odbc# dir
libesoobS.so libodbcminiS.so libodbctxt.so libsapdbS.so
libnn.so libodbcmyS.so libodbctxtS.so libtdsS.so
libodbcdrvcfg1S.so libodbcnnS.so liboplodbcS.so psqlodbc.la
libodbcdrvcfg2S.so libodbcpsqlS.so liboraodbcS.so psqlodbc.so
webcam:/usr/lib/odbc#


i have installed odbc follow PostgreSql installatio from here
asteriskguru.com/tutorials/r … pgsql.html

here is my /etc/odbcinst.ini

PostgreSQL]
Description = PostgreSQL ODBC driver
Driver = /usr/lib/odbc/psqlodbc.so
Setup = /usr/lib/odbc/libodbcpsqlS.so
Debug = 0
CommLog = 1
FileUsage = 2


here is my /etc/odbc.ini

[PostgreSQL]
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 http://forums.digium.com/viewtopic.php?t=9269 n help me