diff --git a/app/call_broadcast/call_broadcast_send.php b/app/call_broadcast/call_broadcast_send.php index 4b7df2a84f..1ccf411c42 100644 --- a/app/call_broadcast/call_broadcast_send.php +++ b/app/call_broadcast/call_broadcast_send.php @@ -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"; diff --git a/app/click_to_call/click_to_call.php b/app/click_to_call/click_to_call.php index 398586aa8f..cc4fe7323a 100644 --- a/app/click_to_call/click_to_call.php +++ b/app/click_to_call/click_to_call.php @@ -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% diff --git a/app/dialplan/resources/classes/dialplan.php b/app/dialplan/resources/classes/dialplan.php index 5e27d2654f..c828cc25b1 100644 --- a/app/dialplan/resources/classes/dialplan.php +++ b/app/dialplan/resources/classes/dialplan.php @@ -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); diff --git a/app/extensions/resources/classes/extension.php b/app/extensions/resources/classes/extension.php index a1eb923c5b..e1aef02f50 100644 --- a/app/extensions/resources/classes/extension.php +++ b/app/extensions/resources/classes/extension.php @@ -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"); diff --git a/resources/switch.php b/resources/switch.php index 801f481cf0..0cfd0b5797 100644 --- a/resources/switch.php +++ b/resources/switch.php @@ -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");