I am wanting to look up a MySQL database as part of my dial plan. I have got the database referenced by Asterisk…
odbc show
ODBC DSN Settings
-----------------
Name: davos
DSN: MySQL-davos
Last connection attempt: 1970-01-01 12:00:00
Number of active connections: 1 (out of 1)
Name: asteriskcdrdb
DSN: MySQL-asteriskcdrdb
Last connection attempt: 1970-01-01 12:00:00
Number of active connections: 1 (out of 1)
However, everything I find says I need to put the query into func_odbc.conf file, this fine didnt exist; so I created it… but I’m not sure if it is actually used:
[SQL]
dns=MySQL-davos
readsql=select * from tblevent where restoretime > NOW();
Not certain (it’s been a really long time since I messed with the ODBC interface, but I think your SQL entry in the config file should match whatever you are querying in the context.
Connect to asterisk (using “asterisk -vr”) and see what help you can get from the CLI. IIRC, there are ODBC commands available in the “Help” functions there.