Clear memcache as needed.

This commit is contained in:
Mark Crane 2013-01-16 00:26:48 +00:00
parent 6cc270827f
commit 751b1c721c
40 changed files with 404 additions and 131 deletions

View File

@ -170,6 +170,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//syncrhonize the configuration
save_call_center_xml();
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_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=\"2;url=call_center_queues.php\">\n";
@ -209,6 +216,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//syncrhonize the configuration
save_call_center_xml();
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_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=\"2;url=call_center_queue.php\">\n";

View File

@ -77,6 +77,13 @@ if (strlen($id)>0) {
//apply settings reminder
$_SESSION["reload_xml"] = true;
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
}
//redirect the user

View File

@ -339,6 +339,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//apply settings reminder
$_SESSION["reload_xml"] = true;
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//redirect the browser
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=call_flows.php\">\n";

View File

@ -87,7 +87,7 @@ include "root.php";
//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_cmd = "memcache delete directory:".$this->extension."@".$this->domain_name;
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}

View File

@ -113,7 +113,7 @@ include "root.php";
//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_cmd = "memcache delete directory:".$this->extension."@".$this->domain_name;
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}

View File

@ -330,7 +330,7 @@ include "root.php";
//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_cmd = "memcache delete directory:".$this->extension."@".$this->domain_name;
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}

View File

@ -72,6 +72,13 @@ if (strlen($id)>0) {
$db->query($sql);
unset($sql);
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//syncrhonize configuration
save_dialplan_xml();

View File

@ -264,6 +264,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$db->query($sql);
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//save the xml
save_dialplan_xml();

View File

@ -83,6 +83,14 @@ if (strlen($id)>0) {
//apply settings reminder
$_SESSION["reload_xml"] = true;
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
}
//redirect the user

View File

@ -217,20 +217,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$dialplan_detail_group = '2';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
//save the xml
save_dialplan_xml();
//apply settings reminder
$_SESSION["reload_xml"] = true;
//redirect the browser
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=conferences.php\">\n";
echo "<div align='center'>\n";
echo "".$text['confirm-add']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "add")
if ($action == "update") {
@ -285,21 +271,30 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$db->query($sql);
//save the xml
save_dialplan_xml();
//apply settings reminder
$_SESSION["reload_xml"] = true;
//redirect the browser
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=conferences.php\">\n";
echo "<div align='center'>\n";
echo "".$text['confirm-update']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "update")
//save the xml
save_dialplan_xml();
//apply settings reminder
$_SESSION["reload_xml"] = true;
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//redirect the browser
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=conferences.php\">\n";
echo "<div align='center'>\n";
echo "".$text['confirm-update']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)

View File

@ -240,13 +240,21 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//synchronize the xml config
save_dialplan_xml();
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//redirect the browser
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //end if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
?><script type="text/javascript">

View File

@ -136,6 +136,13 @@ else {
//synchronize the xml config
save_dialplan_xml();
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//redirect the user
require_once "includes/header.php";
switch ($app_uuid) {

View File

@ -78,6 +78,13 @@ if (strlen($dialplan_uuid)>0) {
//synchronize the xml config
save_dialplan_xml();
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
}
//redirect the user

View File

@ -56,6 +56,12 @@ if (strlen($id)>0) {
//synchronize the xml config
save_dialplan_xml();
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
}
//redirect the user

View File

@ -134,6 +134,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//synchronize the xml config
save_dialplan_xml();
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=dialplan_edit.php?id=".$dialplan_uuid."\">\n";
echo "<div align='center'>\n";
@ -166,8 +173,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//synchronize the xml config
save_dialplan_xml();
require_once "includes/header.php";
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=dialplan_edit.php?id=".$dialplan_uuid."\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";

View File

@ -176,6 +176,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$db->exec(check_sql($sql));
unset($sql);
//delete the dialplan context 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 dialplan:".$dialplan_context."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//synchronize the xml config
save_dialplan_xml();

View File

@ -563,6 +563,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//commit the atomic transaction
$count = $db->exec("COMMIT;"); //returns affected rows
//delete the dialplan context 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 dialplan:public@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//synchronize the xml config
save_dialplan_xml();

View File

@ -553,14 +553,15 @@ else {
unset($action_data);
} //if strlen
} //end for each
//synchronize the xml config
save_dialplan_xml();
//changes in the dialplan may affect routes in the hunt groups
save_hunt_group_xml();
}
//delete the dialplan context 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 dialplan:".$dialplan_context."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//synchronize the xml config
save_dialplan_xml();

View File

@ -550,7 +550,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//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_cmd = "memcache delete directory:".$extension."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}

View File

@ -87,6 +87,13 @@ else {
//apply settings reminder
$_SESSION["reload_xml"] = true;
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
}
//redirect the user

View File

