mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-02-08 08:59:19 +00:00
Add service script and make timout optional for EventConsumer ctor (#1775)
* Change. Pass pid file first. Because there really no need pass timeout. Add. `fsc` script to be able shutdown MWI and Call Flow subscribe services. * Change. rename `fsc` to `service`. * Change. Use `stop` command instead of `shutdown`
This commit is contained in:
committed by
FusionPBX
parent
32ef5c7203
commit
d47151ba8d
@@ -27,11 +27,10 @@ end
|
||||
|
||||
end
|
||||
|
||||
local sleep = 60000
|
||||
local service_name = "flow"
|
||||
local pid_file = scripts_dir .. "/run/call_flow_subscribe.tmp"
|
||||
local shutdown_event = "CUSTOM::fusion::flow::shutdown"
|
||||
|
||||
local events = EventConsumer.new(sleep, pid_file)
|
||||
local events = EventConsumer.new(pid_file)
|
||||
|
||||
-- FS shutdown
|
||||
events:bind("SHUTDOWN", function(self, name, event)
|
||||
@@ -39,13 +38,16 @@ events:bind("SHUTDOWN", function(self, name, event)
|
||||
return self:stop()
|
||||
end)
|
||||
|
||||
-- shutdown command
|
||||
if shutdown_event then
|
||||
events:bind(shutdown_event, function(self, name, event)
|
||||
log.notice("shutdown")
|
||||
-- Control commands from FusionPBX
|
||||
events:bind("CUSTOM::fusion::service::" .. service_name, function(self, name, event)
|
||||
local command = event:getHeader('service-command')
|
||||
if command == "stop" then
|
||||
log.notice("get stop command")
|
||||
return self:stop()
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
log.warningf('Unknown service command: %s', command or '<NONE>')
|
||||
end)
|
||||
|
||||
-- FS receive SUBSCRIBE to BLF from device
|
||||
events:bind("PRESENCE_PROBE", function(self, name, event)
|
||||
|
||||
Reference in New Issue
Block a user