Execute HTTP request from LUA script not work
Hi, I have tried to make a HTTP POST request from LUA script but it does not work correctly in any way. This is an example of the errors that I have obtained: 09802b39-524f-4011-ada7-418e6a870248 2018-08-03 12:23:07.981581 [ERR] mod_lua.cpp:203 error loading module socket.core from file /usr/local/lib/lua/5.1/socket/core.so: 09802b39-524f-4011-ada7-418e6a870248 /usr/local/lib/lua/5.1/socket/core.so: undefined symbol: lua_pcall 09802b39-524f-4011-ada7-418e6a870248 stack traceback: 09802b39-524f-4011-ada7-418e6a870248 [C]: in ? 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/local/share/lua/5.1/socket.lua:12: in main chunk 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/local/share/lua/5.1/socket/http.lua:10: in main chunk 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/share/freeswitch/scripts/test.lua:3: in main chunk The lua script is: local http = require "socket.http"; local req_url = "http://localhost/" http.request{ url = req_url, method = "POST" } I tried several tutorials and several configurations: - https://freeswitch.org/confluence/display/FREESWITCH/Installing+LuaSocket - https://freeswitch.org/confluence/display/FREESWITCH/Third+Party+Libraries with https://luarocks.org/modules/jakeg/lua-requests <https://luarocks.org/modules/jakeg/lua-requests> And some other things that I do not remember but always fail for some "undefined symbol". Any ideas? Thanks! José D.
Oh this took me some time to figure out, i'll dig up ny script and share it with you. On Fri, Aug 3, 2018, 13:16 Jose David Jurado Alonso <josedavid@zennio.com> wrote:
Hi,
I have tried to make a HTTP POST request from LUA script but it does not work correctly in any way.
This is an example of the errors that I have obtained:
09802b39-524f-4011-ada7-418e6a870248 2018-08-03 12:23:07.981581 [ERR] mod_lua.cpp:203 error loading module socket.core from file /usr/local/lib/lua/5.1/socket/core.so: 09802b39-524f-4011-ada7-418e6a870248 /usr/local/lib/lua/5.1/socket/core.so: undefined symbol: lua_pcall 09802b39-524f-4011-ada7-418e6a870248 stack traceback: 09802b39-524f-4011-ada7-418e6a870248 [C]: in ? 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/local/share/lua/5.1/socket.lua:12: in main chunk 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/local/share/lua/5.1/socket/http.lua:10: in main chunk 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/share/freeswitch/scripts/test.lua:3: in main chunk
The lua script is:
local http = require "socket.http";
local req_url = "http://localhost/"
http.request{ url = req_url, method = "POST" }
I tried several tutorials and several configurations:
- https://freeswitch.org/confluence/display/FREESWITCH/Installing+LuaSocket - https://freeswitch.org/confluence/display/FREESWITCH/Third+Party+Libraries with https://luarocks.org/modules/jakeg/lua-requests <https://luarocks.org/modules/jakeg/lua-requests>
And some other things that I do not remember but always fail for some "undefined symbol".
Any ideas? Thanks!
José D. _________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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 https://freeswitch.com
Thank you very much David, if you find the script it would be a great help. I have been on vacation and I have not been able to try much more in this time. 2018-08-03 20:07 GMT+02:00 David Villasmil <david.villasmil.work@gmail.com>:
Oh this took me some time to figure out, i'll dig up ny script and share it with you.
On Fri, Aug 3, 2018, 13:16 Jose David Jurado Alonso <josedavid@zennio.com> wrote:
Hi,
I have tried to make a HTTP POST request from LUA script but it does not work correctly in any way.
This is an example of the errors that I have obtained:
09802b39-524f-4011-ada7-418e6a870248 2018-08-03 12:23:07.981581 [ERR] mod_lua.cpp:203 error loading module socket.core from file /usr/local/lib/lua/5.1/socket/core.so: 09802b39-524f-4011-ada7-418e6a870248 /usr/local/lib/lua/5.1/socket/core.so: undefined symbol: lua_pcall 09802b39-524f-4011-ada7-418e6a870248 stack traceback: 09802b39-524f-4011-ada7-418e6a870248 [C]: in ? 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/local/share/lua/5.1/socket.lua:12: in main chunk 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/local/share/lua/5.1/socket/http.lua:10: in main chunk 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/share/freeswitch/scripts/test.lua:3: in main chunk
The lua script is:
local http = require "socket.http";
local req_url = "http://localhost/"
http.request{ url = req_url, method = "POST" }
I tried several tutorials and several configurations:
- https://freeswitch.org/confluence/display/FREESWITCH/ Installing+LuaSocket - https://freeswitch.org/confluence/display/FREESWITCH/ Third+Party+Libraries with https://luarocks.org/ modules/jakeg/lua-requests <https://luarocks.org/modules/jakeg/lua-requests>
And some other things that I do not remember but always fail for some "undefined symbol".
Any ideas? Thanks!
José D. _________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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 https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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 https://freeswitch.com
This is a snippet of a LUA script I'm using: ... require "ltn12" conn = require "socket.http" conn.TIMEOUT = 2 function sendRequest() local path = "http://example.com/" local payload = "SOME_JSON" local response_body = { } local res, code, response_headers, status = conn.request { url = path, method = "POST", headers = { ["Authorization"] = "Basic SOMETHING", ["Content-Type"] = "application/json", ["Content-Length"] = payload:len() }, source = ltn12.source.string(payload), sink = ltn12.sink.table(response_body) } session:setVariable("my_http_res, res) session:setVariable("my_http_code", code) session:setVariable("my_http_status", status) end sendRequest() ... In my case, I have to do a *POST* of an "*application/json*" with *Basic auth*. I found this pretty helpful: http://w3.impa.br/~diego/software/luasocket/http.html lol I also remember going through a headache to get this "simple" thing working.. Hope it helps! Joel. On Sun, Aug 19, 2018 at 10:57 PM, Jose David Jurado Alonso < josedavid@zennio.com> wrote:
Thank you very much David, if you find the script it would be a great help.
I have been on vacation and I have not been able to try much more in this time.
2018-08-03 20:07 GMT+02:00 David Villasmil <david.villasmil.work@gmail.com
:
Oh this took me some time to figure out, i'll dig up ny script and share it with you.
On Fri, Aug 3, 2018, 13:16 Jose David Jurado Alonso <josedavid@zennio.com> wrote:
Hi,
I have tried to make a HTTP POST request from LUA script but it does not work correctly in any way.
This is an example of the errors that I have obtained:
09802b39-524f-4011-ada7-418e6a870248 2018-08-03 12:23:07.981581 [ERR] mod_lua.cpp:203 error loading module socket.core from file /usr/local/lib/lua/5.1/socket/core.so: 09802b39-524f-4011-ada7-418e6a870248 /usr/local/lib/lua/5.1/socket/core.so: undefined symbol: lua_pcall 09802b39-524f-4011-ada7-418e6a870248 stack traceback: 09802b39-524f-4011-ada7-418e6a870248 [C]: in ? 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/local/share/lua/5.1/socket.lua:12: in main chunk 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/local/share/lua/5.1/socket/http.lua:10: in main chunk 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/share/freeswitch/scripts/test.lua:3: in main chunk
The lua script is:
local http = require "socket.http";
local req_url = "http://localhost/"
http.request{ url = req_url, method = "POST" }
I tried several tutorials and several configurations:
- https://freeswitch.org/confluence/display/FREESWITCH/Install ing+LuaSocket - https://freeswitch.org/confluence/display/FREESWITCH/Third+ Party+Libraries with https://luarocks.org/mo dules/jakeg/lua-requests <https://luarocks.org/modules/jakeg/lua-requests>
And some other things that I do not remember but always fail for some "undefined symbol".
Any ideas? Thanks!
José D. ____________________________________________________________ _____________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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 https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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 https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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 https://freeswitch.com
Also, from your logs it seems you have compiled LUA manually? Maybe the problem can be there. This is where the lua http lib is in debian8: root@debian:~# dpkg -S /usr/share/lua/5.1/socket/http.lua lua-socket:amd64: /usr/share/lua/5.1/socket/http.lua root@debian:~# If you are using the distribution-package-lua make sure you have the *lua-socket* package installed (or whatever the package name is in your distro, this example applies to debian8), Cheers, Joel. On Tue, Aug 21, 2018 at 4:23 PM, Joel Serrano <joel@textplus.com> wrote:
This is a snippet of a LUA script I'm using:
... require "ltn12" conn = require "socket.http" conn.TIMEOUT = 2
function sendRequest() local path = "http://example.com/" local payload = "SOME_JSON" local response_body = { }
local res, code, response_headers, status = conn.request { url = path, method = "POST", headers = { ["Authorization"] = "Basic SOMETHING", ["Content-Type"] = "application/json", ["Content-Length"] = payload:len() }, source = ltn12.source.string(payload), sink = ltn12.sink.table(response_body) } session:setVariable("my_http_res, res) session:setVariable("my_http_code", code) session:setVariable("my_http_status", status) end
sendRequest() ...
In my case, I have to do a *POST* of an "*application/json*" with *Basic auth*.
I found this pretty helpful:
http://w3.impa.br/~diego/software/luasocket/http.html
lol I also remember going through a headache to get this "simple" thing working..
Hope it helps!
Joel.
On Sun, Aug 19, 2018 at 10:57 PM, Jose David Jurado Alonso < josedavid@zennio.com> wrote:
Thank you very much David, if you find the script it would be a great help.
I have been on vacation and I have not been able to try much more in this time.
2018-08-03 20:07 GMT+02:00 David Villasmil <david.villasmil.work@gmail.co m>:
Oh this took me some time to figure out, i'll dig up ny script and share it with you.
On Fri, Aug 3, 2018, 13:16 Jose David Jurado Alonso < josedavid@zennio.com> wrote:
Hi,
I have tried to make a HTTP POST request from LUA script but it does not work correctly in any way.
This is an example of the errors that I have obtained:
09802b39-524f-4011-ada7-418e6a870248 2018-08-03 12:23:07.981581 [ERR] mod_lua.cpp:203 error loading module socket.core from file /usr/local/lib/lua/5.1/socket/core.so: 09802b39-524f-4011-ada7-418e6a870248 /usr/local/lib/lua/5.1/socket/core.so: undefined symbol: lua_pcall 09802b39-524f-4011-ada7-418e6a870248 stack traceback: 09802b39-524f-4011-ada7-418e6a870248 [C]: in ? 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/local/share/lua/5.1/socket.lua:12: in main chunk 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/local/share/lua/5.1/socket/http.lua:10: in main chunk 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/share/freeswitch/scripts/test.lua:3: in main chunk
The lua script is:
local http = require "socket.http";
local req_url = "http://localhost/"
http.request{ url = req_url, method = "POST" }
I tried several tutorials and several configurations:
- https://freeswitch.org/confluence/display/FREESWITCH/Install ing+LuaSocket - https://freeswitch.org/confluence/display/FREESWITCH/Third+P arty+Libraries with https://luarocks.org/mo dules/jakeg/lua-requests <https://luarocks.org/modules/jakeg/lua-requests>
And some other things that I do not remember but always fail for some "undefined symbol".
Any ideas? Thanks!
José D. ____________________________________________________________ _____________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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/free switch-users https://freeswitch.com
____________________________________________________________ _____________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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 https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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 https://freeswitch.com
Hi, Not sure if this helps, but as far I knew you need to use Lua version 5.2, not 5.1 https://freeswitch.org/confluence/display/FREESWITCH/mod_lua Since FreeSWITCH 1.4, you need to use Lua5.2 (http://www.lua.org/manual/5.2/
).
For those willing to keep using Lua5.1 for backwards compatibility reasons, there is a mod_lua available in *legacy* directory `freeswitch/src/mod/legacy/languages/mod_lua/`
Jurijs On Wed, Aug 22, 2018 at 6:23 PM Joel Serrano <joel@textplus.com> wrote:
Also, from your logs it seems you have compiled LUA manually? Maybe the problem can be there.
This is where the lua http lib is in debian8:
root@debian:~# dpkg -S /usr/share/lua/5.1/socket/http.lua lua-socket:amd64: /usr/share/lua/5.1/socket/http.lua root@debian:~#
If you are using the distribution-package-lua make sure you have the *lua-socket* package installed (or whatever the package name is in your distro, this example applies to debian8),
Cheers, Joel.
On Tue, Aug 21, 2018 at 4:23 PM, Joel Serrano <joel@textplus.com> wrote:
This is a snippet of a LUA script I'm using:
... require "ltn12" conn = require "socket.http" conn.TIMEOUT = 2
function sendRequest() local path = "http://example.com/" local payload = "SOME_JSON" local response_body = { }
local res, code, response_headers, status = conn.request { url = path, method = "POST", headers = { ["Authorization"] = "Basic SOMETHING", ["Content-Type"] = "application/json", ["Content-Length"] = payload:len() }, source = ltn12.source.string(payload), sink = ltn12.sink.table(response_body) } session:setVariable("my_http_res, res) session:setVariable("my_http_code", code) session:setVariable("my_http_status", status) end
sendRequest() ...
In my case, I have to do a *POST* of an "*application/json*" with *Basic auth*.
I found this pretty helpful:
http://w3.impa.br/~diego/software/luasocket/http.html
lol I also remember going through a headache to get this "simple" thing working..
Hope it helps!
Joel.
On Sun, Aug 19, 2018 at 10:57 PM, Jose David Jurado Alonso < josedavid@zennio.com> wrote:
Thank you very much David, if you find the script it would be a great help.
I have been on vacation and I have not been able to try much more in this time.
2018-08-03 20:07 GMT+02:00 David Villasmil < david.villasmil.work@gmail.com>:
Oh this took me some time to figure out, i'll dig up ny script and share it with you.
On Fri, Aug 3, 2018, 13:16 Jose David Jurado Alonso < josedavid@zennio.com> wrote:
Hi,
I have tried to make a HTTP POST request from LUA script but it does not work correctly in any way.
This is an example of the errors that I have obtained:
09802b39-524f-4011-ada7-418e6a870248 2018-08-03 12:23:07.981581 [ERR] mod_lua.cpp:203 error loading module socket.core from file /usr/local/lib/lua/5.1/socket/core.so: 09802b39-524f-4011-ada7-418e6a870248 /usr/local/lib/lua/5.1/socket/core.so: undefined symbol: lua_pcall 09802b39-524f-4011-ada7-418e6a870248 stack traceback: 09802b39-524f-4011-ada7-418e6a870248 [C]: in ? 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/local/share/lua/5.1/socket.lua:12: in main chunk 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/local/share/lua/5.1/socket/http.lua:10: in main chunk 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/share/freeswitch/scripts/test.lua:3: in main chunk
The lua script is:
local http = require "socket.http";
local req_url = "http://localhost/"
http.request{ url = req_url, method = "POST" }
I tried several tutorials and several configurations:
- https://freeswitch.org/confluence/display/FREESWITCH/Installing+LuaSocket - https://freeswitch.org/confluence/display/FREESWITCH/Third+Party+Libraries with https://luarocks.org/modules/jakeg/lua-requests <https://luarocks.org/modules/jakeg/lua-requests>
And some other things that I do not remember but always fail for some "undefined symbol".
Any ideas? Thanks!
José D.
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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 https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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 https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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 https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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 https://freeswitch.com
Hi, I'm doing in following way:
function postbla(bla)
local body = [[ { "bla": "]]..bla..[[" } ]]
path = pathzzz .. "postbla"
c = curl.easy{ url = path, post = true, httpheader = { "Content-Type: application/json"; }; postfields = body; }
c:perform{ writefunction = function(s) res = s end }
statuscode = c:getinfo_response_code()
return statuscode, res, body
end
Jurijs On Tue, Aug 21, 2018 at 11:19 PM Jose David Jurado Alonso < josedavid@zennio.com> wrote:
Thank you very much David, if you find the script it would be a great help.
I have been on vacation and I have not been able to try much more in this time.
2018-08-03 20:07 GMT+02:00 David Villasmil <david.villasmil.work@gmail.com
:
Oh this took me some time to figure out, i'll dig up ny script and share it with you.
On Fri, Aug 3, 2018, 13:16 Jose David Jurado Alonso <josedavid@zennio.com> wrote:
Hi,
I have tried to make a HTTP POST request from LUA script but it does not work correctly in any way.
This is an example of the errors that I have obtained:
09802b39-524f-4011-ada7-418e6a870248 2018-08-03 12:23:07.981581 [ERR] mod_lua.cpp:203 error loading module socket.core from file /usr/local/lib/lua/5.1/socket/core.so: 09802b39-524f-4011-ada7-418e6a870248 /usr/local/lib/lua/5.1/socket/core.so: undefined symbol: lua_pcall 09802b39-524f-4011-ada7-418e6a870248 stack traceback: 09802b39-524f-4011-ada7-418e6a870248 [C]: in ? 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/local/share/lua/5.1/socket.lua:12: in main chunk 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/local/share/lua/5.1/socket/http.lua:10: in main chunk 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/share/freeswitch/scripts/test.lua:3: in main chunk
The lua script is:
local http = require "socket.http";
local req_url = "http://localhost/"
http.request{ url = req_url, method = "POST" }
I tried several tutorials and several configurations:
- https://freeswitch.org/confluence/display/FREESWITCH/Installing+LuaSocket - https://freeswitch.org/confluence/display/FREESWITCH/Third+Party+Libraries with https://luarocks.org/modules/jakeg/lua-requests <https://luarocks.org/modules/jakeg/lua-requests>
And some other things that I do not remember but always fail for some "undefined symbol".
Any ideas? Thanks!
José D. _________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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 https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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 https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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 https://freeswitch.com
Hi, Effectively Joel, the problem was with LUA versions / compilations but I do not remember ever manually compiling it. I tried several versions available in the repositories (ubuntu 16.04), 5.0, 5.1, 5.2 and 5.3, uninstalling LUA completely before installing a new version and specifying the PATH in the XML, even using luarocks but the problem persisted again and again. Finally the solution was to use 'luaver' to install specifically the versions of LUA and luarocks and I already managed to make it work. The couple of versions that worked for me were: - lua 5.2.4 - luarocks 2.2.2 Thanks to all. José David Jurado Alonso El mié., 22 ago. 2018 a las 19:51, Jurijs Ivolga (<jurijs.ivolga@gmail.com>) escribió:
Hi,
I'm doing in following way:
function postbla(bla)
local body = [[ { "bla": "]]..bla..[[" } ]]
path = pathzzz .. "postbla"
c = curl.easy{ url = path, post = true, httpheader = { "Content-Type: application/json"; }; postfields = body; }
c:perform{ writefunction = function(s) res = s end }
statuscode = c:getinfo_response_code()
return statuscode, res, body
end
Jurijs
On Tue, Aug 21, 2018 at 11:19 PM Jose David Jurado Alonso < josedavid@zennio.com> wrote:
Thank you very much David, if you find the script it would be a great help.
I have been on vacation and I have not been able to try much more in this time.
2018-08-03 20:07 GMT+02:00 David Villasmil < david.villasmil.work@gmail.com>:
Oh this took me some time to figure out, i'll dig up ny script and share it with you.
On Fri, Aug 3, 2018, 13:16 Jose David Jurado Alonso < josedavid@zennio.com> wrote:
Hi,
I have tried to make a HTTP POST request from LUA script but it does not work correctly in any way.
This is an example of the errors that I have obtained:
09802b39-524f-4011-ada7-418e6a870248 2018-08-03 12:23:07.981581 [ERR] mod_lua.cpp:203 error loading module socket.core from file /usr/local/lib/lua/5.1/socket/core.so: 09802b39-524f-4011-ada7-418e6a870248 /usr/local/lib/lua/5.1/socket/core.so: undefined symbol: lua_pcall 09802b39-524f-4011-ada7-418e6a870248 stack traceback: 09802b39-524f-4011-ada7-418e6a870248 [C]: in ? 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/local/share/lua/5.1/socket.lua:12: in main chunk 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/local/share/lua/5.1/socket/http.lua:10: in main chunk 09802b39-524f-4011-ada7-418e6a870248 [C]: in function require 09802b39-524f-4011-ada7-418e6a870248 /usr/share/freeswitch/scripts/test.lua:3: in main chunk
The lua script is:
local http = require "socket.http";
local req_url = "http://localhost/"
http.request{ url = req_url, method = "POST" }
I tried several tutorials and several configurations:
- https://freeswitch.org/confluence/display/FREESWITCH/Installing+LuaSocket - https://freeswitch.org/confluence/display/FREESWITCH/Third+Party+Libraries with https://luarocks.org/modules/jakeg/lua-requests <https://luarocks.org/modules/jakeg/lua-requests>
And some other things that I do not remember but always fail for some "undefined symbol".
Any ideas? Thanks!
José D.
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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 https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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 https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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 https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://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 https://freeswitch.com
participants (4)
-
David Villasmil
-
Joel Serrano
-
Jose David Jurado Alonso
-
Jurijs Ivolga