res_odbc with informix

Home » Asterisk Users » res_odbc with informix
Asterisk Users No Comments

Hi, all.

I am attempting to get res_odbc working with Informix (server version 11.10.UC1 on an AIX 5.3 box, Informix csdk (client) version: 3.70.UC3DE on a CentOS 6.0 box). I am able to successfully connect and run a query via isql, but if I attempt that same query via the dialplan, I get this error:

[Aug 22 09:24:22] ERROR[19020]: func_odbc.c:532 acf_odbc_read: Unable to execute query [SELECT comp_name FROM comp_descr where comp_num = 37]

I’ve enabled unixODBC logging, and I get output during the res_odbc module load, but when the dialplan executes there are no entries generated. I’m running asterisk via ‘asterisk -cvvv’, and I’m loading res_odbc manually so that I can see the output when the module is loaded – here is the console output for reference:

*CLI> module load res_odbc
== Parsing ‘/etc/asterisk/res_odbc.conf’: == Found
[Aug 22 10:15:43] NOTICE[19355]: res_odbc.c:774 load_odbc_config: Adding ENV var: INFORMIXSERVER=borgnet
[Aug 22 10:15:43] NOTICE[19355]: res_odbc.c:774 load_odbc_config: Adding ENV var: INFORMIXDIR=/opt/IBM/informix
[Aug 22 10:15:43] NOTICE[19355]: res_odbc.c:774 load_odbc_config: Adding ENV var: ODBCINI=/etc/odbc.ini
[Aug 22 10:15:43] NOTICE[19355]: res_odbc.c:1479 odbc_obj_connect: Connecting asterisk
[Aug 22 10:15:43] NOTICE[19355]: res_odbc.c:1509 odbc_obj_connect: res_odbc: Connected to asterisk [asterisk-connector]
[Aug 22 10:15:43] NOTICE[19355]: res_odbc.c:901 load_odbc_config: Registered ODBC class ‘asterisk’ dsn->[asterisk-connector]
== Registered application ‘ODBC_Commit’
== Registered application ‘ODBC_Rollback’
== Registered custom function ‘ODBC’
[Aug 22 10:15:43] NOTICE[19355]: res_odbc.c:1837 load_module: res_odbc loaded.
Loaded res_odbc.so => (ODBC resource)
Loaded res_odbc
*CLI> module load func_odbc
== Registered custom function ‘ODBC_FETCH’
== Registered application ‘ODBCFinish’
== Parsing ‘/etc/asterisk/func_odbc.conf’: == Found
== Registered custom function ‘AAA_COMPNAME’
== Registered custom function ‘SQL_ESC’
Loaded func_odbc.so => (ODBC lookups)
Loaded func_odbc

Following are some configs:

extension.conf (swift is the app for Cepstral):
[AAA_37]
exten => s,1,Answer
exten => s,n,Set(TIMEOUT(digit)=5)
exten => s,n,Set(TIMEOUT(response)=10)
exten => s,n,Set(COMPNAME=${AAA_COMPNAME(37)})
exten => s,n,Swift(No schedule information available for ${COMPNAME})
exten => s,n,Playback(AAA/5_sec_delay)

and from func_odbc.conf:
[COMPNAME]
dsn=INFORMIX
readsql=SELECT comp_name FROM comp_descr where comp_num = ${ARG1}
prefix=AAA

/etc/odbcinst.ini:
[INFORMIX]
Driver=/opt/IBM/informix/lib/cli/iclit09b.so
Setup=/opt/IBM/informix/lib/cli/iclit09b.so
APILevel=1
ConnectFunctions=YYY
DriverODBCVer=03.51
FileUsage=0
SQLLevel=1
smProcessPerConnect=Y

/etc/odbc.ini:
[ODBC Data Sources]
asterisk-connector=INFORMIX

[asterisk-connector]
Driver=INFORMIX
Description=INFORMIX connection to asterisk database on borg
Database=rmca_test
Server=borgnet
LogonID=
pwd= CLIENT_LOCALE=en_us.8859-1
DB_LOCALE=en_us.8859-1
TRANSLATIONDLL=/opt/IBM/informix/lib/esql/igo4a304.so
;
[ODBC]
Trace=1
TraceFile=/tmp/odbctrace.out
InstallDir=/opt/IBM/informix/lib/cli
TRACEDLL=idmrs09a.so

Thanks in advance for the help,
-Justin