Fix a bug with follow me where disabling it didn't clear the dial string.

This commit is contained in:
Mark Crane 2013-01-17 06:14:31 +00:00
parent 6b248ebcf4
commit bc2f56ba4b
4 changed files with 14 additions and 56 deletions

View File

@ -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 "<meta http-equiv=\"refresh\" content=\"3;url=".PROJECT_PATH."/app/calls/calls.php\">\n";

View File

@ -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

View File

@ -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

View File

@ -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