Update gateway_edit.php
This commit is contained in:
parent
e1556c9dc3
commit
5445732e33
|
|
@ -17,22 +17,26 @@
|
|||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2013
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2016
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('gateway_add') || permission_exists('gateway_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//includes
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('gateway_add') || permission_exists('gateway_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
|
|
@ -41,16 +45,22 @@ else {
|
|||
//action add or update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$gateway_uuid = check_str($_REQUEST["id"]);
|
||||
if (isset($_POST["id"])) {
|
||||
$gateway_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
if (isset($_POST["gateway_uuid"])) {
|
||||
$gateway_uuid = check_str($_POST["gateway_uuid"]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
$gateway_uuid = uuid();
|
||||
}
|
||||
|
||||
//get total gateway count from the database, check limit, if defined
|
||||
if ($action == 'add') {
|
||||
if ($_SESSION['limit']['gateways']['numeric'] != '') {
|
||||
$sql = "select count(*) as num_rows from v_gateways ";
|
||||
$sql = "select count(gateway_uuid) as num_rows from v_gateways ";
|
||||
$sql .= "where ( domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
if (permission_exists('gateway_domain')) {
|
||||
$sql .= "or domain_uuid is null ";
|
||||
|
|
@ -110,198 +120,106 @@ else {
|
|||
$domain_uuid = $_SESSION['domain_uuid'];
|
||||
}
|
||||
|
||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
//process the HTTP POST
|
||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
//get the id
|
||||
if ($action == "update") {
|
||||
$gateway_uuid = check_str($_POST["gateway_uuid"]);
|
||||
}
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
//if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
|
||||
if (strlen($gateway) == 0) { $msg .= $text['message-required']." ".$text['label-gateway']."<br>\n"; }
|
||||
if ($register == "true") {
|
||||
if (strlen($username) == 0) { $msg .= $text['message-required']." ".$text['label-username']."<br>\n"; }
|
||||
if (strlen($password) == 0) { $msg .= $text['message-required']." ".$text['label-password']."<br>\n"; }
|
||||
}
|
||||
//if (strlen($distinct_to) == 0) { $msg .= $text['message-required']." ".$text['label-distinct_to']."<br>\n"; }
|
||||
//if (strlen($auth_username) == 0) { $msg .= $text['message-required']." ".$text['label-auth_username']."<br>\n"; }
|
||||
//if (strlen($realm) == 0) { $msg .= $text['message-required']." ".$text['label-realm']."<br>\n"; }
|
||||
//if (strlen($from_user) == 0) { $msg .= $text['message-required']." ".$text['label-from_user']."<br>\n"; }
|
||||
//if (strlen($from_domain) == 0) { $msg .= $text['message-required']." ".$text['label-from_domain']."<br>\n"; }
|
||||
//if (strlen($proxy) == 0) { $msg .= $text['message-required']." ".$text['label-proxy']."<br>\n"; }
|
||||
//if (strlen($register_proxy) == 0) { $msg .= $text['message-required']." ".$text['label-register_proxy']."<br>\n"; }
|
||||
//if (strlen($outbound_proxy) == 0) { $msg .= $text['message-required']." ".$text['label-outbound_proxy']."<br>\n"; }
|
||||
if (strlen($expire_seconds) == 0) { $msg .= $text['message-required']." ".$text['label-expire_seconds']."<br>\n"; }
|
||||
if (strlen($register) == 0) { $msg .= $text['message-required']." ".$text['label-register']."<br>\n"; }
|
||||
//if (strlen($register_transport) == 0) { $msg .= $text['message-required']." ".$text['label-register_transport']."<br>\n"; }
|
||||
if (strlen($retry_seconds) == 0) { $msg .= $text['message-required']." ".$text['label-retry_seconds']."<br>\n"; }
|
||||
//if (strlen($extension) == 0) { $msg .= $text['message-required']." ".$text['label-extension']."<br>\n"; }
|
||||
//if (strlen($ping) == 0) { $msg .= $text['message-required']." ".$text['label-ping']."<br>\n"; }
|
||||
if (strlen($channels) == 0) {
|
||||
//$msg .= $text['message-required']." ".$text['label-channels']."<br>\n";
|
||||
$channels = 0;
|
||||
}
|
||||
//if (strlen($caller_id_in_from) == 0) { $msg .= $text['message-required']." ".$text['label-caller_id_in_from']."<br>\n"; }
|
||||
//if (strlen($supress_cng) == 0) { $msg .= $text['message-required']." ".$text['label-supress_cng']."<br>\n"; }
|
||||
//if (strlen($sip_cid_type) == 0) { $msg .= $text['message-required']." ".$text['label-sip_cid_type']."<br>\n"; }
|
||||
//if (strlen($codec_prefs) == 0) { $msg .= $text['message-required']." ".$text['label-codec_prefs']."<br>\n"; }
|
||||
//if (strlen($extension_in_contact) == 0) { $msg .= $text['message-required']." ".$text['label-extension_in_contact']."<br>\n"; }
|
||||
if (strlen($context) == 0) { $msg .= $text['message-required']." ".$text['label-context']."<br>\n"; }
|
||||
if (strlen($profile) == 0) { $msg .= $text['message-required']." ".$text['label-profile']."<br>\n"; }
|
||||
if (strlen($enabled) == 0) { $msg .= $text['message-required']." ".$text['label-enabled']."<br>\n"; }
|
||||
//if (strlen($description) == 0) { $msg .= $text['message-required']." ".$text['label-description']."<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/persist_form_var.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//remove the invalid characters from the gateway name
|
||||
$gateway = str_replace(" ", "_", $gateway);
|
||||
$gateway = str_replace("/", "", $gateway);
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
//if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
|
||||
if (strlen($gateway) == 0) { $msg .= $text['message-required']." ".$text['label-gateway']."<br>\n"; }
|
||||
if ($register == "true") {
|
||||
if (strlen($username) == 0) { $msg .= $text['message-required']." ".$text['label-username']."<br>\n"; }
|
||||
if (strlen($password) == 0) { $msg .= $text['message-required']." ".$text['label-password']."<br>\n"; }
|
||||
}
|
||||
//if (strlen($distinct_to) == 0) { $msg .= $text['message-required']." ".$text['label-distinct_to']."<br>\n"; }
|
||||
//if (strlen($auth_username) == 0) { $msg .= $text['message-required']." ".$text['label-auth_username']."<br>\n"; }
|
||||
//if (strlen($realm) == 0) { $msg .= $text['message-required']." ".$text['label-realm']."<br>\n"; }
|
||||
//if (strlen($from_user) == 0) { $msg .= $text['message-required']." ".$text['label-from_user']."<br>\n"; }
|
||||
//if (strlen($from_domain) == 0) { $msg .= $text['message-required']." ".$text['label-from_domain']."<br>\n"; }
|
||||
//if (strlen($proxy) == 0) { $msg .= $text['message-required']." ".$text['label-proxy']."<br>\n"; }
|
||||
//if (strlen($register_proxy) == 0) { $msg .= $text['message-required']." ".$text['label-register_proxy']."<br>\n"; }
|
||||
//if (strlen($outbound_proxy) == 0) { $msg .= $text['message-required']." ".$text['label-outbound_proxy']."<br>\n"; }
|
||||
if (strlen($expire_seconds) == 0) { $msg .= $text['message-required']." ".$text['label-expire_seconds']."<br>\n"; }
|
||||
if (strlen($register) == 0) { $msg .= $text['message-required']." ".$text['label-register']."<br>\n"; }
|
||||
//if (strlen($register_transport) == 0) { $msg .= $text['message-required']." ".$text['label-register_transport']."<br>\n"; }
|
||||
if (strlen($retry_seconds) == 0) { $msg .= $text['message-required']." ".$text['label-retry_seconds']."<br>\n"; }
|
||||
//if (strlen($extension) == 0) { $msg .= $text['message-required']." ".$text['label-extension']."<br>\n"; }
|
||||
//if (strlen($ping) == 0) { $msg .= $text['message-required']." ".$text['label-ping']."<br>\n"; }
|
||||
if (strlen($channels) == 0) {
|
||||
//$msg .= $text['message-required']." ".$text['label-channels']."<br>\n";
|
||||
$channels = 0;
|
||||
}
|
||||
//if (strlen($caller_id_in_from) == 0) { $msg .= $text['message-required']." ".$text['label-caller_id_in_from']."<br>\n"; }
|
||||
//if (strlen($supress_cng) == 0) { $msg .= $text['message-required']." ".$text['label-supress_cng']."<br>\n"; }
|
||||
//if (strlen($sip_cid_type) == 0) { $msg .= $text['message-required']." ".$text['label-sip_cid_type']."<br>\n"; }
|
||||
//if (strlen($codec_prefs) == 0) { $msg .= $text['message-required']." ".$text['label-codec_prefs']."<br>\n"; }
|
||||
//if (strlen($extension_in_contact) == 0) { $msg .= $text['message-required']." ".$text['label-extension_in_contact']."<br>\n"; }
|
||||
if (strlen($context) == 0) { $msg .= $text['message-required']." ".$text['label-context']."<br>\n"; }
|
||||
if (strlen($profile) == 0) { $msg .= $text['message-required']." ".$text['label-profile']."<br>\n"; }
|
||||
if (strlen($enabled) == 0) { $msg .= $text['message-required']." ".$text['label-enabled']."<br>\n"; }
|
||||
//if (strlen($description) == 0) { $msg .= $text['message-required']." ".$text['label-description']."<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/persist_form_var.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//remove the invalid characters from the gateway name
|
||||
$gateway = str_replace(" ", "_", $gateway);
|
||||
$gateway = str_replace("/", "", $gateway);
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add" && permission_exists('gateway_add')) {
|
||||
$gateway_uuid = uuid();
|
||||
$sql = "insert into v_gateways ";
|
||||
$sql .= "(";
|
||||
if (strlen($domain_uuid) > 0) {
|
||||
$sql .= "domain_uuid, ";
|
||||
}
|
||||
$sql .= "gateway_uuid, ";
|
||||
$sql .= "gateway, ";
|
||||
$sql .= "username, ";
|
||||
$sql .= "password, ";
|
||||
$sql .= "distinct_to, ";
|
||||
$sql .= "auth_username, ";
|
||||
$sql .= "realm, ";
|
||||
$sql .= "from_user, ";
|
||||
$sql .= "from_domain, ";
|
||||
$sql .= "proxy, ";
|
||||
$sql .= "register_proxy, ";
|
||||
$sql .= "outbound_proxy, ";
|
||||
$sql .= "expire_seconds, ";
|
||||
$sql .= "register, ";
|
||||
$sql .= "register_transport, ";
|
||||
$sql .= "retry_seconds, ";
|
||||
$sql .= "extension, ";
|
||||
$sql .= "ping, ";
|
||||
$sql .= "channels, ";
|
||||
$sql .= "caller_id_in_from, ";
|
||||
$sql .= "supress_cng, ";
|
||||
$sql .= "sip_cid_type, ";
|
||||
$sql .= "codec_prefs, ";
|
||||
$sql .= "extension_in_contact, ";
|
||||
$sql .= "context, ";
|
||||
$sql .= "profile, ";
|
||||
$sql .= "hostname, ";
|
||||
$sql .= "enabled, ";
|
||||
$sql .= "description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
if (strlen($domain_uuid) > 0) {
|
||||
$sql .= "'$domain_uuid', ";
|
||||
}
|
||||
$sql .= "'$gateway_uuid', ";
|
||||
$sql .= "'$gateway', ";
|
||||
$sql .= "'$username', ";
|
||||
$sql .= "'$password', ";
|
||||
$sql .= "'$distinct_to', ";
|
||||
$sql .= "'$auth_username', ";
|
||||
$sql .= "'$realm', ";
|
||||
$sql .= "'$from_user', ";
|
||||
$sql .= "'$from_domain', ";
|
||||
$sql .= "'$proxy', ";
|
||||
$sql .= "'$register_proxy', ";
|
||||
$sql .= "'$outbound_proxy', ";
|
||||
$sql .= "'$expire_seconds', ";
|
||||
$sql .= "'$register', ";
|
||||
$sql .= "'$register_transport', ";
|
||||
$sql .= "'$retry_seconds', ";
|
||||
$sql .= "'$extension', ";
|
||||
$sql .= "'$ping', ";
|
||||
$sql .= "'$channels', ";
|
||||
$sql .= "'$caller_id_in_from', ";
|
||||
$sql .= "'$supress_cng', ";
|
||||
$sql .= "'$sip_cid_type', ";
|
||||
$sql .= "'$codec_prefs', ";
|
||||
$sql .= "'$extension_in_contact', ";
|
||||
$sql .= "'$context', ";
|
||||
$sql .= "'$profile', ";
|
||||
if (strlen($hostname) == 0) {
|
||||
$sql .= "null, ";
|
||||
}
|
||||
else {
|
||||
$sql .= "'$hostname', ";
|
||||
}
|
||||
$sql .= "'$enabled', ";
|
||||
$sql .= "'$description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//add new gateway to session variable
|
||||
if ($enabled == 'true') {
|
||||
$_SESSION['gateways'][$gateway_uuid] = $gateway;
|
||||
//build the gateway array
|
||||
$x = 0;
|
||||
if (strlen($domain_uuid) == 0) {
|
||||
$array['gateways'][$x]["domain_uuid"] = null;
|
||||
}
|
||||
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update" && permission_exists('gateway_edit')) {
|
||||
$sql = "update v_gateways set ";
|
||||
$sql .= "gateway = '$gateway', ";
|
||||
$sql .= "username = '$username', ";
|
||||
$sql .= "password = '$password', ";
|
||||
$sql .= "distinct_to = '$distinct_to', ";
|
||||
$sql .= "auth_username = '$auth_username', ";
|
||||
$sql .= "realm = '$realm', ";
|
||||
$sql .= "from_user = '$from_user', ";
|
||||
$sql .= "from_domain = '$from_domain', ";
|
||||
$sql .= "proxy = '$proxy', ";
|
||||
$sql .= "register_proxy = '$register_proxy', ";
|
||||
$sql .= "outbound_proxy = '$outbound_proxy', ";
|
||||
$sql .= "expire_seconds = '$expire_seconds', ";
|
||||
$sql .= "register = '$register', ";
|
||||
$sql .= "register_transport = '$register_transport', ";
|
||||
$sql .= "retry_seconds = '$retry_seconds', ";
|
||||
$sql .= "extension = '$extension', ";
|
||||
$sql .= "ping = '$ping', ";
|
||||
$sql .= "channels = '$channels', ";
|
||||
$sql .= "caller_id_in_from = '$caller_id_in_from', ";
|
||||
$sql .= "supress_cng = '$supress_cng', ";
|
||||
$sql .= "sip_cid_type = '$sip_cid_type', ";
|
||||
$sql .= "codec_prefs = '$codec_prefs', ";
|
||||
$sql .= "extension_in_contact = '$extension_in_contact', ";
|
||||
$sql .= "context = '$context', ";
|
||||
$sql .= "profile = '$profile', ";
|
||||
if (strlen($domain_uuid) == 0) {
|
||||
$sql .= "domain_uuid = null, ";
|
||||
}
|
||||
else {
|
||||
$sql .= "domain_uuid = '$domain_uuid', ";
|
||||
}
|
||||
if (strlen($hostname) == 0) {
|
||||
$sql .= "hostname = null, ";
|
||||
}
|
||||
else {
|
||||
$sql .= "hostname = '$hostname', ";
|
||||
}
|
||||
$sql .= "enabled = '$enabled', ";
|
||||
$sql .= "description = '$description' ";
|
||||
$sql .= "where gateway_uuid = '$gateway_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
else {
|
||||
$array['gateways'][$x]["domain_uuid"] = $domain_uuid;
|
||||
}
|
||||
$array['gateways'][$x]["gateway_uuid"] = $gateway_uuid;
|
||||
$array['gateways'][$x]["gateway"] = $gateway;
|
||||
$array['gateways'][$x]["username"] = $username;
|
||||
$array['gateways'][$x]["password"] = $password;
|
||||
$array['gateways'][$x]["distinct_to"] = $distinct_to;
|
||||
$array['gateways'][$x]["auth_username"] = $auth_username;
|
||||
$array['gateways'][$x]["realm"] = $realm;
|
||||
$array['gateways'][$x]["from_user"] = $from_user;
|
||||
$array['gateways'][$x]["from_domain"] = $from_domain;
|
||||
$array['gateways'][$x]["proxy"] = $proxy;
|
||||
$array['gateways'][$x]["register_proxy"] = $register_proxy;
|
||||
$array['gateways'][$x]["outbound_proxy"] = $outbound_proxy;
|
||||
$array['gateways'][$x]["expire_seconds"] = $expire_seconds;
|
||||
$array['gateways'][$x]["register"] = $register;
|
||||
$array['gateways'][$x]["register_transport"] = $register_transport;
|
||||
$array['gateways'][$x]["retry_seconds"] = $retry_seconds;
|
||||
$array['gateways'][$x]["extension"] = $extension;
|
||||
$array['gateways'][$x]["ping"] = $ping;
|
||||
$array['gateways'][$x]["channels"] = $channels;
|
||||
$array['gateways'][$x]["caller_id_in_from"] = $caller_id_in_from;
|
||||
$array['gateways'][$x]["supress_cng"] = $supress_cng;
|
||||
$array['gateways'][$x]["sip_cid_type"] = $sip_cid_type;
|
||||
$array['gateways'][$x]["codec_prefs"] = $codec_prefs;
|
||||
$array['gateways'][$x]["extension_in_contact"] = $extension_in_contact;
|
||||
$array['gateways'][$x]["context"] = $context;
|
||||
$array['gateways'][$x]["profile"] = $profile;
|
||||
if (strlen($hostname) == 0) {
|
||||
$array['gateways'][$x]["hostname"] = null;
|
||||
}
|
||||
else {
|
||||
$array['gateways'][$x]["hostname"] = $hostname;
|
||||
}
|
||||
$array['gateways'][$x]["enabled"] = $enabled;
|
||||
$array['gateways'][$x]["description"] = $description;
|
||||
|
||||
//update gateway session variable
|
||||
if ($enabled == 'true') {
|
||||
|
|
@ -311,52 +229,62 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
unset($_SESSION['gateways'][$gateway_uuid]);
|
||||
}
|
||||
|
||||
} //if ($action == "update")
|
||||
|
||||
//remove xml file (if any) if not enabled
|
||||
if ($enabled != 'true' && $_SESSION['switch']['sip_profiles']['dir'] != '') {
|
||||
$gateway_xml_file = $_SESSION['switch']['sip_profiles']['dir']."/".$profile."/v_".$gateway_uuid.".xml";
|
||||
if (file_exists($gateway_xml_file)) {
|
||||
unlink($gateway_xml_file);
|
||||
//save to the data
|
||||
$orm = new orm;
|
||||
//$orm->name('gateways');
|
||||
$orm->app_name = 'gateways';
|
||||
$orm->app_uuid = '297ab33e-2c2f-8196-552c-f3567d2caaf8';
|
||||
if (strlen($gateway_uuid) > 0) {
|
||||
$orm->uuid($gateway_uuid);
|
||||
}
|
||||
}
|
||||
$orm->save($array);
|
||||
$message = $orm->message;
|
||||
|
||||
//syncrhonize configuration
|
||||
save_gateway_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) {
|
||||
$hostname = trim(event_socket_request($fp, 'api switchname'));
|
||||
$switch_cmd = "memcache delete configuration:sofia.conf:".$hostname;
|
||||
$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
|
||||
//remove xml file (if any) if not enabled
|
||||
if ($enabled != 'true' && $_SESSION['switch']['sip_profiles']['dir'] != '') {
|
||||
$gateway_xml_file = $_SESSION['switch']['sip_profiles']['dir']."/".$profile."/v_".$gateway_uuid.".xml";
|
||||
if (file_exists($gateway_xml_file)) {
|
||||
unlink($gateway_xml_file);
|
||||
}
|
||||
}
|
||||
|
||||
//syncrhonize configuration
|
||||
save_gateway_xml();
|
||||
|
||||
//delete the sip profiles from memcache
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
$tmp_cmd = 'api sofia profile external rescan';
|
||||
$response = event_socket_request($fp, $tmp_cmd);
|
||||
unset($tmp_cmd);
|
||||
usleep(1000);
|
||||
//close the connection
|
||||
fclose($fp);
|
||||
//clear the apply settings reminder
|
||||
$_SESSION["reload_xml"] = false;
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
if ($fp) {
|
||||
$hostname = trim(event_socket_request($fp, 'api switchname'));
|
||||
$switch_cmd = "memcache delete configuration:sofia.conf:".$hostname;
|
||||
$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']);
|
||||
$tmp_cmd = 'api sofia profile external rescan';
|
||||
$response = event_socket_request($fp, $tmp_cmd);
|
||||
unset($tmp_cmd);
|
||||
usleep(1000);
|
||||
//close the connection
|
||||
fclose($fp);
|
||||
//clear the apply settings reminder
|
||||
$_SESSION["reload_xml"] = false;
|
||||
|
||||
//redirect the user
|
||||
if (isset($action)) {
|
||||
if ($action == "add") {
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
|
||||
//redirect the user
|
||||
if (isset($action)) {
|
||||
if ($action == "add") {
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
}
|
||||
if ($action == "update") {
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
}
|
||||
header("Location: gateways.php");
|
||||
return;
|
||||
}
|
||||
if ($action == "update") {
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
}
|
||||
header("Location: gateways.php");
|
||||
return;
|
||||
}
|
||||
} //(count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0)
|
||||
} //(count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
|
||||
|
|
|
|||
Loading…
Reference in New Issue