Answer the question
In order to leave comments, you need to log in
How to call mysql stored procedure from Asterisk via func_odbc?
I want to do something like authorization for support staff, so that before queuing, they enter their pin code. There is a procedure in Mysql, to which I pass ${CULLERID(num)} from the dialplan and ${pincode} entered by the operator. The procedure returns 0 if authorization passed, and 1 if something went wrong. There is still a lot of information in the database, which then gets into the reports, and it is important to know when the employee got in line, when he left.
So, everything I need works with the MYSQL dialplan application, but it is deprecated and will not be in future builds of Asterisk at all.
Current contents of func_odbc.conf
[QUEUE]
dsn=aster-odbc
mode=multirow
writesql=CALL Asterisk_SupportSessionStart(${ARG1},${ARG2})
exten => _*99*,1(begin),Read(pincode,${SOUNDPATH}/002-pin,4,10)
exten => _*99*,n,Set(pinvalid=${ODBC_QUEUE(${CULLERID(num)},${pincode})})
exten => _*99*,n,NoOp(${pinvalid})
exten => _*99*,n,GotoIf($[${pinvalid} = 0]?loginok)
exten => _*99*,n,GoTo(begin)
exten => _*99*,n(loginok),NoOp(Access granted)
exten => _*99*,n,HangUp()
exten => _*99*,n,NoOp(${pinvalid})
- nothing is assigned. ODBC_FETCH()
and ODBC_FETCH_STATUS()
, but I don’t understand how they can be applied, and there is almost no documentation on them. For almost 4 days of proceedings in my head, everything was mixed up.
Answer the question
In order to leave comments, you need to log in
try replacing writesql with readsql
ADD:
in the console you can check*CLI> odbc read ODBC_QUEUE 12221 142342 exec
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question