[Freeswitch-users] Lua script doesn't connect to Mysql

Aqs Younas aqsyounas at gmail.com
Tue Sep 16 21:36:53 MSD 2014

Hi, All

I am unable to connect to mysql for querying some data that I could use in
my lua script.
Here is my lua script.


require "luasql.odbc"

env = assert (luasql.mysql())
con = assert (env:connect("gvt","root","hammer","localhost"))


-- sleep a second

Caller_number = session:getVariable("caller_id_number")
session:consoleLog("info", Caller_number)


session:setVariable("nibble_rate", "0.03");

session:setVariable("nibble_account", "4712296279");
-- play a file

-- hangup

When i run this i got this error.

2014-09-16 04:59:43.423380 [ERR] mod_lua.cpp:203
/usr/local/freeswitch/scripts/test.lua:3: module 'luasql.odbc' not found:
        no field package.preload['luasql.odbc']
        no file '/usr/local/share/lua/5.2/luasql/odbc.lua'
        no file '/usr/local/share/lua/5.2/luasql/odbc/init.lua'
        no file '/usr/local/lib/lua/5.2/luasql/odbc.lua'
        no file '/usr/local/lib/lua/5.2/luasql/odbc/init.lua'
        no file './luasql/odbc.lua'
        no file '/usr/local/lib/lua/5.2/luasql/odbc.so'
        no file '/usr/local/lib/lua/5.2/loadall.so'
        no file './luasql/odbc.so'
        no file '/usr/local/lib/lua/5.2/luasql.so'
        no file '/usr/local/lib/lua/5.2/loadall.so'
        no file './luasql.so'
stack traceback:
        [C]: in function 'require'
        /usr/local/freeswitch/scripts/test.lua:3: in main chunk

My odbc.ini

Driver          = /usr/lib/i386-linux-gnu/odbc/libmyodbc.so
SERVER          = localhost
PORT            = 3306
DATABASE        = gvt
OPTION          = 67108864
USER            = root
PASSWORD        = hammer

and odbcinst.ini

Description     = MySQL driver
Driver          = /usr/lib/i386-linux-gnu/odbc/libmyodbc.so
Setup           = /usr/lib/i386-linux-gnu/odbc/libodbcmyS.so
UsageCount      = 1
FileUsage       = 1
Threading       = 0

Could someone please help me out how to connect freeswitch to mysql for
querying data..:)
Thanks in Advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140916/09f111ec/attachment.html 

Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list