Change. Does not use default dialplan/directory.

I think it more consistent that it allows edit domain in single place.
Also on my Windows machine while installing all users/context creates not in `default` directory.
And I have problem because remove users did not work, `default.xml` file contain `$${v_domain}` variables.
This commit is contained in:
Alexey Melnichuk
2015-07-02 13:14:35 +04:00
parent c4f1221015
commit 5059613a40
6 changed files with 11 additions and 51 deletions

View File

@@ -192,18 +192,10 @@ include "root.php";
$file_default_path = $src_dir.'/dialplan/default.xml';
$file_default_contents = file_get_contents($file_default_path);
//prepare the file contents and the path
if (count($_SESSION['domains']) < 2) {
//replace the variables in the template in the future loop through all the line numbers to do a replace for each possible line number
$file_default_contents = str_replace("{v_domain}", 'default', $file_default_contents);
//set the file path
$file_path = $switch_dialplan_dir.'/default.xml';
}
else {
//replace the variables in the template in the future loop through all the line numbers to do a replace for each possible line number
$file_default_contents = str_replace("{v_domain}", $_SESSION['domain_name'], $file_default_contents);
//set the file path
$file_path = $switch_dialplan_dir.'/'.$_SESSION['domain_name'].'.xml';
}
//replace the variables in the template in the future loop through all the line numbers to do a replace for each possible line number
$file_default_contents = str_replace("{v_domain}", $_SESSION['domain_name'], $file_default_contents);
//set the file path
$file_path = $switch_dialplan_dir.'/'.$_SESSION['domain_name'].'.xml';
//write the default dialplan
$fh = fopen($file_path,'w') or die('Unable to write to '.$file_path.'. Make sure the path exists and permissons are set correctly.');
fwrite($fh, $file_default_contents);