<div dir="ltr">Hi,<div><br>I have tried to make a HTTP POST request from LUA script but it does not work correctly in any way.<div><div><br></div><div>This is an example of the errors that I have obtained:
<div><br></div></div></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><div><div><div><font face="times new roman, serif">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:</font></div></div></div></div></div><div><div><div><div><font face="times new roman, serif">09802b39-524f-4011-ada7-418e6a870248 <span style="white-space:pre"> </span>/usr/local/lib/lua/5.1/socket/core.so: undefined symbol: lua_pcall</font></div></div></div></div><div><div><div><div><font face="times new roman, serif">09802b39-524f-4011-ada7-418e6a870248 stack traceback:</font></div></div></div></div><div><div><div><div><font face="times new roman, serif">09802b39-524f-4011-ada7-418e6a870248 <span style="white-space:pre"> </span>[C]: in ?</font></div></div></div></div><div><div><div><div><font face="times new roman, serif">09802b39-524f-4011-ada7-418e6a870248 <span style="white-space:pre"> </span>[C]: in function require</font></div></div></div></div><div><div><div><div><font face="times new roman, serif">09802b39-524f-4011-ada7-418e6a870248 <span style="white-space:pre"> </span>/usr/local/share/lua/5.1/socket.lua:12: in main chunk</font></div></div></div></div><div><div><div><div><font face="times new roman, serif">09802b39-524f-4011-ada7-418e6a870248 <span style="white-space:pre"> </span>[C]: in function require</font></div></div></div></div><div><div><div><div><font face="times new roman, serif">09802b39-524f-4011-ada7-418e6a870248 <span style="white-space:pre"> </span>/usr/local/share/lua/5.1/socket/http.lua:10: in main chunk</font></div></div></div></div><div><div><div><div><font face="times new roman, serif">09802b39-524f-4011-ada7-418e6a870248 <span style="white-space:pre"> </span>[C]: in function require</font></div></div></div></div><div><div><div><div><font face="times new roman, serif">09802b39-524f-4011-ada7-418e6a870248 <span style="white-space:pre"> </span>/usr/share/freeswitch/scripts/test.lua:3: in main chunk</font></div></div></div></div></blockquote><div><div><div><br></div></div><div><br></div><div>The lua script is:</div><div><br></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><div><font face="times new roman, serif">local http = require "socket.http";</font></div></div></div><div><div><div><font face="times new roman, serif"><br></font></div></div></div><div><div><div><font face="times new roman, serif">local req_url = "<a href="http://localhost/">http://localhost/</a>"</font></div></div></div><div><div><div><font face="times new roman, serif"><br></font></div></div></div><div><div><div><font face="times new roman, serif">http.request{</font></div></div></div><div><div><div><font face="times new roman, serif"> url = req_url,</font></div></div></div><div><div><div><font face="times new roman, serif"> method = "POST"</font></div></div></div><div><div><div><font face="times new roman, serif">}</font></div></div></div></blockquote><div><div><br></div><div><br></div><div>I tried several tutorials and several configurations:</div><div><br></div><div><ul><li><a href="https://freeswitch.org/confluence/display/FREESWITCH/Installing+LuaSocket">https://freeswitch.org/confluence/display/FREESWITCH/Installing+LuaSocket</a><br></li><li><a href="https://freeswitch.org/confluence/display/FREESWITCH/Third+Party+Libraries">https://freeswitch.org/confluence/display/FREESWITCH/Third+Party+Libraries</a> with <a href="https://luarocks.org/modules/jakeg/lua-requests"> https://luarocks.org/modules/jakeg/lua-requests</a><br></li></ul><div>And some other things that I do not remember but always fail for some "undefined symbol".</div></div></div><div><br></div><div>Any ideas? Thanks!</div><div><br></div><div>José D.</div></div>