SOLVED Need help with odbc problem

swcarrel

New Member
Joined
Jan 25, 2009
Messages
5
Reaction score
0
I am having trouble getting odbc to work with Asterisk 11.6.0. The connector is functioning for isql, as seen here:

echo "select username from cc_card where id=1" | isql -v mya2billing-connector someuser somepassword


root@RipTide:~ $ echo "select username from cc_card where id=1" | isql -v mya2billing-connector someuser somepassword
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> select username from cc_card where id=1
+---------------------------------------------------+
| username |
+---------------------------------------------------+
| 8495595567 |
+---------------------------------------------------+
SQLRowCount returns 1
1 rows fetched

Here is the dsn definition from res_odbc:

[a2b]
enabled => yes
dsn => mya2billing-connector
username => someuser
password => somepassword
pre-connect => yes
sanitysql => select 1
idlecheck => 3600
share_connections => yes
limit => 1

Here is the function I defined to perform the query:

[SQL_SR]
prefix=A2B
synopsis=Generic SQL handle to 'mya2billing' database (single-row return)
dsn=a2b
readsql=${SQL_ESC(${ARG1})}
writesql=${SQL_ESC(${VAL1})}


And here is the dialplan function call:

same => n,Set(custid=${A2B_SQL_SR(SELECT username FROM cc_card WHERE id=1)})

But when I call the extension, here is what happens:

[2013-12-23 11:11:13] ERROR[4719][C-00000058]: func_odbc.c:538 acf_odbc_read: Unable to execute query [SELECT username FROM cc_card WHERE id=1]

MySQL is not receiving the query. The MySQL log shows no activity other than the cdr logging of the call when it ends.

By the way, my last build of asterisk (1.8) had ODBC as an installed function, but my new build (11.6.0) does not. In my last build, I could say "odbc show" at the CLI, but when I try it with my new build, I get:

odbc show
No such command 'odbc show' (type 'core show help odbc show' for other possible commands)

Making me crazy! What am I missing?
 

pbxtest

Member
Joined
Nov 29, 2013
Messages
49
Reaction score
6
Have you tried the tips in the Nerd Vittles article?

Sorry to hijack the thread, but I'm trying to do the exact same thing. I'd come across that article in my searches. Since I'm brand new to PIAF I wasn't sure exactly what was meant by this comment:


Just be aware that you may break the ability to later update your system once you manually bolt on additions such as ODBC by recompiling Asterisk. And, of course, you can add ODBC functionality to pure Asterisk systems as well.

Does it mean PIAF updates will not work at all, that they might overwrite the ODBC functionality, ...? Just trying to get a better understanding of what impact installing ODBC would have on future upgrades.

TIA
 

pbxtest

Member
Joined
Nov 29, 2013
Messages
49
Reaction score
6
Ok, I'll wait for a clarification on that.

By the way, my last build of asterisk (1.8) had ODBC as an installed function, but my new build (11.6.0) does not.

So did older versions of PIAF have ODBC installed? ie out of the box
 

swcarrel

New Member
Joined
Jan 25, 2009
Messages
5
Reaction score
0
Problem is finally solved. I must sheepishly admit that it was apparently caused by an error in res_odbc.conf. I thought I had combed them thoroughly but goofed on that one. Thanks much to all.
 

pbxtest

Member
Joined
Nov 29, 2013
Messages
49
Reaction score
6
So you got it to work without recompiling Asterisk?

I had similar problems setting up odbc (isql query works fine) and am wondering what I did wrong. Mind if I ask which files you updated and the "good" settings used?
 

Members online

Forum statistics

Threads
25,778
Messages
167,504
Members
19,198
Latest member
serhii
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top