[asterisk-users] pbx_lua module with luasql.mysql

Yuriy Gorlichenko ovoshlook at gmail.com
Fri Jul 25 05:10:03 CDT 2014


Hello. I successfully installed lua and use lua_pbx with my dialplan, but I
need to use mysql.

I installed luasql.mysql and without extensions.lua it work fine (woth
external scripts)

I tested it with my little script:

______________________________________________________________
function mysqltest()

local driver = require "luasql.mysql"
local env = assert(driver.mysql())
local con = assert(env:connect("mydb", "root", "mypass", "localhost",
3306));
local cur = assert(con:execute("SELECT version()"));

print("<mysql> MYSQL driver version is: "..driver._MYSQLVERSION);
print("<mysql> "..driver._COPYRIGHT);
print("<mysql> "..driver._DESCRIPTION);
print("<mysql> "..driver._VERSION);

cur:close()
con:close()
env:close()
end;

mysqltest()
____________________________________________________________


when I called it as
>lua mysqltest.lua

I see response:

<mysql> MYSQL driver version is: 5.5.37
<mysql> Copyright (C) 2003-2012 Kepler Project
<mysql> LuaSQL is a simple interface from Lua to a DBMS
<mysql> LuaSQL 2.3.0


when I tried require driver from extensions.lua, I see this when reload
module pbx_lua.so:


module reload pbx_lua.so

________________________________________________________________
No such module 'pbx_lua.so'
    -- Reloading module 'pbx_lua.so' (Lua PBX Switch)
[Jul 24 11:41:27] ERROR[3512]: pbx_lua.c:1635 load_or_reload_lua_stuff:
Error loading extensions.lua:
error loading module 'luasql.mysql' from file
'/usr/local/lib/lua/5.1/luasql/mysql.so':
        /usr/local/lib/lua/5.1/luasql/mysql.so: undefined symbol: lua_settop
stack traceback:
        [C]: ?
        [C]: in function 'require'
        [string "extensions.lua"]:1: in main chunk
_________________________________________________________________

How I must install lua to my server gor wotrking with luasql.mysql at
extensions.lua?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20140725/e20dac33/attachment.html>


More information about the asterisk-users mailing list