Merge pull request #1013 from moteus/issues_1008
Disable of sip profile does not work
This commit is contained in:
commit
b689e726a4
|
|
@ -161,6 +161,12 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||||
//redirect the browser
|
//redirect the browser
|
||||||
$_SESSION["message"] = $text['message-update'];
|
$_SESSION["message"] = $text['message-update'];
|
||||||
header("Location: sip_profiles.php");
|
header("Location: sip_profiles.php");
|
||||||
|
|
||||||
|
//save the sip profile xml
|
||||||
|
save_sip_profile_xml();
|
||||||
|
//apply settings reminder
|
||||||
|
$_SESSION["reload_xml"] = true;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} //if ($_POST["persistformvar"] != "true")
|
} //if ($_POST["persistformvar"] != "true")
|
||||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||||
|
|
|
||||||
|
|
@ -2546,12 +2546,15 @@ if (!function_exists('save_sip_profile_xml')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// make profile dir if needed
|
||||||
|
$profile_dir = $_SESSION['switch']['conf']['dir']."/sip_profiles";
|
||||||
|
if (!is_readable($profile_dir)) { mkdir($profile_dir,0775,true); }
|
||||||
|
|
||||||
//get the global variables
|
//get the global variables
|
||||||
global $db, $domain_uuid;
|
global $db, $domain_uuid;
|
||||||
|
|
||||||
//get the sip profiles from the database
|
//get the sip profiles from the database
|
||||||
$sql = "select * from v_sip_profiles";
|
$sql = "select * from v_sip_profiles";
|
||||||
$sql .= "where sip_profile_enabled = 'true' ";
|
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
$prep_statement->execute();
|
$prep_statement->execute();
|
||||||
$result = $prep_statement->fetchAll();
|
$result = $prep_statement->fetchAll();
|
||||||
|
|
@ -2561,6 +2564,15 @@ if (!function_exists('save_sip_profile_xml')) {
|
||||||
foreach($result as $row) {
|
foreach($result as $row) {
|
||||||
$sip_profile_uuid = $row['sip_profile_uuid'];
|
$sip_profile_uuid = $row['sip_profile_uuid'];
|
||||||
$sip_profile_name = $row['sip_profile_name'];
|
$sip_profile_name = $row['sip_profile_name'];
|
||||||
|
$sip_profile_enabled = $row['sip_profile_enabled'];
|
||||||
|
|
||||||
|
if ($sip_profile_enabled == 'false') {
|
||||||
|
$fout = fopen($profile_dir.'/'.$sip_profile_name.".xml","w");
|
||||||
|
if ($fout) {
|
||||||
|
fclose($fout);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//get the xml sip profile template
|
//get the xml sip profile template
|
||||||
if ($sip_profile_name == "internal" || $sip_profile_name == "external" || $sip_profile_name == "internal-ipv6") {
|
if ($sip_profile_name == "internal" || $sip_profile_name == "external" || $sip_profile_name == "internal-ipv6") {
|
||||||
|
|
@ -2588,14 +2600,14 @@ if (!function_exists('save_sip_profile_xml')) {
|
||||||
$file_contents = str_replace("{v_sip_profile_settings}", $sip_profile_settings, $file_contents);
|
$file_contents = str_replace("{v_sip_profile_settings}", $sip_profile_settings, $file_contents);
|
||||||
|
|
||||||
//write the XML config file
|
//write the XML config file
|
||||||
if (is_readable($_SESSION['switch']['conf']['dir']."/sip_profiles/")) {
|
if (is_readable($profile_dir.'/')) {
|
||||||
$fout = fopen($_SESSION['switch']['conf']['dir']."/sip_profiles/".$sip_profile_name.".xml","w");
|
$fout = fopen($profile_dir.'/'.$sip_profile_name.".xml","w");
|
||||||
fwrite($fout, $file_contents);
|
fwrite($fout, $file_contents);
|
||||||
fclose($fout);
|
fclose($fout);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if the directory does not exist then create it
|
//if the directory does not exist then create it
|
||||||
if (!is_readable($_SESSION['switch']['conf']['dir']."/sip_profiles/".$sip_profile_name)) { mkdir($_SESSION['switch']['conf']['dir']."/sip_profiles/".$sip_profile_name,0775,true); }
|
if (!is_readable($profile_dir.'/'.$sip_profile_name)) { mkdir($profile_dir.'/'.$sip_profile_name,0775,true); }
|
||||||
|
|
||||||
} //end foreach
|
} //end foreach
|
||||||
unset($sql, $result, $row_count);
|
unset($sql, $result, $row_count);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue