mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Additional boolean changes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
-- conference_center/index.lua
|
||||
-- Part of FusionPBX
|
||||
-- Copyright (C) 2013 - 2021 Mark J Crane <markjcrane@fusionpbx.com>
|
||||
-- Copyright (C) 2013 - 2025 Mark J Crane <markjcrane@fusionpbx.com>
|
||||
-- All rights reserved.
|
||||
--
|
||||
-- Redistribution and use in source and binary forms, with or without
|
||||
@@ -417,7 +417,8 @@
|
||||
--conference center details
|
||||
local sql = [[SELECT * FROM v_conference_centers
|
||||
WHERE domain_uuid = :domain_uuid
|
||||
AND conference_center_extension = :destination_number]];
|
||||
AND conference_center_extension = :destination_number
|
||||
AND conference_center_enabled = true]];
|
||||
local params = {domain_uuid = domain_uuid, destination_number = destination_number};
|
||||
dbh:query(sql, params, function(row)
|
||||
conference_center_uuid = string.lower(row["conference_center_uuid"]);
|
||||
@@ -498,7 +499,7 @@
|
||||
local sql = [[SELECT * FROM v_conference_rooms
|
||||
WHERE domain_uuid = :domain_uuid
|
||||
AND (moderator_pin = :pin_number or participant_pin = :pin_number)
|
||||
AND enabled = 'true'
|
||||
AND enabled = true
|
||||
AND (
|
||||
( start_datetime <> '' AND start_datetime is not null AND start_datetime <= :timestamp ) OR
|
||||
( start_datetime = '' OR start_datetime is null )
|
||||
@@ -546,7 +547,7 @@
|
||||
WHERE domain_uuid = :domain_uuid
|
||||
AND conference_center_uuid = :conference_center_uuid
|
||||
AND (moderator_pin = :pin_number or participant_pin = :pin_number)
|
||||
AND enabled = 'true'
|
||||
AND enabled = true
|
||||
]];
|
||||
local params = {
|
||||
domain_uuid = domain_uuid;
|
||||
@@ -560,7 +561,7 @@
|
||||
conference_room_uuid = string.lower(row["conference_room_uuid"]);
|
||||
conference_room_name = string.lower(row["conference_room_name"]);
|
||||
--meeting_uuid = string.lower(row["meeting_uuid"]);
|
||||
record = string.lower(row["record"]);
|
||||
record = row["record"];
|
||||
profile = string.lower(row["profile"]);
|
||||
max_members = row["max_members"];
|
||||
wait_mod = row["wait_mod"];
|
||||
@@ -581,6 +582,18 @@
|
||||
freeswitch.consoleLog("INFO","conference_room_uuid: " .. conference_room_uuid .. "\n");
|
||||
end
|
||||
|
||||
--set the boolean settings to a true or false string
|
||||
record = record and "true" or "false";
|
||||
wait_mod = wait_mod and "true" or "false";
|
||||
sounds = sounds and "true" or "false";
|
||||
mute = mute and "true" or "false";
|
||||
enabled = enabled and "true" or "false";
|
||||
announce_name = announce_name and "true" or "false";
|
||||
announce_count = announce_count and "true" or "false";
|
||||
announce_recording = announce_recording and "true" or "false";
|
||||
moderator_endconf = moderator_endconf and "true" or "false";
|
||||
|
||||
|
||||
--set the member type
|
||||
if (pin_number == moderator_pin) then
|
||||
member_type = "moderator";
|
||||
|
||||
@@ -291,7 +291,7 @@
|
||||
local sql = [[SELECT * FROM v_voicemails
|
||||
WHERE domain_uuid = :domain_uuid
|
||||
AND voicemail_id = :voicemail_id
|
||||
AND voicemail_enabled = 'true' ]];
|
||||
AND voicemail_enabled = true ]];
|
||||
local params = {domain_uuid = domain_uuid, voicemail_id = voicemail_id};
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
|
||||
@@ -309,16 +309,11 @@
|
||||
voicemail_tutorial = row["voicemail_tutorial"];
|
||||
end);
|
||||
|
||||
--set default values
|
||||
if (voicemail_attach_file == nil) then
|
||||
voicemail_attach_file = "true";
|
||||
end
|
||||
if (voicemail_local_after_email == nil) then
|
||||
voicemail_local_after_email = "true";
|
||||
end
|
||||
if (voicemail_local_after_forward == nil) then
|
||||
voicemail_local_after_forward = "true";
|
||||
end
|
||||
--set boolean values as a string
|
||||
voicemail_attach_file = voicemail_attach_file and "true" or "false";
|
||||
voicemail_local_after_email = voicemail_local_after_email and "true" or "false";
|
||||
voicemail_local_after_forward = voicemail_local_after_forward and "true" or "false";
|
||||
voicemail_tutorial = voicemail_tutorial and "true" or "false";
|
||||
|
||||
--valid voicemail
|
||||
if (voicemail_uuid ~= nil and string.len(voicemail_uuid) > 0) then
|
||||
@@ -417,13 +412,10 @@
|
||||
voicemail_local_after_forward = row["voicemail_local_after_forward"];
|
||||
end);
|
||||
|
||||
--set default values
|
||||
if (voicemail_local_after_email == nil) then
|
||||
voicemail_local_after_email = "true";
|
||||
end
|
||||
if (voicemail_local_after_forward == nil) then
|
||||
voicemail_local_after_forward = "true";
|
||||
end
|
||||
--set the boolean values as a string
|
||||
voicemail_local_after_email = voicemail_local_after_email and "true" or "false";
|
||||
voicemail_local_after_forward = voicemail_local_after_forward and "true" or "false";
|
||||
voicemail_local_after_forward = voicemail_local_after_forward and "true" or "false";
|
||||
|
||||
--get the message count and send the mwi event
|
||||
if (voicemail_local_after_email == 'true' or voicemail_local_after_forward == 'true') then
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
set voicemail_password = :password
|
||||
WHERE domain_uuid = :domain_uuid
|
||||
AND voicemail_id = :voicemail_id
|
||||
AND voicemail_enabled = 'true' ]];
|
||||
AND voicemail_enabled = true ]];
|
||||
local params = {password = password, domain_uuid = domain_uuid,
|
||||
voicemail_id = voicemail_id};
|
||||
if (debug["sql"]) then
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
local sql = [[SELECT * FROM v_voicemails
|
||||
WHERE domain_uuid = :domain_uuid
|
||||
AND voicemail_id = :voicemail_id
|
||||
AND voicemail_enabled = 'true' ]];
|
||||
AND voicemail_enabled = true ]];
|
||||
local params = {domain_uuid = domain_uuid, voicemail_id = voicemail_id};
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
local sql = [[SELECT * FROM v_voicemails
|
||||
WHERE domain_uuid = :domain_uuid
|
||||
AND voicemail_id = :voicemail_id
|
||||
AND voicemail_enabled = 'true' ]];
|
||||
AND voicemail_enabled = true ]];
|
||||
local params = {domain_uuid = domain_uuid, voicemail_id = forward_voicemail_id};
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
|
||||
|
||||
@@ -66,7 +66,8 @@
|
||||
local email_queue_enabled = settings:get('email_queue', 'enabled', 'boolean') or "false";
|
||||
|
||||
--get recording instructions and options settings
|
||||
local sql = [[SELECT voicemail_recording_instructions, voicemail_recording_options FROM v_voicemails
|
||||
local sql = [[SELECT voicemail_recording_instructions, voicemail_recording_options
|
||||
FROM v_voicemails
|
||||
WHERE domain_uuid = :domain_uuid
|
||||
AND voicemail_id = :voicemail_id ]];
|
||||
local params = {domain_uuid = domain_uuid, voicemail_id = voicemail_id};
|
||||
@@ -77,7 +78,7 @@
|
||||
|
||||
--check voicemail recording instructions setting
|
||||
if (skip_instructions == nil) then
|
||||
if (voicemail_recording_instructions == 'false') then
|
||||
if (not voicemail_recording_instructions) then
|
||||
skip_instructions = 'true';
|
||||
else
|
||||
skip_instructions = 'false';
|
||||
@@ -287,7 +288,7 @@
|
||||
end
|
||||
else
|
||||
if (skip_options == nil) then
|
||||
if (voicemail_recording_options == 'false') then
|
||||
if (voicemail_recording_options == false) then
|
||||
skip_options = 'true';
|
||||
else
|
||||
skip_options = 'false';
|
||||
|
||||
@@ -60,9 +60,9 @@ function send_email(id, uuid)
|
||||
if (voicemail_file == nil or voicemail_file == '') then
|
||||
voicemail_file = "listen";
|
||||
end
|
||||
if (voicemail_local_after_email == nil or voicemail_local_after_email == '') then
|
||||
voicemail_local_after_email = "true";
|
||||
end
|
||||
|
||||
--set the boolean values as a string
|
||||
voicemail_local_after_email = voicemail_local_after_email and "true" or "false";
|
||||
|
||||
--require the email address to send the email
|
||||
if (string.len(voicemail_mail_to) > 2) then
|
||||
@@ -92,7 +92,7 @@ function send_email(id, uuid)
|
||||
us.user_setting_category = 'domain' and
|
||||
us.user_setting_subcategory = 'time_zone' and
|
||||
us.user_setting_name = 'name' and
|
||||
us.user_setting_enabled = 'true'
|
||||
us.user_setting_enabled = true
|
||||
order by
|
||||
eu.insert_date asc
|
||||
limit 1
|
||||
@@ -204,6 +204,9 @@ function send_email(id, uuid)
|
||||
--get the link_address
|
||||
link_address = http_protocol.."://"..domain_name..project_path;
|
||||
|
||||
--set the boolean values as a string
|
||||
voicemail_local_after_email = voicemail_local_after_email and "true" or "false";
|
||||
|
||||
--set proper delete status
|
||||
local local_after_email = '';
|
||||
if (voicemail_local_after_email == "false") then
|
||||
|
||||
@@ -183,7 +183,7 @@
|
||||
set voicemail_tutorial = false
|
||||
WHERE domain_uuid = :domain_uuid
|
||||
AND voicemail_id = :voicemail_id
|
||||
AND voicemail_enabled = 'true' ]];
|
||||
AND voicemail_enabled = true ]];
|
||||
local params = {domain_uuid = domain_uuid,
|
||||
voicemail_id = voicemail_id};
|
||||
if (debug["sql"]) then
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
FROM v_voicemail_messages as m, v_voicemails as v, v_domains as d
|
||||
WHERE v.voicemail_uuid = m.voicemail_uuid
|
||||
AND v.domain_uuid = d.domain_uuid
|
||||
AND v.voicemail_enabled = 'true'
|
||||
AND v.voicemail_enabled = true
|
||||
GROUP BY v.voicemail_id, v.voicemail_uuid, v.domain_uuid, d.domain_name;]];
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "\n");
|
||||
|
||||
@@ -13,7 +13,7 @@ local vm_message_count do
|
||||
|
||||
local vm_to_uuid_sql = [[SELECT v.voicemail_uuid
|
||||
FROM v_voicemails as v inner join v_domains as d on v.domain_uuid = d.domain_uuid
|
||||
WHERE v.voicemail_enabled = 'true' and v.voicemail_id = :voicemail_id and d.domain_name = :domain_name]]
|
||||
WHERE v.voicemail_enabled = true and v.voicemail_id = :voicemail_id and d.domain_name = :domain_name]]
|
||||
|
||||
local vm_messages_sql = [[SELECT
|
||||
( SELECT count(*)
|
||||
|
||||
@@ -143,7 +143,7 @@
|
||||
extension = row.extension;
|
||||
local number_alias = row.number_alias or '';
|
||||
local accountcode = row.accountcode;
|
||||
local forward_all_enabled = row.forward_all_enabled;
|
||||
local forward_all_enabled = row.forward_all_enabled and "true" or "false";
|
||||
local last_forward_all_destination = row.forward_all_destination;
|
||||
local toll_allow = row.toll_allow or '';
|
||||
|
||||
|
||||
@@ -106,6 +106,9 @@
|
||||
context = row.user_context;
|
||||
end);
|
||||
|
||||
forward_all_enabled = forward_all_enabled and "true" or "false";
|
||||
do_not_disturb = do_not_disturb and "true" or "false";
|
||||
|
||||
--send information to the console
|
||||
if (session:ready()) then
|
||||
freeswitch.consoleLog("NOTICE", "[do_not_disturb] do_not_disturb "..do_not_disturb.."\n");
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
local follow_me_enabled = row.follow_me_enabled;
|
||||
|
||||
--set follow me
|
||||
if (follow_me_enabled == false) then
|
||||
if (not follow_me_enabled) then
|
||||
--update the display and play a message
|
||||
channel_display(session:get_uuid(), "Activated")
|
||||
session:execute("sleep", "2000");
|
||||
@@ -92,7 +92,7 @@
|
||||
end
|
||||
|
||||
--unset follow me
|
||||
if (follow_me_enabled == true) then
|
||||
if (follow_me_enabled) then
|
||||
--update the display and play a message
|
||||
channel_display(session:get_uuid(), "Cancelled")
|
||||
session:execute("sleep", "2000");
|
||||
@@ -102,7 +102,7 @@
|
||||
|
||||
--enable or disable follow me
|
||||
sql = "update v_follow_me set ";
|
||||
if (follow_me_enabled == true) then
|
||||
if (follow_me_enabled) then
|
||||
sql = sql .. "follow_me_enabled = false ";
|
||||
else
|
||||
sql = sql .. "follow_me_enabled = true ";
|
||||
@@ -117,13 +117,13 @@
|
||||
|
||||
--update the extension
|
||||
sql = "update v_extensions set ";
|
||||
sql = sql .. "do_not_disturb = false, ";
|
||||
if (follow_me_enabled == true) then
|
||||
sql = sql .. "follow_me_enabled = false, ";
|
||||
sql = sql .. "do_not_disturb = 'false', ";
|
||||
if (follow_me_enabled) then
|
||||
sql = sql .. "follow_me_enabled = 'false', ";
|
||||
else
|
||||
sql = sql .. "follow_me_enabled = true, ";
|
||||
sql = sql .. "follow_me_enabled = 'true', ";
|
||||
end
|
||||
sql = sql .. "forward_all_enabled = false ";
|
||||
sql = sql .. "forward_all_enabled = 'false' ";
|
||||
sql = sql .. "where domain_uuid = :domain_uuid ";
|
||||
sql = sql .. "and extension_uuid = :extension_uuid ";
|
||||
local params = {domain_uuid=domain_uuid, extension_uuid=extension_uuid};
|
||||
|
||||
@@ -432,7 +432,7 @@
|
||||
end
|
||||
|
||||
--direct dial
|
||||
if ivr_menu_direct_dial == true and #digits > 0 and #digits < 6 then
|
||||
if (ivr_menu_direct_dial and #digits > 0 and #digits < 6) then
|
||||
-- remove *#
|
||||
digits = digits:gsub("[*#]", "");
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
local sql = [[SELECT * FROM v_pin_numbers
|
||||
WHERE pin_number = :digits
|
||||
AND domain_uuid = :domain_uuid
|
||||
AND enabled = 'true' ]];
|
||||
AND enabled = true ]];
|
||||
local params = {digits = digits, domain_uuid = domain_uuid};
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("NOTICE", "[pin_number] SQL: "..sql.."; params: " .. json.encode(params) .. "\n");
|
||||
@@ -130,7 +130,7 @@
|
||||
WHERE voicemail_id = :user_ext
|
||||
AND voicemail_password = :digits
|
||||
AND domain_uuid = :domain_uuid
|
||||
AND voicemail_enabled = 'true' ]];
|
||||
AND voicemail_enabled = true ]];
|
||||
local params = {user_ext = user_ext, digits = digits, domain_uuid = domain_uuid};
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("NOTICE", "[pin_number] SQL: "..sql.."; params: " .. json.encode(params) .. "\n");
|
||||
|
||||
Reference in New Issue
Block a user