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