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

Chris Tunbridge blasterjr at gmail.com
Wed Sep 17 06:59:48 MSD 2014


I highly recommend using FreeSWITCH's built in dbh, you can see it in
action here:
https://confluence.freeswitch.org/display/FREESWITCH/Lua+freeswitch+dbh

you would be able to use ODBC still as you are, without the trouble of
trying to include the library... i had some severe issues getting any sort
of progress with luasql manually being included.

On Tue, Sep 16, 2014 at 11:36 AM, Aqs Younas <aqsyounas at gmail.com> wrote:

> 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.
>
>  #!/usr/bin/lua
>
> require "luasql.odbc"
>
>
> env = assert (luasql.mysql())
> con = assert (env:connect("gvt","root","hammer","localhost"))
>
> session:answer();
>
> -- sleep a second
> session:sleep(1000);
>
> Caller_number = session:getVariable("caller_id_number")
> session:consoleLog("info", Caller_number)
>
>
> session:streamFile("/opt/song.wav");
>
>
> session:setVariable("nibble_rate", "0.03");
>
> session:setVariable("nibble_account", "4712296279");
> -- play a file
>
> -- hangup
> session: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
>
> [freeswitch]
> Driver          = /usr/lib/i386-linux-gnu/odbc/libmyodbc.so
> SERVER          = localhost
> PORT            = 3306
> DATABASE        = gvt
> OPTION          = 67108864
> USER            = root
> PASSWORD        = hammer
>
>
> and odbcinst.ini
>
> [MySQL]
> 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
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> 
> 
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140916/5d241dd3/attachment.html 


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