Add. Support multiple events. (#1736)

Now subscriber stops and remove pid files when FS shutdown.
So if you use Status->Services you will see correct status.
This commit is contained in:
Alexey Melnichuk
2016-07-06 21:37:16 +03:00
committed by FusionPBX
parent e6567d6d8d
commit 3d1f5b6866
3 changed files with 62 additions and 29 deletions

View File

@@ -1,10 +1,23 @@
local ievents = function(events, ...)
if type(events) == 'string' then
events = freeswitch.EventConsumer(events)
elseif type(events) == 'table' then
local array = events
events = freeswitch.EventConsumer()
for _, event in ipairs(array) do
local base, sub
if type(event) == 'table' then
base, sub = event[1], event[2]
else
base = event
end
if not sub then events:bind(base)
else events:bind(base, sub) end
end
end
local block, timeout = ...
if timeout == 0 then block, timeout = 0, 0 end
if timeout and (timeout == 0) then block, timeout = 0, 0 end
timeout = timeout or 0
return function()