Can not query through ODBC and MySQL

I’m trying to get ODBC working with Asterisk11
It appears as my dial-plan can make the ODBC connection but somehow hanged when querying and its not procedding with next level in dialplan


Description = MySQL ODBC
Driver = MySQL
Database = mydatabase
Server = localhost
User = user
Password = password
Port = 3306
Option = 3


enabled => yes
dsn => MySQL-asterisk
username => user
password => password
pre-connect => yes


readsql=select client_name from clients where client_id=’${ARG1}’


exten => 4321,1,Answer()
same => n,Set(clientid=994)
same => n,Set(clientname=${MY_CLIENT(${clientid})})
same => n,Verbose(this is ${clientname})
same => n,wait(2)
same => n,hangup()

cli log

Connected to Asterisk 11.18.0 currently running on speed (pid = 2865)
– Executing [4321@mobile:1] Answer(“Dongle/dongle0-0100000001”, “”) in new stack
– Executing [4321@mobile:2] Set(“Dongle/dongle0-0100000001”, “clientid=994”) in new stack

speed*CLI> quit

when i dial it doesnt continue with dialplan. it doesnt query to database table and doesnt return any value. in cli no error is being shown.

i can run query from cli

speedCLI> odbc read MY_CLIENT 995
select client_name from clients where client_id='995’

are you sure odbc is connected ?

asterisk -rx “odbc show all”


asterisk -rx “odbc show all”

ODBC DSN Settings

Name: asterisk
DSN: MySQL-asterisk
Last connection attempt: 1970-01-01 06:00:00
Pooled: No
Connected: Yes

use value instead of ${ARG1} in your func_odbc file or try ‘${SQL_ESC(${ARG1})}’ instead and write the result here please .

Post CLI output of
speed*CLI> odbc read MY_CLIENT 995 exec

–Satish Barot