mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-05 03:03:49 +00:00
When *78 or *79 are used for DND update the user status and agent status.
This commit is contained in:
@@ -142,6 +142,37 @@
|
||||
end
|
||||
dbh:query(sql);
|
||||
|
||||
--determine whether to update the dial string
|
||||
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 ";
|
||||
sql = sql .. "and e.domain_uuid = '"..domain_uuid.."' ";
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[do_not_disturb] "..sql.."\n");
|
||||
end
|
||||
status = dbh:query(sql, function(row)
|
||||
--update the call center status
|
||||
if (enabled == "true") then
|
||||
user_status = "Logged Out";
|
||||
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
|
||||
user_status = "Available";
|
||||
end
|
||||
sql = sql .. "update v_users set ";
|
||||
sql = sql .. "user_status = '"..user_status.."' ";
|
||||
sql = sql .. "where domain_uuid = '"..domain_uuid.."' ";
|
||||
sql = sql .. "and username = '"..row.user_uuid.."' ";
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[do_not_disturb] "..sql.."\n");
|
||||
end
|
||||
dbh:query(sql);
|
||||
end);
|
||||
|
||||
--clear the cache
|
||||
if (extension ~= nil) then
|
||||
api:execute("memcache", "delete directory:"..extension.."@"..domain_name);
|
||||
|
||||
Reference in New Issue
Block a user