Get data from the database during a call when using Realtime

The database has a table that is filled with some data through a third-party web interface. This table contains some data of real users. During a call from Asterisk, i need to make a request to this database in order to request some information by phone number, which is then used further in the process of making a call. The database is connected to Asterisk via ODBC, the data on the endpoints are in the same database. I.e., a real-time database.

If i do not use such tools as scripts, is it possible to make a similar query in the database?

Something like same => n,Set(variable=DATABASE(...))

As I understand it, this can be done via func_odbc. But I don’t quite understand how it can be used?

I found something similar on the forum. I can’t quite make it out.

I can’t understand the syntax.
I have a query select val from table where phone = 103. For example, the calling number 103, by which I can request a value from the database and write it to a variable in Asterisk, so that later I can use this variable in the dialplan.

I personally do not use func_odbc, but what you ask is easily doable, in my case I do it with the shell function, and from there I execute the query to the database

I consider this as the second option. But I want to try to implement it natively, inside Asterisk.

please have a look at file func_odbc
func_odbc.conf.sample
declare the query there and in the dial plan u use it as a variable
like Set(ABC=${ODBC_DECLARED(arg1,arg2)})

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.