diff --git a/app/calls/resources/classes/do_not_disturb.php b/app/calls/resources/classes/do_not_disturb.php index 9b240b462d..37fcef5e29 100644 --- a/app/calls/resources/classes/do_not_disturb.php +++ b/app/calls/resources/classes/do_not_disturb.php @@ -66,7 +66,7 @@ include "root.php"; global $db; //determine whether to update the dial string - $sql = "select * from v_extensions "; + $sql = "select extension_uuid, extension, number_alias from v_extensions "; $sql .= "where domain_uuid = '".$this->domain_uuid."' "; if (strlen($this->extension_uuid) > 0) { $sql .= "and extension_uuid = '".$this->extension_uuid."' "; @@ -83,7 +83,12 @@ include "root.php"; $this->extension_uuid = $row["extension_uuid"]; } if (strlen($this->extension) == 0) { - $this->extension = $row["extension"]; + if(strlen($row["number_alias"]) == 0) { + $this->extension = $row["extension"]; + } + else { + $this->extension = $row["number_alias"]; + } } } } @@ -114,4 +119,4 @@ include "root.php"; } //function } //class -?> +?> \ No newline at end of file diff --git a/resources/install/scripts/do_not_disturb.lua b/resources/install/scripts/do_not_disturb.lua index f48c426dee..f06164cb6a 100644 --- a/resources/install/scripts/do_not_disturb.lua +++ b/resources/install/scripts/do_not_disturb.lua @@ -78,20 +78,21 @@ sql = sql .. "where domain_uuid = '"..domain_uuid.."' "; sql = sql .. "and extension_uuid = '"..extension_uuid.."' "; if (debug["sql"]) then - freeswitch.consoleLog("notice", "[call_forward] "..sql.."\n"); + freeswitch.consoleLog("notice", "[do_not_disturb] "..sql.."\n"); end status = dbh:query(sql, function(row) extension = row.extension; number_alias = row.number_alias; accountcode = row.accountcode; follow_me_uuid = row.follow_me_uuid; - --freeswitch.consoleLog("NOTICE", "[call forward] extension "..row.extension.."\n"); - --freeswitch.consoleLog("NOTICE", "[call forward] accountcode "..row.accountcode.."\n"); + --freeswitch.consoleLog("NOTICE", "[do_not_disturb] extension "..row.extension.."\n"); + --freeswitch.consoleLog("NOTICE", "[do_not_disturb] accountcode "..row.accountcode.."\n"); end); --set the dial string if (enabled == "true") then - dial_string = "loopback/*99"..extension; + local ep = (number_alias and #number_alias > 0) and number_alias or extension; + dial_string = "loopback/*99"..ep; end --set do not disturb