From d6c4267243dda914bfb556e7cc0c8b23ae8370b2 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sat, 16 May 2015 23:38:07 +0000 Subject: [PATCH] Handle Do Not Disturb set on the extension for ring groups. --- .../install/scripts/app/ring_groups/index.lua | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/resources/install/scripts/app/ring_groups/index.lua b/resources/install/scripts/app/ring_groups/index.lua index 22bad0c3d7..128a613550 100644 --- a/resources/install/scripts/app/ring_groups/index.lua +++ b/resources/install/scripts/app/ring_groups/index.lua @@ -1,4 +1,3 @@ --- ring_groups.lua -- Part of FusionPBX -- Copyright (C) 2010-2015 Mark J Crane -- All rights reserved. @@ -154,13 +153,22 @@ cmd = "user_exists id ".. row.destination_number .." "..leg_domain_name; user_exists = api:executeString(cmd); if (user_exists == "true") then - row['user_exists'] = "true"; + --add user_exists true or false to the row array + row['user_exists'] = "true"; + --handle do_not_disturb + cmd = "user_data ".. row.destination_number .."@" ..leg_domain_name.." var do_not_disturb"; + if (api:executeString(cmd) ~= "true") then + --add the row to the destinations array + destinations[x] = row; + end else - external = "true"; - row['user_exists'] = "false"; + --set the values + external = "true"; + row['user_exists'] = "false"; + --add the row to the destinations array + destinations[x] = row; end - row['domain_name'] = leg_domain_name; - destinations[x] = row; + row['domain_name'] = leg_domain_name; x = x + 1; end)); --freeswitch.consoleLog("NOTICE", "[ring_group] external "..external.."\n");