That's interesting to know! Doubt that it's a syntax error, as that would happen all the time. However, there could be an issue on what happens if the CURL times out and throws an exception. Alex
Alex,
Does there happen to be a syntax error in the lua callback? There was a crash fixed recently(last few months) that dealt with lua not being able to properly handle an error in a function callback.
William King Senior Engineer Quentus Technologies, INC 1037 NE 65th St Suite 273 Seattle, WA 98115 Main: (877) 211-9337 Office: (206) 388-4772 Cell: (253) 686-5518 william.king@quentustech.com
On 05/14/2014 09:17 AM, Alex Lake wrote:
Got a script that uses Lua to hit a webserver while in the middle of a call to get instructions on what to do next.
It usually works very well.
However, it seems that sometimes (possibly a slow response?) this can cause freeswitch to fall over. Any suggestions on ways to deal with this?
This is FreeSWITCH Version 1.2.15+git~20131210T171529Z~fa43a37a82~64bit (git fa43a37 2013-12-10 17:15:29Z 64bit)
Thinks: From that version, I'm wondering if an update to latest stable release might be in order!
But I'll post this anyway...
I'm using luacurl with the following bit of Lua:
c = curl.new() text = {} c:setopt(curl.OPT_URL,cc_url) c:setopt(curl.OPT_USERAGENT, "luacurl-agent/1.0") c:setopt(curl.OPT_HTTPGET, true) c:setopt(curl.OPT_CONNECTTIMEOUT, 1) c:setopt(curl.OPT_TIMEOUT, 1) c:setopt(curl.OPT_ENCODING, "utf8") c:setopt(curl.OPT_WRITEFUNCTION, WriteMemoryCallback) c:perform() c:close() Rsp = table.concat(text,'')
with....
function WriteMemoryCallback(userparam,s) if s then text[#text+1] = s return string.len(s) else return 0 end end
So any suggestions on further diagnostics that I should post (is there a stacktrace or anything similar available?)
Or just observations on whether getting Lua to do such tricks is inadvisable and there is a better way!
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.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 http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.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 http://www.freeswitch.org
----- No virus found in this message. Checked by AVG - www.avg.com Version: 2014.0.4570 / Virus Database: 3950/7494 - Release Date: 05/14/14