Only Suggestion: You can use dbh to get data from mysql. You need to configure ODBC settings then.Sample one:db_con = set_db_connection();function set_db_connection()dbh = freeswitch.Dbh("freeswitch_odbc", "testusername", "testpw");if dbh:connected() == false thenreturn false;elsereturn true;endendfunction get_susb_data(old_no, pin_no)language = false ;my_query = "SELECT name * FROM subscriber;dbh:query(my_query, function(qrow)name = qrow.name;end);--logInfo(" name:" .. name);endOn Fri, Jan 10, 2014 at 10:13 PM, KPS Maillinglist <ksims.ml@gmail.com> wrote:
I placed the line in my script and the path in which the file lives is in fact in the modules path.2014-01-10 04:37:31.872812 [INFO] switch_cpp.cpp:1293 package.path /usr/local/share/lua/5.2/?.lua;/usr/local/share/lua/5.2/?/init.lua;/usr/local/lib/lua/5.2/?.lua;/usr/local/lib/lua/5.2/?/init.lua;./?.luapackage.cpath /usr/local/lib/lua/5.2/?.so;/usr/local/lib/lua/5.2/loadall.so;./?.so
On Fri, Jan 10, 2014 at 7:19 AM, Karsten Horsmann <khorsmann@gmail.com> wrote:
Hi,are you sure that the lua-path enviroment?
https://wiki.freeswitch.org/wiki/Mod_lua#Where_do_I_put_3rd_party_Lua_scripts.2Fmodules.3F
For debugging you could
freeswitch.consoleLog(INFO, "package.path ".. package.path .. "package.cpath " .. package.cpath )
In my lua 5.1 FS 1.2.x Lua scripts in include my 3rd party libaries like this:
-- include the DBI script and the DBI Module Pathspackage.path = package.path .. ";/usr/share/lua/5.1/?.lua"package.cpath = package.cpath .. ";/usr/lib64/lua/5.1/?.so"-- mysql Configrequire ('DBI')2014/1/9 KPS Maillinglist <ksims.ml@gmail.com>
_________________________________________________________________________I'm wriiting because I can't seem to get Lua from within Freeswitch to load the luasql mysql object. The error on the freeswitch console states that there's a error loading module luasql.mysql' but when i run a script from the shell requiring the same file it works just fine. I did due diligience and researched the issue and seen someone state the proble is due to lua being compiled from C++ code and the mysql module being compiled from C source code. Any help will be greatly appreciated because none of my scripts work because they are all database driven.FS Cli error:#########################2014-01-09 05:36:31.432815 [ERR] mod_lua.cpp:199 error loading module 'luasql.mysql' from file '/usr/local/lib/lua/5.2/luasql/mysql.so':/usr/local/lib/lua/5.2/luasql/mysql.so: undefined symbol: lua_getfieldstack traceback:[C]: in ?[C]: in function 'require'/cdi/fs157/scripts/cdi_scripts/cdi_main_start.lua:2: in main chunkFirst few lines of the script in question:#################################!/usr/bin/luarequire "luasql.mysql"-- I also tried to call module like statement below-- luasql = require "luasql.mysql"fs_api = freeswitch.API();dofile "/cdi/cdi_scripts/vars.lua"dofile "/cdi/cdi_scripts/maininclude.lua"Shell test script that works########################################!/usr/bin/lualuasql = require "luasql.mysql"env = assert (luasql.mysql())con = assert (env:connect("database","username","password","162.21X.XXX.144"))cur = assert (con:execute"SELECT * FROM xxx_acct_did")row = cur:fetch ({}, "a")while true do endwhile row doprint(string.format("DID: %s, Route: %s", row.did, row.route))row = cur:fetch (row, "a")endcur:close()con:close()Output of the script above:###################################DID: 18155516741, Route: 8171111741@108.111.175.183:5066DID: 19755514964, Route: 9721111964@173.111.252.22:5066DID: 19155515245, Route: 9171111245@150.111.194.215DID: 19755516483, Route: 9721111483@173.111.252.22:5066DID: 12155516793, Route: 2141111793@108.111.175.183:5066DID: 18755519608, Route: 8771111608@173.111.252.22:5066DID: 18655518946, Route: 8771111608@192.111.146.243:5199DID: 19755517847, Route: 8171111741@108.111.175.183:5066DID: 15155510762, Route: 5101111762@173.111.252.22:5066DID: 14655512043, Route: 4691111043@173.111.252.22:5066DID: 16155519638, Route: 6191111638@173.111.252.22:5066DID: 14655512044, Route: 4691111044@173.111.252.22:5066DID: 18755511623, Route: 8171111741@173.111.252.22:5066DID: 18755511624, Route: 8771111608@199.111.249.94:5199DID: 19725550001, Route: 9721111001@173.111.252.22:5066DID: 16305512270, Route: 8171111741@108.111.175.183:5066DID: 14695512042, Route: 8171111741@162.111.160.145:5066luasql file path:###############################################[root@rch-vmli ~]# ls -larth /usr/local/lib/lua/5.2/luasql/mysql.so-rwxr-xr-x 1 root root 18K Jan 6 10:35 /usr/local/lib/lua/5.2/luasql/mysql.soFS Info:######################################FreeSWITCH Version 1.5.8b+git~20140106T145044Z~8d30da28d7~32biLua version 5.2.2
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.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
--
Mit freundlichen Grüßen
*Karsten Horsmann*
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.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
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.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
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.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