Another way to connect to databases—the preferred way—is to create HTTP queries from Lua and leave the HTTP server (or servers) the burden of managing connection pools, scalability, concurrence, and so on with tried and true well-known techniques.
Here, we'll see this preferred way.
Create a dialplan extension "12348" that will call our last Lua script. Edit the
<include> <extension name="Connect to DataBase"> <condition field="destination_number" expression="^(12348)$"> <action application="answer"/> <action application="sleep" data="1000"/> <action application="lua" data="database.lua"/> </condition> </extension> </include>
Save the file and then, from
Also, we need our HTTP...