<div dir="ltr"><div><div>Hello, <br><br>You&#39;ll have to have a working odbc connection, as mentioned by Steven, but then here&#39;s a Lua code snippet to test your stuff:<span style="font-family:courier new,monospace"><br><font size="1"><br>-- connect to DB via ODBC <br>local dbh = freeswitch.Dbh(&quot;odbc://freeswitch:freeswitch:PASS&quot;)<br>if dbh:connected() == false then<br>  freeswitch.consoleLog(&quot;error&quot;, &quot; Cannot connect to database.\n&quot;)<br>  return<br>end<br><br>-- looping through the db results<br>freeswitch.consoleLog(&quot;info&quot;, &quot; Looping through the DB results&quot;)<br>sql_query = &quot;SELECT id,name FROM your_table LIMIT 10;&quot;<br>dbh:query(sql_query, function(row)<br>    -- do whatever you want with row.FIELD_NAME, for instance:<br>    freeswitch.consoleLog(&quot;info&quot;, &quot;id:&quot; .. tostring(<a href="http://row.id">row.id</a>))<br>end)</font><br><br><br></span></div><span style="font-family:arial,helvetica,sans-serif">Hope it helps ;)<br></span></div><span style="font-family:courier new,monospace"><span style="font-family:arial,helvetica,sans-serif">Florent</span><br></span></div><div class="gmail_extra"><br><div class="gmail_quote">2014-09-16 21:37 GMT+02:00 Aqs Younas <span dir="ltr">&lt;<a href="mailto:aqsyounas@gmail.com" target="_blank">aqsyounas@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks for your quick reply. I give it a try.<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 17 September 2014 00:21, Steven Ayre <span dir="ltr">&lt;<a href="mailto:steveayre@gmail.com" target="_blank">steveayre@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Configure an ODBC connection to the database, then use freeswitch.Dbh from lua<div><br></div><div><a href="https://wiki.freeswitch.org/wiki/DSN" target="_blank">https://wiki.freeswitch.org/wiki/DSN</a><div><a href="https://wiki.freeswitch.org/wiki/Mod_lua#freeswitch.Dbh" target="_blank">https://wiki.freeswitch.org/wiki/Mod_lua#freeswitch.Dbh</a><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On 16 September 2014 18:41, Aqs Younas <span dir="ltr">&lt;<a href="mailto:aqsyounas@gmail.com" target="_blank">aqsyounas@gmail.com</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div><div><div><div><div><div>Hello, Users<br><br></div>i am newbie to freeswitch.I want to write lua script for querying data for mysql database that i could use in lua script.<br><br></div>Could someone please specify me how to do this with small exemplary lua script code.<br></div><div>or<br></div><br></div>1.) How to make freeswitch connect to mysql for querying data<br><br></div>2.) All steps in this regard.<br><br></div>Thanks <br></div>
<br></div></div>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br></div>
<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br></div>
</div></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br></div>