mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-02-20 01:55:02 +00:00
Add. BLF indication for call forward. (#2664)
* Add. BLF indication for call forward. To display general status of CallForward use blf like `forward+<extension>` To display status for specific phone number use blf like `forward+<extension>/<number>` * Fix. Escape variable in regex expression. * Fix. Sync DND and CF blf. * Add. `blf_subscribe` service which can handle all custom subscriptions. To run for specific protocol it possible run as `luarun blf_subscribe.lua <PROTO>`
This commit is contained in:
committed by
FusionPBX
parent
0140ae098d
commit
515fc15767
@@ -0,0 +1,60 @@
|
||||
require "resources.functions.config"
|
||||
|
||||
local EventConsumer = require "resources.functions.event_consumer".EventConsumer
|
||||
|
||||
local function class(base)
|
||||
local t = base and setmetatable({}, base) or {}
|
||||
t.__index = t
|
||||
t.__class = t
|
||||
t.__base = base
|
||||
|
||||
function t.new(...)
|
||||
local o = setmetatable({}, t)
|
||||
if o.__init then
|
||||
if t == ... then -- we call as Class:new()
|
||||
return o:__init(select(2, ...))
|
||||
else -- we call as Class.new()
|
||||
return o:__init(...)
|
||||
end
|
||||
end
|
||||
return o
|
||||
end
|
||||
|
||||
return t
|
||||
end
|
||||
|
||||
local BasicEventService = class(EventConsumer) do
|
||||
|
||||
function BasicEventService:__init(log, service_name, timeout)
|
||||
local pid_file = scripts_dir .. "/run/" .. service_name .. ".tmp"
|
||||
|
||||
self = BasicEventService.__base.__init(self, pid_file, timeout)
|
||||
|
||||
-- FS shutdown
|
||||
self:bind("SHUTDOWN", function(self, name, event)
|
||||
log.notice("shutdown")
|
||||
return self:stop()
|
||||
end)
|
||||
|
||||
-- Control commands from FusionPBX
|
||||
self:bind("CUSTOM::fusion::service::control", function(self, name, event)
|
||||
if service_name ~= event:getHeader('service-name') then return end
|
||||
|
||||
local command = event:getHeader('service-command')
|
||||
if command == "stop" then
|
||||
log.notice("get stop command")
|
||||
return self:stop()
|
||||
end
|
||||
|
||||
log.warningf('Unknown service command: %s', command or '<NONE>')
|
||||
end)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return {
|
||||
BasicEventService = BasicEventService;
|
||||
new = BasicEventService.new;
|
||||
}
|
||||
Reference in New Issue
Block a user