Getting somewhere…
First of all, thanks so much to both of you.
So, I can successfully connect now (with both drivers still installed) I rebooted in the meantime, I guess that did something.
[root@freepbx asterisk]# isql Remote-MSSQL username password
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> SELECT location FROM table WHERE unitName='1022'
+---------------------+
| table |
+---------------------+
| 1234 |
+---------------------+
SQLRowCount returns 0
1 rows fetched
in the ODBC custom file I have:
[root@freepbx asterisk]# cat res_odbc_custom.conf
[REMOTEMSSQL]
enabled=>yes
dsn=>Remote-MSSQL
pre-connect=>yes
max_connections=>5
username=>username
password=>password
readsql=>SELECT location FROM table WHERE unitName='${SQL_ESC(${ARG1})}'
Asterisk sees it:
[root@freepbx asterisk]# asterisk -x"odbc show all"
ODBC DSN Settings
-----------------
Name: REMOTEMSSQL
DSN: Remote-MSSQL
Number of active connections: 1 (out of 5)
Logging: Disabled
Name: asteriskcdrdb
DSN: MySQL-asteriskcdrdb
Number of active connections: 2 (out of 5)
Logging: Disabled
…So I wrote a dialplan:
[test-odbc]
exten => s,1,Noop(Getting there)
exten => s,n,Set(val=${ODBC_REMOTEMSSQL(1022)})
exten => s,n,Noop(Val is: ${val})
exten => s,n,Playback(beep)
exten => s,n,Hangup()
But it fails. ‘Function ODBC_REMOTEMSSQL’
Executing [s@test-odbc:1] NoOp("Local/6406@from-internal-00000002;1", "Getting here") in new stack
[2020-12-30 16:58:52] ERROR[6686][C-00000006]: pbx_functions.c:608 ast_func_read: Function ODBC_REMOTEMSSQL not registered
-- Executing [s@test-odbc:2] Set("Local/6406@from-internal-00000002;1", "val=") in new stack
-- Executing [s@test-odbc:3] NoOp("Local/6406@from-internal-00000002;1", "Val is: ") in new stack
What am I missing?
Thanks much