diff --git a/app/calls/call_edit.php b/app/calls/call_edit.php index 9fdd5d85c7..a84b75e4b8 100644 --- a/app/calls/call_edit.php +++ b/app/calls/call_edit.php @@ -328,6 +328,16 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } } + //synchronize configuration + save_extension_xml(); + + //delete extension from memcache + $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); + if ($fp) { + $switch_cmd = "memcache delete directory:".$extension."@".$_SESSION['domain_name']; + $switch_result = event_socket_request($fp, 'api '.$switch_cmd); + } + //redirect the user require_once "includes/header.php"; echo "\n"; diff --git a/app/calls/resources/classes/switch_call_forward.php b/app/calls/resources/classes/switch_call_forward.php index 86dca350e9..1a3141ad64 100644 --- a/app/calls/resources/classes/switch_call_forward.php +++ b/app/calls/resources/classes/switch_call_forward.php @@ -35,7 +35,6 @@ include "root.php"; public $forward_all_destination; public $forward_all_enabled; private $dial_string; - private $dial_string_update = false; public function set() { //set the global variable @@ -59,22 +58,14 @@ include "root.php"; if (count($result) > 0) { foreach ($result as &$row) { $this->extension = $row["extension"]; - if ($this->forward_all_enabled == "false" && $row["forward_all_enabled"] == "true") { - $this->dial_string_update = true; - } } } unset ($prep_statement); - if ($this->forward_all_enabled == "true") { - $this->dial_string_update = true; - } //update the extension $sql = "update v_extensions set "; $sql .= "forward_all_destination = '$this->forward_all_destination', "; - if ($this->dial_string_update) { - $sql .= "dial_string = '".$this->dial_string."', "; - } + $sql .= "dial_string = '".$this->dial_string."', "; $sql .= "forward_all_enabled = '$this->forward_all_enabled' "; $sql .= "where domain_uuid = '$this->domain_uuid' "; $sql .= "and extension_uuid = '$this->extension_uuid' "; @@ -91,10 +82,6 @@ include "root.php"; $switch_result = event_socket_request($fp, 'api '.$switch_cmd); } - //syncrhonize configuration - if ($this->dial_string_update) { - save_extension_xml(); - } } //function } //class diff --git a/app/calls/resources/classes/switch_do_not_disturb.php b/app/calls/resources/classes/switch_do_not_disturb.php index abb8232dfe..53c9db70c3 100644 --- a/app/calls/resources/classes/switch_do_not_disturb.php +++ b/app/calls/resources/classes/switch_do_not_disturb.php @@ -34,7 +34,6 @@ include "root.php"; private $extension; public $enabled; private $dial_string; - private $dial_string_update = false; //update the user_status public function user_status() { @@ -76,15 +75,9 @@ include "root.php"; if (count($result) > 0) { foreach ($result as &$row) { $this->extension = $row["extension"]; - if ($this->enabled == "false" && $row["do_not_disturb"] == "true") { - $this->dial_string_update = true; - } } } unset ($prep_statement); - if ($this->enabled == "true") { - $this->dial_string_update = true; - } //set the dial string if ($this->enabled == "true") { @@ -96,9 +89,7 @@ include "root.php"; //update the extension $sql = "update v_extensions set "; - if ($this->dial_string_update) { - $sql .= "dial_string = '".$this->dial_string."', "; - } + $sql .= "dial_string = '".$this->dial_string."', "; //$sql .= "dial_domain = '".$this->domain_name."', "; $sql .= "do_not_disturb = '".$this->enabled."' "; $sql .= "where domain_uuid = '".$this->domain_uuid."' "; @@ -110,17 +101,6 @@ include "root.php"; $db->exec(check_sql($sql)); unset($sql); - //delete extension from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete directory:".$this->extension."@".$this->domain_name; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } - - //syncrhonize configuration - if ($this->dial_string_update) { - save_extension_xml(); - } } //function } //class diff --git a/app/calls/resources/classes/switch_follow_me.php b/app/calls/resources/classes/switch_follow_me.php index ba7ed92e81..a295243534 100644 --- a/app/calls/resources/classes/switch_follow_me.php +++ b/app/calls/resources/classes/switch_follow_me.php @@ -34,7 +34,6 @@ include "root.php"; public $call_prompt; public $follow_me_enabled; private $extension; - private $dial_string_update = false; public $destination_data_1; public $destination_type_1; @@ -272,15 +271,9 @@ include "root.php"; foreach ($result as &$row) { //$cid_name_prefix = $row["cid_name_prefix"]; $call_prompt = $row["call_prompt"]; - if ($this->follow_me_enabled == "false" && $row["follow_me_enabled"] == "true") { - $this->dial_string_update = true; - } } } unset ($prep_statement); - if ($this->follow_me_enabled == "true") { - $this->dial_string_update = true; - } //update the extension if ($this->follow_me_enabled == "true") { @@ -314,10 +307,9 @@ include "root.php"; else { $this->dial_string = ''; } + $sql = "update v_extensions set "; - if ($this->dial_string_update) { - $sql .= "dial_string = '".$this->dial_string."', "; - } + $sql .= "dial_string = '".$this->dial_string."', "; $sql .= "dial_domain = '".$_SESSION['domain_name']."' "; $sql .= "where domain_uuid = '".$this->domain_uuid."' "; $sql .= "and follow_me_uuid = '".$this->follow_me_uuid."' "; @@ -327,17 +319,6 @@ include "root.php"; $db->exec($sql); unset($sql); - //delete extension from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete directory:".$this->extension."@".$this->domain_name; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } - - //syncrhonize configuration - if ($this->dial_string_update) { - save_extension_xml(); - } } //function } //class