[asterisk-bugs] [JIRA] (ASTERISK-24148) Can not use mysql at extensions.lua

Yuriy Gorlichenko (JIRA) noreply at issues.asterisk.org
Mon Aug 4 01:05:56 CDT 2014


     [ https://issues.asterisk.org/jira/browse/ASTERISK-24148?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yuriy Gorlichenko updated ASTERISK-24148:
-----------------------------------------

    Description: 
Hello. I successfully installed asterisk 12.4.0 with 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:

{noformat}
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()
{noformat}


when I called it as 
>lua mysqltest.lua 

I see response:

{noformat}
<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
{noformat}


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


module reload pbx_lua.so

{noformat}
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
{noformat}

I uses this issue for fixing problem, but it does not
ASTERISK-17279 

So at weekend I deep googled this problem and found some things:

At previous issue (17279) another things I find that I need to load pbx_lua module with global simbols. I found a the old file modules.conf (at asterisk like  1.6) was section [globals] that includes at itself modules that must be loaded with golbal simbols:

lua_pbx.so=yes

So I changed my modules.conf but it no affect. So my Question changed from :

How I must install lua to my server for wotrking with luasql.mysql at extensions.lua?

to:
How to load Asterisk module with global simbols? 

I thiks that is write question.

  was:
Hello. I successfully installed asterisk 12.4.0 with 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:

{noformat}
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()
{noformat}


when I called it as 
>lua mysqltest.lua 

I see response:

{noformat}
<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
{noformat}


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


module reload pbx_lua.so

{noformat}
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
{noformat}

I uses this issue for fixing problem, but it does not
ASTERISK-17279 

How I must install lua to my server for wotrking with luasql.mysql at extensions.lua?


> Can not use mysql at extensions.lua
> -----------------------------------
>
>                 Key: ASTERISK-24148
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-24148
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: PBX/pbx_lua
>            Reporter: Yuriy Gorlichenko
>
> Hello. I successfully installed asterisk 12.4.0 with 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:
> {noformat}
> 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()
> {noformat}
> when I called it as 
> >lua mysqltest.lua 
> I see response:
> {noformat}
> <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
> {noformat}
> when I tried require driver from extensions.lua, I see this when reload module pbx_lua.so:
> module reload pbx_lua.so
> {noformat}
> 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
> {noformat}
> I uses this issue for fixing problem, but it does not
> ASTERISK-17279 
> So at weekend I deep googled this problem and found some things:
> At previous issue (17279) another things I find that I need to load pbx_lua module with global simbols. I found a the old file modules.conf (at asterisk like  1.6) was section [globals] that includes at itself modules that must be loaded with golbal simbols:
> lua_pbx.so=yes
> So I changed my modules.conf but it no affect. So my Question changed from :
> How I must install lua to my server for wotrking with luasql.mysql at extensions.lua?
> to:
> How to load Asterisk module with global simbols? 
> I thiks that is write question.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list