[Freeswitch-users] FreeSwitch is blocking when doing "shutdown"

Mimiko vbvbrj at gmail.com
Fri Nov 23 15:29:33 MSK 2012


Hi.

I have a start-up script in lua.conf.xml for capture and log events:
<configuration name="lua.conf" description="LUA Configuration">
   <settings>
	...
     <param name="startup-script" value="callcenter-log-events-mysql.lua"/>
   </settings>
</configuration>


callcenter-log-events-mysql.lua contains a loop:

while true do
   local dbh = freeswitch.Dbh("freeswitch_data","freeswitch","freeswitch")
   while dbh:connected() do
     freeswitch.consoleLog("debug","Connected to DB.\n")
     while dbh:connected() do
       for e in (function() return conlocal:pop(1,1000) end) do
       freeswitch.consoleLog("debug","Event: " .. e:serialize("xml") .. 
"\n")
       if not dbh:connected() then
         freeswitch.consoleLog("debug",argv[0] .. ": Database 
disconnected\n")
         break
       end
       ccAction = e:getHeader("headername")
     end
   end
   dbh:release()
end


No, the problem is that when doing a shutdown command from FS_CLI, or 
service stop, FS does not terminate. ps xua | grep freeswitch shows the 
running process. I have to kill with -9 signal.

I tracked that this is related to the outermost while in my script.  If 
this script is not started at start-up, FS is not blocking on shutdown.

Is there a parameter in lua.conf.xml to instruct FS to terminate any 
running lua scripts? Or is a way to detect this in the script and break 
outermost while loop?

Thank you.

-- 
Mimiko desu.



Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list