[Freeswitch-users] FS Crash when Lua's doing an http hit
Alex Lake
alex at digitalmail.com
Wed May 14 20:17:43 MSD 2014
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!
Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users
mailing list