diff --git a/app/conference_centers/app_config.php b/app/conference_centers/app_config.php index 81fc55fdb8..a285469752 100644 --- a/app/conference_centers/app_config.php +++ b/app/conference_centers/app_config.php @@ -5,7 +5,7 @@ $apps[$x]['uuid'] = "8d083f5a-f726-42a8-9ffa-8d28f848f10e"; $apps[$x]['category'] = "Switch"; $apps[$x]['subcategory'] = ""; - $apps[$x]['version'] = "1.0"; + $apps[$x]['version'] = "1.1"; $apps[$x]['license'] = "Mozilla Public License 1.1"; $apps[$x]['url'] = "http://www.fusionpbx.com"; $apps[$x]['description']['en-us'] = "Conferences Centers allows one or more audio and video conference rooms."; @@ -205,6 +205,14 @@ $apps[$x]['default_settings'][$y]['default_setting_value'] = "false"; $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; $apps[$x]['default_settings'][$y]['default_setting_description'] = "Enable Conference Sessions"; + $y++; + $apps[$x]['default_settings'][$y]['default_setting_uuid'] = "b1a4e1b7-8201-4637-b2fb-380b67112ea5"; + $apps[$x]['default_settings'][$y]['default_setting_category'] = "conference_center"; + $apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "accountcode_enabled"; + $apps[$x]['default_settings'][$y]['default_setting_name'] = "boolean"; + $apps[$x]['default_settings'][$y]['default_setting_value'] = "false"; + $apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; + $apps[$x]['default_settings'][$y]['default_setting_description'] = "Request the account ID."; //cache details $apps[$x]['cache']['key'] = "dialplan.\${domain_name}"; diff --git a/app/scripts/resources/scripts/app/conference_center/index.lua b/app/scripts/resources/scripts/app/conference_center/index.lua index c0c6fbf278..c1d3585619 100644 --- a/app/scripts/resources/scripts/app/conference_center/index.lua +++ b/app/scripts/resources/scripts/app/conference_center/index.lua @@ -1,6 +1,6 @@ -- conference_center/index.lua -- Part of FusionPBX --- Copyright (C) 2013 - 2015 Mark J Crane +-- Copyright (C) 2013 - 2021 Mark J Crane -- 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 -