mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
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:
@@ -46,7 +46,7 @@ function cmd_async($cmd) {
|
|||||||
//windows
|
//windows
|
||||||
if (stristr(PHP_OS, 'WIN')) {
|
if (stristr(PHP_OS, 'WIN')) {
|
||||||
$descriptorspec = array(
|
$descriptorspec = array(
|
||||||
0 => array("pipe", "r"), // stdin
|
0 => array("pipe", "r"), // stdin
|
||||||
1 => array("pipe", "w"), // stdout
|
1 => array("pipe", "w"), // stdout
|
||||||
2 => array("pipe", "w") // stderr
|
2 => array("pipe", "w") // stderr
|
||||||
);
|
);
|
||||||
@@ -176,12 +176,7 @@ function cmd_async($cmd) {
|
|||||||
$origination_url = "{".$channel_variables."}".$bridge_array[0];
|
$origination_url = "{".$channel_variables."}".$bridge_array[0];
|
||||||
|
|
||||||
//get the context
|
//get the context
|
||||||
if (count($_SESSION["domains"]) > 1) {
|
$context = $_SESSION['domain_name'];
|
||||||
$context = $_SESSION['domain_name'];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$context = "default";
|
|
||||||
}
|
|
||||||
|
|
||||||
//set the command
|
//set the command
|
||||||
$cmd = "bgapi sched_api +".$sched_seconds." ".$call_broadcast_uuid." bgapi originate ".$origination_url." ".$broadcast_destination_data." XML $context";
|
$cmd = "bgapi sched_api +".$sched_seconds." ".$call_broadcast_uuid." bgapi originate ".$origination_url." ".$broadcast_destination_data." XML $context";
|
||||||
|
|||||||
@@ -73,12 +73,7 @@ if (is_array($_REQUEST) && !empty($_REQUEST['src']) && !empty($_REQUEST['dest'])
|
|||||||
$sip_auto_answer = '';
|
$sip_auto_answer = '';
|
||||||
}
|
}
|
||||||
if (strlen($cid_number) == 0) { $cid_number = $src;}
|
if (strlen($cid_number) == 0) { $cid_number = $src;}
|
||||||
if (strlen($_SESSION['context']) > 0) {
|
$context = $_SESSION['context'];
|
||||||
$context = $_SESSION['context'];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$context = 'default';
|
|
||||||
}
|
|
||||||
|
|
||||||
//workaround for TBDialout on Thunderbird
|
//workaround for TBDialout on Thunderbird
|
||||||
//seems it can only handle the first %NUM%
|
//seems it can only handle the first %NUM%
|
||||||
|
|||||||
@@ -192,18 +192,10 @@ include "root.php";
|
|||||||
$file_default_path = $src_dir.'/dialplan/default.xml';
|
$file_default_path = $src_dir.'/dialplan/default.xml';
|
||||||
$file_default_contents = file_get_contents($file_default_path);
|
$file_default_contents = file_get_contents($file_default_path);
|
||||||
//prepare the file contents and the 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
|
||||||
//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);
|
||||||
$file_default_contents = str_replace("{v_domain}", 'default', $file_default_contents);
|
//set the file path
|
||||||
//set the file path
|
$file_path = $switch_dialplan_dir.'/'.$_SESSION['domain_name'].'.xml';
|
||||||
$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';
|
|
||||||
}
|
|
||||||
//write the default dialplan
|
//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.');
|
$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);
|
fwrite($fh, $file_default_contents);
|
||||||
|
|||||||
@@ -159,16 +159,9 @@
|
|||||||
//declare global variables
|
//declare global variables
|
||||||
global $config, $db, $domain_uuid;
|
global $config, $db, $domain_uuid;
|
||||||
|
|
||||||
//get the context based from the domain_uuid
|
|
||||||
if (count($_SESSION['domains']) == 1) {
|
|
||||||
$user_context = "default";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$user_context = $_SESSION['domains'][$domain_uuid]['domain_name'];
|
|
||||||
}
|
|
||||||
|
|
||||||
//get the domain_name
|
//get the domain_name
|
||||||
$domain_name = $_SESSION['domains'][$domain_uuid]['domain_name'];
|
$domain_name = $_SESSION['domains'][$domain_uuid]['domain_name'];
|
||||||
|
$user_context = $domain_name;
|
||||||
|
|
||||||
//delete all old extensions to prepare for new ones
|
//delete all old extensions to prepare for new ones
|
||||||
$dialplan_list = glob($_SESSION['switch']['extensions']['dir']."/".$user_context."/v_*.xml");
|
$dialplan_list = glob($_SESSION['switch']['extensions']['dir']."/".$user_context."/v_*.xml");
|
||||||
|
|||||||
@@ -94,12 +94,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
else {
|
else {
|
||||||
//if the user_context was not set then set the default value
|
//if the user_context was not set then set the default value
|
||||||
if (strlen($user_context) == 0) {
|
if (strlen($user_context) == 0) {
|
||||||
if (count($_SESSION["domains"]) > 1) {
|
$user_context = $_SESSION['domain_name'];
|
||||||
$user_context = $_SESSION['domain_name'];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$user_context = "default";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -211,12 +211,7 @@ function load_extensions() {
|
|||||||
}
|
}
|
||||||
//if no extension has been assigned then setting the user_context will still need to be set
|
//if no extension has been assigned then setting the user_context will still need to be set
|
||||||
if (strlen($_SESSION['user_context']) == 0) {
|
if (strlen($_SESSION['user_context']) == 0) {
|
||||||
if (count($_SESSION['domains']) == 1) {
|
$_SESSION['user_context'] = $_SESSION['domain_name'];
|
||||||
$_SESSION['user_context'] = "default";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$_SESSION['user_context'] = $_SESSION['domain_name'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1906,12 +1901,7 @@ function save_dialplan_xml() {
|
|||||||
global $db, $domain_uuid;
|
global $db, $domain_uuid;
|
||||||
|
|
||||||
//get the context based from the domain_uuid
|
//get the context based from the domain_uuid
|
||||||
if (count($_SESSION['domains']) == 1) {
|
$user_context = $_SESSION['domains'][$domain_uuid]['domain_name'];
|
||||||
$user_context = "default";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$user_context = $_SESSION['domains'][$domain_uuid]['domain_name'];
|
|
||||||
}
|
|
||||||
|
|
||||||
//prepare for dialplan .xml files to be written. delete all dialplan files that are prefixed with dialplan_ and have a file extension of .xml
|
//prepare for dialplan .xml files to be written. delete all dialplan files that are prefixed with dialplan_ and have a file extension of .xml
|
||||||
$dialplan_list = glob($_SESSION['switch']['dialplan']['dir'] . "/*/*v_dialplan*.xml");
|
$dialplan_list = glob($_SESSION['switch']['dialplan']['dir'] . "/*/*v_dialplan*.xml");
|
||||||
|
|||||||
Reference in New Issue
Block a user