Add. Support bridge mode to call forward from Lua. (#1631)

This commit is contained in:
Alexey Melnichuk
2016-06-08 16:33:55 +03:00
committed by FusionPBX
parent 96d576fc7a
commit add8222cff
2 changed files with 297 additions and 1 deletions

View File

@@ -45,6 +45,7 @@
local log = require "resources.functions.log".call_forward
local cache = require "resources.functions.cache"
local Database = require "resources.functions.database"
local route_to_bridge = require "resources.functions.route_to_bridge"
local function opt(t, ...)
if select('#', ...) == 0 then
@@ -265,7 +266,20 @@
dial_string = dial_string .. "user/"..forward_all_destination.."@"..domain_name;
end
else
dial_string = dial_string .. "loopback/"..forward_all_destination;
local mode = opt(settings(domain_uuid), 'domain', 'bridge', 'text')
if mode == "outbound" or mode == "bridge" then
local bridge = route_to_bridge(dbh, domain_uuid, {
destination_number = forward_all_destination;
['${toll_allow}'] = toll_allow;
})
if bridge and bridge.bridge then
dial_string = dial_string .. bridge.bridge
else
log.warning('Can not build dialstring for call forward number.')
end
else
dial_string = dial_string .. "loopback/"..forward_all_destination;
end
end
end