Merge pull request #1017 from moteus/no_default_domain
Change. Does not use `default` dialplan/directory.
This commit is contained in:
commit
f1e8e1c366
|
|
@ -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
|
|
||||||
$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
|
//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}", $_SESSION['domain_name'], $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.'/'.$_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");
|
||||||
|
|
|
||||||
|
|
@ -97,15 +97,10 @@ 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'] = "default";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$_SESSION['user_context'] = $_SESSION['domain_name'];
|
$_SESSION['user_context'] = $_SESSION['domain_name'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
load_extensions();
|
load_extensions();
|
||||||
|
|
||||||
|
|
@ -747,12 +742,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 = "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
|
//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");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue