mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-02-20 09:56:32 +00:00
Option to request accountcode when setting accountcode_enabled is set to true. (#6171)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
-- conference_center/index.lua
|
||||
-- Part of FusionPBX
|
||||
-- Copyright (C) 2013 - 2015 Mark J Crane <markjcrane@fusionpbx.com>
|
||||
-- Copyright (C) 2013 - 2021 Mark J Crane <markjcrane@fusionpbx.com>
|
||||
-- All rights reserved.
|
||||
--
|
||||
-- Redistribution and use in source and binary forms, with or without
|
||||
@@ -43,8 +43,9 @@
|
||||
dbh = Database.new('system');
|
||||
local settings = Settings.new(dbh, domain_name, domain_uuid);
|
||||
|
||||
--get the cache directory
|
||||
--get the settings
|
||||
session_enabled = settings:get('conference_center', 'session_enabled', 'boolean');
|
||||
accountcode_enabled = settings:get('conference_center', 'accountcode_enabled', 'boolean');
|
||||
|
||||
--include json library
|
||||
local json
|
||||
@@ -581,6 +582,30 @@
|
||||
member_type = "participant";
|
||||
end
|
||||
|
||||
--get the accountcode
|
||||
if (accountcode_enabled == 'true' and member_type == 'moderator') then
|
||||
--request the accountcode
|
||||
min_digits = 2;
|
||||
max_digits = 20;
|
||||
accountcode = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", "phrase:voicemail_enter_id:#", "", "\\d+");
|
||||
--user_id = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-please_enter_extension_followed_by_pound.wav", "", "\\d+");
|
||||
|
||||
--update the account code
|
||||
local sql = {}
|
||||
table.insert(sql, "update v_conference_rooms ");
|
||||
table.insert(sql, "set accountcode = :accountcode ");
|
||||
table.insert(sql, "where conference_center_uuid = :conference_center_uuid ");
|
||||
sql = table.concat(sql, "\n");
|
||||
local params = {
|
||||
conference_center_uuid = conference_center_uuid;
|
||||
accountcode = accountcode;
|
||||
};
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[conference center] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
|
||||
end
|
||||
dbh:query(sql, params);
|
||||
end
|
||||
|
||||
--close the database connection
|
||||
dbh:release();
|
||||
|
||||
@@ -600,12 +625,14 @@
|
||||
end
|
||||
|
||||
--check if the conference exists
|
||||
cmd = "conference "..conference_room_uuid.."@"..domain_name.." xml_list";
|
||||
result = trim(api:executeString(cmd));
|
||||
if (string.sub(result, -9) == "not found") then
|
||||
conference_exists = false;
|
||||
else
|
||||
conference_exists = true;
|
||||
if (conference_room_uuid and domain_name) then
|
||||
cmd = "conference "..conference_room_uuid.."@"..domain_name.." xml_list";
|
||||
result = trim(api:executeString(cmd));
|
||||
if (string.sub(result, -9) == "not found") then
|
||||
conference_exists = false;
|
||||
else
|
||||
conference_exists = true;
|
||||
end
|
||||
end
|
||||
|
||||
--check if the conference is locked
|
||||
@@ -798,4 +825,3 @@
|
||||
freeswitch.consoleLog("INFO","[conference center] conference " .. cmd .. "\n");
|
||||
session:execute("conference", cmd);
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user