@ -124,12 +124,14 @@ else {
//set the variables
$user_uuid = check_str($_REQUEST["user_uuid"]);
$fax_uuid = check_str($_REQUEST["id"]);
//delete the group from the users
$sql = "delete from v_fax_users ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and fax_uuid = '".$fax_uuid."' ";
$sql .= "and user_uuid = '".$user_uuid."' ";
$db->exec(check_sql($sql));
//redirect the browser
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=fax_edit.php?id=$fax_uuid\">\n";
@ -159,6 +161,7 @@ else {
$sql_insert .= "'".$user_uuid."' ";
$sql_insert .= ")";
$db->exec($sql_insert);
//redirect the browser
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=fax_edit.php?id=$fax_uuid\">\n";
@ -453,6 +456,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//apply settings reminder
$_SESSION["reload_xml"] = true;
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//redirect the browser
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=fax.php\">\n";

View File

@ -247,6 +247,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//synchronize the xml config
save_dialplan_xml();
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_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=\"2;url=fifo.php\">\n";

View File

@ -67,6 +67,13 @@ if (strlen($id)>0) {
//synchronize the xml config
save_dialplan_xml();
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
}
//redirect the user

View File

@ -41,15 +41,22 @@ if (count($_GET)>0) {
if (strlen($id)>0) {
//delete the data
$sql = "";
$sql .= "delete from v_dialplan_details ";
$sql = "delete from v_dialplan_details ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and dialplan_detail_uuid = '$id' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$db->query($sql);
unset($sql);
//synchronize the xml config
save_dialplan_xml();
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
}
//redirect the user

View File

@ -115,6 +115,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//synchronize the xml config
save_dialplan_xml();
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=fifo_edit.php?id=".$dialplan_uuid."\">\n";
echo "<div align='center'>\n";
@ -140,6 +147,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//synchronize the xml config
save_dialplan_xml();
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=fifo_edit.php?id=".$dialplan_uuid."\">\n";
echo "<div align='center'>\n";

View File

@ -120,6 +120,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//synchronize the xml config
save_dialplan_xml();
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=fifo.php\">\n";
echo "<div align='center'>\n";
@ -146,6 +153,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//synchronize the xml config
save_dialplan_xml();
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=fifo.php\">\n";
echo "<div align='center'>\n";

View File

@ -40,8 +40,6 @@ else {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
if (strlen($_GET["id"])>0) {
//set the variable
$id = check_str($_GET["id"]);
@ -98,6 +96,13 @@ if (strlen($_GET["id"])>0) {
//synchronize the xml config
save_dialplan_xml();
//delete the gateways 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 configuration:sofia.conf";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//rescan the sip profile to look for new or stopped gateways
//create the event socket connection and send a command
if (!$fp) {

View File

@ -240,6 +240,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//synchronize the xml config
save_dialplan_xml();
//delete the sip profiles 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 configuration:sofia.conf";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//rescan the external profile to look for new or stopped gateways
//create the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);

View File

@ -35,7 +35,7 @@ else {
}
if (count($_GET)>0) {
$id = $_GET["id"];
$id = check_str($_GET["id"]);
}
//delete the extension
@ -52,6 +52,25 @@ if (count($_GET)>0) {
unset($prep_statement, $sql);
}
//get the extension
$sql = "select * from v_extensions ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and extension_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$extension = $row["extension"];
}
unset ($prep_statement);
//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=\"2;url=index.php\">\n";

View File

@ -109,6 +109,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$db->exec(check_sql($sql));
unset($sql);
}
//update the extension
if ($action == "update" && permission_exists('extension_edit')) {
$sql = "update v_extensions set ";
@ -124,6 +125,26 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$db->exec(check_sql($sql));
unset($sql);
}
//get the extension
$sql = "select * from v_extensions ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and extension_uuid = '$extension_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$extension = $row["extension"];
}
unset ($prep_statement);
//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);
}
//show the action and redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=index.php\">\n";
@ -166,7 +187,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$password = $row["password"];
$vm_password = $row["vm_password"];
$vm_password = str_replace("#", "", $vm_password); //preserves leading zeros
}
unset ($prep_statement);
}

View File

@ -91,6 +91,13 @@ if (strlen($id)>0) {
//synchronize the xml config
save_hunt_group_xml();
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
}
//redirect the user

View File

@ -254,6 +254,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//synchronize the xml config
save_hunt_group_xml();
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//rediret the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=hunt_groups.php\">\n";

View File

@ -208,31 +208,23 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//synchronize the xml config
save_dialplan_xml();
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=ivr_menus.php\">\n";
echo "<div align='center'>\n";
echo "Add Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
}
//update the data
if ($action == "update" && permission_exists('ivr_menu_edit')) {
//run the update method in the ivr menu class
$ivr->ivr_menu_uuid = $ivr_menu_uuid;
$ivr->update();
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=ivr_menus.php\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
$ivr->ivr_menu_uuid = $ivr_menu_uuid;
$ivr->update();
}
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=ivr_menus.php\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)

