Update indentation for blf_subscribe.lua (#6873)
This commit is contained in:
parent
a2c54d98b4
commit
0de35ef4d7
|
|
@ -46,96 +46,96 @@ end
|
||||||
|
|
||||||
local find_call_flow do
|
local find_call_flow do
|
||||||
|
|
||||||
local find_call_flow_sql = [[select t1.call_flow_uuid, t1.call_flow_status
|
local find_call_flow_sql = [[select t1.call_flow_uuid, t1.call_flow_status
|
||||||
from v_call_flows t1 inner join v_domains t2 on t1.domain_uuid = t2.domain_uuid
|
from v_call_flows t1 inner join v_domains t2 on t1.domain_uuid = t2.domain_uuid
|
||||||
where t2.domain_name = :domain_name and (t1.call_flow_feature_code = :feature_code
|
where t2.domain_name = :domain_name and (t1.call_flow_feature_code = :feature_code
|
||||||
or t1.call_flow_feature_code = :short_feature_code)
|
or t1.call_flow_feature_code = :short_feature_code)
|
||||||
]]
|
]]
|
||||||
|
|
||||||
function find_call_flow(user)
|
function find_call_flow(user)
|
||||||
local ext, domain_name = split_first(user, '@', true)
|
local ext, domain_name = split_first(user, '@', true)
|
||||||
local _, short = split_first(ext, '+', true)
|
local _, short = split_first(ext, '+', true)
|
||||||
if not domain_name then return end
|
if not domain_name then return end
|
||||||
local dbh = Database.new('system')
|
local dbh = Database.new('system')
|
||||||
if not dbh then return end
|
if not dbh then return end
|
||||||
local row = dbh:first_row(find_call_flow_sql, {
|
local row = dbh:first_row(find_call_flow_sql, {
|
||||||
domain_name = domain_name, feature_code = ext, short_feature_code = short
|
domain_name = domain_name, feature_code = ext, short_feature_code = short
|
||||||
})
|
})
|
||||||
dbh:release()
|
dbh:release()
|
||||||
if not row then return end
|
if not row then return end
|
||||||
return row.call_flow_uuid, row.call_flow_status
|
return row.call_flow_uuid, row.call_flow_status
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local find_dnd do
|
local find_dnd do
|
||||||
|
|
||||||
local find_dnd_sql = [[select t1.do_not_disturb
|
local find_dnd_sql = [[select t1.do_not_disturb
|
||||||
from v_extensions t1 inner join v_domains t2 on t1.domain_uuid = t2.domain_uuid
|
from v_extensions t1 inner join v_domains t2 on t1.domain_uuid = t2.domain_uuid
|
||||||
where t2.domain_name = :domain_name and (t1.extension = :extension or t1.number_alias=:extension)]]
|
where t2.domain_name = :domain_name and (t1.extension = :extension or t1.number_alias=:extension)]]
|
||||||
|
|
||||||
find_dnd = function(user)
|
find_dnd = function(user)
|
||||||
local ext, domain_name = split_first(user, '@', true)
|
local ext, domain_name = split_first(user, '@', true)
|
||||||
if not domain_name then return end
|
if not domain_name then return end
|
||||||
local dbh = Database.new('system')
|
local dbh = Database.new('system')
|
||||||
if not dbh then return end
|
if not dbh then return end
|
||||||
local dnd = dbh:first_value(find_dnd_sql, {domain_name = domain_name, extension = ext})
|
local dnd = dbh:first_value(find_dnd_sql, {domain_name = domain_name, extension = ext})
|
||||||
dbh:release()
|
dbh:release()
|
||||||
return dnd
|
return dnd
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local find_call_forward do
|
local find_call_forward do
|
||||||
|
|
||||||
local find_call_forward_sql = [[select t1.forward_all_destination, t1.forward_all_enabled
|
local find_call_forward_sql = [[select t1.forward_all_destination, t1.forward_all_enabled
|
||||||
from v_extensions t1 inner join v_domains t2 on t1.domain_uuid = t2.domain_uuid
|
from v_extensions t1 inner join v_domains t2 on t1.domain_uuid = t2.domain_uuid
|
||||||
where t2.domain_name = :domain_name and (t1.extension = :extension or t1.number_alias=:extension)]]
|
where t2.domain_name = :domain_name and (t1.extension = :extension or t1.number_alias=:extension)]]
|
||||||
|
|
||||||
find_call_forward = function(user)
|
find_call_forward = function(user)
|
||||||
local ext, domain_name, number = split_first(user, '@', true)
|
local ext, domain_name, number = split_first(user, '@', true)
|
||||||
if not domain_name then return end
|
if not domain_name then return end
|
||||||
ext, number = split_first(ext, '/', true)
|
ext, number = split_first(ext, '/', true)
|
||||||
local dbh = Database.new('system')
|
local dbh = Database.new('system')
|
||||||
if not dbh then return end
|
if not dbh then return end
|
||||||
local row = dbh:first_row(find_call_forward_sql, {domain_name = domain_name, extension = ext})
|
local row = dbh:first_row(find_call_forward_sql, {domain_name = domain_name, extension = ext})
|
||||||
dbh:release()
|
dbh:release()
|
||||||
if not (row and row.forward_all_enabled) then return end
|
if not (row and row.forward_all_enabled) then return end
|
||||||
if row.forward_all_enabled ~= 'true' then return 'false' end
|
if row.forward_all_enabled ~= 'true' then return 'false' end
|
||||||
if number then
|
if number then
|
||||||
return number == row.forward_all_destination and 'true' or 'false',
|
return number == row.forward_all_destination and 'true' or 'false',
|
||||||
row.forward_all_destination
|
row.forward_all_destination
|
||||||
|
end
|
||||||
|
return 'true', row.forward_all_destination
|
||||||
end
|
end
|
||||||
return 'true', row.forward_all_destination
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local find_agent_status do
|
local find_agent_status do
|
||||||
|
|
||||||
local find_agent_uuid_sql = [[select t1.call_center_agent_uuid
|
local find_agent_uuid_sql = [[select t1.call_center_agent_uuid
|
||||||
from v_call_center_agents t1 inner join v_domains t2 on t1.domain_uuid = t2.domain_uuid
|
from v_call_center_agents t1 inner join v_domains t2 on t1.domain_uuid = t2.domain_uuid
|
||||||
where t2.domain_name = :domain_name and t1.agent_name = :agent_name
|
where t2.domain_name = :domain_name and t1.agent_name = :agent_name
|
||||||
]]
|
]]
|
||||||
|
|
||||||
function find_agent_status(user)
|
function find_agent_status(user)
|
||||||
local agent_name, domain_name = split_first(user, '@', true)
|
local agent_name, domain_name = split_first(user, '@', true)
|
||||||
local _, short = split_first(agent_name, '+', true)
|
local _, short = split_first(agent_name, '+', true)
|
||||||
if not domain_name then return end
|
if not domain_name then return end
|
||||||
local dbh = Database.new('system')
|
local dbh = Database.new('system')
|
||||||
if not dbh then return end
|
if not dbh then return end
|
||||||
local row = dbh:first_row(find_agent_uuid_sql, {
|
local row = dbh:first_row(find_agent_uuid_sql, {
|
||||||
domain_name = domain_name, agent_name = agent_name
|
domain_name = domain_name, agent_name = agent_name
|
||||||
})
|
})
|
||||||
dbh:release()
|
dbh:release()
|
||||||
if not row then return end
|
if not row then return end
|
||||||
if row.call_center_agent_uuid then
|
if row.call_center_agent_uuid then
|
||||||
local cmd = "callcenter_config agent get status "..row.call_center_agent_uuid.."";
|
local cmd = "callcenter_config agent get status "..row.call_center_agent_uuid.."";
|
||||||
freeswitch.consoleLog("notice", "[user status][login] "..cmd.."\n");
|
freeswitch.consoleLog("notice", "[user status][login] "..cmd.."\n");
|
||||||
user_status = trim(api:executeString(cmd));
|
user_status = trim(api:executeString(cmd));
|
||||||
|
end
|
||||||
|
return row.call_center_agent_uuid, user_status
|
||||||
end
|
end
|
||||||
return row.call_center_agent_uuid, user_status
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue