[follow me] Persist follow me enabled when enabling DND or call forward (#6076)

If follow-me is enabled and then turning on DND or call-forward, follow-me should be enabled when disabling the DND or the call-forward.
This commit is contained in:
agree
2021-10-28 11:44:27 -04:00
committed by GitHub
parent fc35482f74
commit 113ade4fc5
4 changed files with 12 additions and 40 deletions

View File

@@ -511,11 +511,11 @@
echo " <strong>".$text['label-call_forward']."</strong>\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
$on_click = "document.getElementById('follow_me_disabled').checked=true; ";
$on_click .= "$('#tr_follow_me_settings').slideUp('fast'); ";
$on_click .= "document.getElementById('dnd_disabled').checked=true; ";
$on_click .= "document.getElementById('forward_all_destination').focus(); ";
echo " <label for='forward_all_disabled'><input type='radio' name='forward_all_enabled' id='forward_all_disabled' onclick=\"\" value='false' ".(($forward_all_enabled == "false" || $forward_all_enabled == "") ? "checked='checked'" : null)." /> ".$text['label-disabled']."</label> \n";
$on_click2 .= "(document.getElementById('follow_me_enabled').checked) ? $('#tr_follow_me_settings').slideDown('fast') : '' ";
echo " <label for='forward_all_disabled'><input type='radio' name='forward_all_enabled' id='forward_all_disabled' onclick=\"$on_click2\" value='false' ".(($forward_all_enabled == "false" || $forward_all_enabled == "") ? "checked='checked'" : null)." /> ".$text['label-disabled']."</label> \n";
echo " <label for='forward_all_enabled'><input type='radio' name='forward_all_enabled' id='forward_all_enabled' onclick=\"$on_click\" value='true' ".(($forward_all_enabled == "true") ? "checked='checked'" : null)." /> ".$text['label-enabled']."</label> \n";
unset($on_click);
echo "&nbsp;&nbsp;&nbsp;";
@@ -587,7 +587,7 @@
echo "</tr>\n";
echo "</table>\n";
if ($follow_me_enabled == "true") { $style = ''; } else { $style = 'display: none;'; }
if ($follow_me_enabled == "true" && $dnd_enabled != "true" && $forward_all_enabled != "true") { $style = ''; } else { $style = 'display: none;'; }
echo "<div id='tr_follow_me_settings' style='$style'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
@@ -685,9 +685,9 @@
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
$on_click = "document.getElementById('forward_all_disabled').checked=true;";
$on_click .= "document.getElementById('follow_me_disabled').checked=true;";
$on_click .= "$('#tr_follow_me_settings').slideUp('fast'); ";
echo " <label for='dnd_disabled'><input type='radio' name='dnd_enabled' id='dnd_disabled' value='false' onclick=\"\" ".(($dnd_enabled == "false" || $dnd_enabled == "") ? "checked='checked'" : null)." /> ".$text['label-disabled']."</label> \n";
$on_click2 .= "(document.getElementById('follow_me_enabled').checked) ? $('#tr_follow_me_settings').slideDown('fast') : '' ";
echo " <label for='dnd_disabled'><input type='radio' name='dnd_enabled' id='dnd_disabled' value='false' onclick=\"$on_click2\" ".(($dnd_enabled == "false" || $dnd_enabled == "") ? "checked='checked'" : null)." /> ".$text['label-disabled']."</label> \n";
echo " <label for='dnd_enabled'><input type='radio' name='dnd_enabled' id='dnd_enabled' value='true' onclick=\"$on_click\" ".(($dnd_enabled == "true") ? "checked='checked'" : null)." /> ".$text['label-enabled']."</label> \n";
echo " <br />\n";
echo "</td>\n";

View File

@@ -29,7 +29,7 @@
-- Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
--set the default
continue = true;
continue = true;
--get the action
action = params:getHeader("action");
@@ -358,8 +358,11 @@
-- get the follow me information
if (row.follow_me_uuid ~= nil and string.len(row.follow_me_uuid) > 0) then
follow_me_uuid = row.follow_me_uuid;
follow_me_enabled = row.follow_me_enabled;
--follow_me_destinations= row.follow_me_destinations;
if (do_not_disturb == "true" or forward_all_enabled == "true") then
follow_me_enabled = "false";
else
follow_me_enabled = row.follow_me_enabled;
end
end
-- check matching UserID and AuthName

View File

@@ -145,7 +145,6 @@
local accountcode = row.accountcode;
local forward_all_enabled = row.forward_all_enabled;
local last_forward_all_destination = row.forward_all_destination;
local follow_me_uuid = row.follow_me_uuid;
local toll_allow = row.toll_allow or '';
--toggle enabled
@@ -212,19 +211,6 @@
session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-call_forwarding_has_been_cancelled.wav");
end
--disable the follow me
if enabled == "true" and not empty(follow_me_uuid) then
local sql = "update v_follow_me set ";
sql = sql .. "follow_me_enabled = 'false' ";
sql = sql .. "where domain_uuid = :domain_uuid ";
sql = sql .. "and follow_me_uuid = :follow_me_uuid ";
local params = {domain_uuid = domain_uuid, follow_me_uuid = follow_me_uuid};
if (debug["sql"]) then
log.noticef("SQL: %s; params: %s", sql, json.encode(params));
end
dbh:query(sql, params);
end
--check the destination
if empty(forward_all_destination) then
enabled = "false";

View File

@@ -100,7 +100,6 @@
extension = row.extension;
number_alias = row.number_alias or '';
accountcode = row.accountcode;
follow_me_uuid = row.follow_me_uuid or nil;
do_not_disturb = row.do_not_disturb;
forward_all_destination = row.forward_all_destination;
forward_all_enabled = row.forward_all_enabled;
@@ -111,7 +110,6 @@
if (session:ready()) then
freeswitch.consoleLog("NOTICE", "[do_not_disturb] do_not_disturb "..do_not_disturb.."\n");
freeswitch.consoleLog("NOTICE", "[do_not_disturb] extension "..extension.."\n");
freeswitch.consoleLog("NOTICE", "[do_not_disturb] follow_me_uuid "..follow_me_uuid.."\n");
freeswitch.consoleLog("NOTICE", "[do_not_disturb] accountcode "..accountcode.."\n");
--freeswitch.consoleLog("NOTICE", "[do_not_disturb] enabled before "..enabled.."\n");
end
@@ -155,23 +153,9 @@
end
end
--update follow me
if (follow_me_uuid ~= nil and enabled == 'true') then
local sql = "update v_follow_me ";
sql = sql .. "set follow_me_enabled = 'false' ";
sql = sql .. "where domain_uuid = :domain_uuid ";
sql = sql .. "and follow_me_uuid = :follow_me_uuid ";
local params = {domain_uuid = domain_uuid, follow_me_uuid = follow_me_uuid};
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[do_not_disturb] "..sql.."; params:" .. json.encode(params) .. "\n");
end
dbh:query(sql, params);
end
--update the extension
sql = "update v_extensions set ";
if (enabled == "true") then
sql = sql .. "follow_me_enabled = 'false', ";
sql = sql .. "do_not_disturb = 'true', ";
sql = sql .. "forward_all_enabled = 'false' ";
else
@@ -185,7 +169,7 @@
end
dbh:query(sql, params);
--determine whether to update the dial string
--update the user and agent status
sql = "select * from v_extension_users as e, v_users as u ";
sql = sql .. "where e.extension_uuid = :extension_uuid ";
sql = sql .. "and e.user_uuid = u.user_uuid ";
@@ -201,7 +185,6 @@
api:execute("callcenter_config", "agent set status "..row.username.."@"..domain_name.." '"..user_status.."'");
end
--update the database user_status
if (enabled == "true") then
user_status = "Do Not Disturb";
else