<div dir="ltr"><font color="#3333ff">Hi List,</font><div><font color="#3333ff"><br></font></div><div><font color="#3333ff">Below is my code by which I have connected Lua and mysql DB and displayed into FreeSwitch CLI.</font></div>
<div><font color="#3333ff"><br></font></div><div><div><font color="#3333ff">local dbh = freeswitch.Dbh(&quot;Billing&quot;,&quot;Billing&quot;,&quot;Tzru9unbcfuW6PV&quot;)</font></div><div><font color="#3333ff">if assert(dbh:connected()) == true then</font></div>
<div><font color="#3333ff"><span class="Apple-tab-span" style="white-space:pre">        </span>freeswitch.consoleLog(&quot;info&quot;, &quot;connected&quot;);</font></div><div><font color="#3333ff">assert(dbh:query(&quot;SELECT id, profile_name FROM sofia_conf&quot;, function(row)</font></div>
<div><font color="#3333ff"><span class="Apple-tab-span" style="white-space:pre">        </span>for key, val in pairs(row) do</font></div><div><font color="#3333ff">            row[key] = val</font></div><div><font color="#3333ff">--<span class="Apple-tab-span" style="white-space:pre">        </span>freeswitch.consoleLog(&quot;info&quot;, &quot; <a href="http://row.id">row.id</a>&quot;);</font></div>
<div><font color="#3333ff">--<span class="Apple-tab-span" style="white-space:pre">        </span>freeswitch.consoleLog(&quot;info&quot;, &quot; profile_name&quot;);</font></div><div><font color="#3333ff"><span class="Apple-tab-span" style="white-space:pre">        </span>freeswitch.consoleLog(&quot;info&quot;, &quot;row[key]&quot;);</font></div>
<div><font color="#3333ff">--<span class="Apple-tab-span" style="white-space:pre">        </span>freeswitch.consoleLog(&quot;info&quot;, &quot; profile_name&quot;);</font></div><div><font color="#3333ff">        end</font></div>
<div><font color="#3333ff">        end))</font></div><div><font color="#3333ff">  -- stream:write(string.format(&quot;%5s : %s\n&quot;, <a href="http://row.id">row.id</a>, row.profile_name))</font></div><div><font color="#3333ff">-- end)</font></div>
<div><font color="#3333ff">else </font></div><div><font color="#3333ff"><span class="Apple-tab-span" style="white-space:pre">        </span>freeswitch.consoleLog(&quot;info&quot;, &quot;not connected&quot;);</font></div><div><font color="#3333ff">end</font></div>
<div><font color="#3333ff"><br></font></div><div><font color="#3333ff">How to get and store values from mysql database to Lua variables ?</font></div><div><font color="#3333ff"><br></font></div><font color="#3333ff">-- <br>
</font><div dir="ltr"><font color="#3333ff"><br>Thanks and regards<br><br> Virendra Bhati<br>+91-8885268942<br>Software Engineer<br>E-mail-: <a href="mailto:virbhati@gmail.com" target="_blank">virbhati@gmail.com</a><br>Skype id:- virbhati2<br>
Hyderabad(India)<br></font></div><br>
</div></div>