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