View File

@ -346,6 +346,13 @@ require_once "includes/classes/switch_dialplan.php";
$database->fields['ivr_menu_option_description'] = $this->ivr_menu_option_description;
$database->add();
}
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
}
public function update() {
@ -690,25 +697,32 @@ require_once "includes/classes/switch_dialplan.php";
$database->delete();
}
//delete child data
$database->table = "v_ivr_menu_options";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'ivr_menu_uuid';
$database->where[1]['value'] = $this->ivr_menu_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//delete child data
$database->table = "v_ivr_menu_options";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'ivr_menu_uuid';
$database->where[1]['value'] = $this->ivr_menu_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//delete parent data
$database->table = "v_ivr_menus";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'ivr_menu_uuid';
$database->where[1]['value'] = $this->ivr_menu_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//delete parent data
$database->table = "v_ivr_menus";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'ivr_menu_uuid';
$database->where[1]['value'] = $this->ivr_menu_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//commit the transaction
//$count = $database->db->exec("COMMIT;");

View File

@ -59,28 +59,40 @@ else {
$dialplan_uuid = $row["dialplan_uuid"];
}
unset ($prep_statement);
//delete from the ring groups table
$sql = "delete from v_ring_groups ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and ring_group_uuid = '".$id."' ";
$db->exec(check_sql($sql));
unset($sql);
//delete from the ring group extensions table
$sql = "delete from v_ring_group_extensions ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and ring_group_uuid = '".$id."' ";
$db->exec(check_sql($sql));
unset($sql);
//delete from the dialplan
$sql = "delete from v_dialplans ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and dialplan_uuid = '".$dialplan_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
//save the xml
save_dialplan_xml();
//apply settings reminder
$_SESSION["reload_xml"] = true;
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
}
//redirect the user

View File

@ -273,6 +273,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
}
}
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//redirect the browser
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=ring_groups_edit.php?id=$ring_group_uuid\">\n";

View File

@ -63,6 +63,12 @@ if (strlen($id)>0) {
//apply settings reminder
$_SESSION["reload_xml"] = true;
//delete the sip profiles 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 configuration:sofia.conf";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
}
//redirect the browser

View File

@ -74,39 +74,42 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add") {
$sql = "insert into v_sip_profiles ";
$sql .= "(";
$sql .= "sip_profile_uuid, ";
$sql .= "sip_profile_name, ";
$sql .= "sip_profile_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'$sip_profile_name', ";
$sql .= "'$sip_profile_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//add the sip profile
if ($action == "add") {
$sql = "insert into v_sip_profiles ";
$sql .= "(";
$sql .= "sip_profile_uuid, ";
$sql .= "sip_profile_name, ";
$sql .= "sip_profile_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'$sip_profile_name', ";
$sql .= "'$sip_profile_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
} //if ($action == "add")
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=sip_profiles.php\">\n";
echo "<div align='center'>\n";
echo "Add Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "add")
//update the sip profile
if ($action == "update") {
$sql = "update v_sip_profiles set ";
$sql .= "sip_profile_name = '$sip_profile_name', ";
$sql .= "sip_profile_description = '$sip_profile_description' ";
$sql .= "where sip_profile_uuid = '$sip_profile_uuid'";
$db->exec(check_sql($sql));
unset($sql);
} //if ($action == "update")
if ($action == "update") {
$sql = "update v_sip_profiles set ";
$sql .= "sip_profile_name = '$sip_profile_name', ";
$sql .= "sip_profile_description = '$sip_profile_description' ";
$sql .= "where sip_profile_uuid = '$sip_profile_uuid'";
$db->exec(check_sql($sql));
unset($sql);
//delete the sip profiles 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 configuration:sofia.conf";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//redirect the browser
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=sip_profiles.php\">\n";
echo "<div align='center'>\n";
@ -114,7 +117,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)

View File

@ -475,13 +475,21 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//synchronize the xml config
save_dialplan_xml();
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=4b821450-926b-175a-af93-a03c441818b1\">\n";
echo "<div align='center'>\n";
echo "".$text['confirm-update-complete']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
//delete the dialplan context 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 dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//redirect the browser
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=4b821450-926b-175a-af93-a03c441818b1\">\n";
echo "<div align='center'>\n";
echo "".$text['confirm-update-complete']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //end if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)

View File

@ -386,13 +386,13 @@ include "root.php";
function generate_xml($single=1){
//switch_account_code!! How should we be passing this??
if ($this->enabled== "false" || !$this->enabled) {
return false;//This the best way??
}
$this->vm_password = str_replace("#", "", $this->vm_password); //preserves leading zeros//**Generic Validation!
/*if(!in_array($this->vm_enabled,array("false","true"))) {//**Generic Validation!
$this->vm_enabled = "true";
}