Merge pull request #1017 from moteus/no_default_domain

Change. Does not use `default` dialplan/directory.
This commit is contained in:
FusionPBX 2015-08-10 11:27:19 -06:00
commit f1e8e1c366
5 changed files with 10 additions and 45 deletions

View File

@ -46,7 +46,7 @@ function cmd_async($cmd) {
//windows
if (stristr(PHP_OS, 'WIN')) {
$descriptorspec = array(
0 => array("pipe", "r"), // stdin
0 => array("pipe", "r"), // stdin
1 => array("pipe", "w"), // stdout
2 => array("pipe", "w") // stderr
);
@ -176,12 +176,7 @@ function cmd_async($cmd) {
$origination_url = "{".$channel_variables."}".$bridge_array[0];
//get the context
if (count($_SESSION["domains"]) > 1) {
$context = $_SESSION['domain_name'];
}
else {
$context = "default";
}
$context = $_SESSION['domain_name'];
//set the command
$cmd = "bgapi sched_api +".$sched_seconds." ".$call_broadcast_uuid." bgapi originate ".$origination_url." ".$broadcast_destination_data." XML $context";

View File

@ -73,12 +73,7 @@ if (is_array($_REQUEST) && !empty($_REQUEST['src']) && !empty($_REQUEST['dest'])
$sip_auto_answer = '';
}
if (strlen($cid_number) == 0) { $cid_number = $src;}
if (strlen($_SESSION['context']) > 0) {
$context = $_SESSION['context'];
}
else {
$context = 'default';
}
$context = $_SESSION['context'];
//workaround for TBDialout on Thunderbird
//seems it can only handle the first %NUM%

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);

View File

@ -159,16 +159,9 @@
//declare global variables
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
$domain_name = $_SESSION['domains'][$domain_uuid]['domain_name'];
$user_context = $domain_name;
//delete all old extensions to prepare for new ones
$dialplan_list = glob($_SESSION['switch']['extensions']['dir']."/".$user_context."/v_*.xml");

View File

@ -97,12 +97,7 @@ function load_extensions() {
}
//if no extension has been assigned then setting the user_context will still need to be set
if (strlen($_SESSION['user_context']) == 0) {
if (count($_SESSION['domains']) == 1) {
$_SESSION['user_context'] = "default";
}
else {
$_SESSION['user_context'] = $_SESSION['domain_name'];
}
$_SESSION['user_context'] = $_SESSION['domain_name'];
}
}
}
@ -747,12 +742,7 @@ function save_dialplan_xml() {
global $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'];
}
$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
$dialplan_list = glob($_SESSION['switch']['dialplan']['dir'] . "/*/*v_dialplan*.xml");