More of an asterisk question, but hoping someone can assist me.
I’m trying to automate ALL THE THINGS, and as part of that, I want to make a Lookup for which voicemail box to route calls to, based on the dialed number.
i cant do this Directly in dynroute, as I want to automate the usage, as:
SQL → get (NextStep) from (table) where (calledNumber) like 12345
func_odbc
[RouteToVoicemails]
prefix=MYSQL
dsn=test
readsql=SELECT IFNULL((SELECT Target from voicemailLookup where DialedNumber LIKE \'${ARG1}\'),\'ext-local,vmu200,1\') as TargetNum FROM voicemailLookup
and my dynroute:
[dynroute-stephen] ; Stephens Testing Dyroute
exten => s,1,NoOp(STEPHEN: fromdid was ${FROM_DID})
exten => s,n,Set(TargetNum=${MYSQL_RouteToVoicemails(${FROM_DID})});
exten => s,n,NoOp(STEPHEN SQL IS ${TargetNum})
(I’ve got other logic wrapped around that…)
my problem is:
I can make the SQL table
I can query it by hand, flawlessly
I can call SQL from dialplan
but, I cant call This database / table.
Excerpt form Full log.
-
func_odbc.c: SQL Exec Direct failed (-1)![SELECT IFNULL((SELECT Target from voicemailLookup where DialedNumber LIKE '12345'),'ext-local,vmu200,1') as TargetNum FROM voicemailLookup]
-
func_odbc.c: Unable to execute query [SELECT IFNULL((SELECT Target from voicemailLookup where DialedNumber LIKE '123456'),'ext-local,vmu200,1') as TargetNum FROM voicemailLookup]
so:
I think all I need is to update the ODBC to connect to this new table.
I’ve tried setting it in res_odbc_custom.conf,
I’ve verified that freepbxuser has access to the database and table
so how the heck does one get dialplan / FreePBX to be able to connect to a non-standard LOCAL SQL table? any help is greatly appreciated.