This commit is contained in:
markjcrane
2015-12-03 10:29:54 -07:00
7 changed files with 48 additions and 29 deletions

View File

@@ -78,10 +78,6 @@ if (!if_group("superadmin")) {
echo "</table>\n";
echo "</form>\n";
echo "<br><br>";
echo "<p>WiP</p>";
//include the footer
require_once "resources/footer.php";
?>

View File

@@ -170,7 +170,7 @@ if(!$install_step) { $install_step = 'select_language'; }
}
//test for windows and non sqlite
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' and strlen($db_type) > 0 and $db_type !='sqlite') {
$messages[] = "<b>Windows requires a system DSN ODBC connection</b> this must be configured after installing then restart freeswitch.";
$messages[] = "<b>Windows requires a system DSN ODBC connection</b> this must be configured.";
}
//action code
@@ -309,8 +309,10 @@ if(!$install_step) { $install_step = 'select_language'; }
$switch = new install_switch($global_settings);
//$switch->debug = true;
//$system->debug = true;
$system->install();
$switch->install();
$system->install_phase_1();
$switch->install_phase_1();
$system->install_phase_2();
$switch->install_phase_2();
}catch(Exception $e){
echo "</pre>\n";
echo "<p><b>Failed to install</b><br/>" . $e->getMessage() . "</p>\n";

View File

@@ -163,7 +163,7 @@ require_once "root.php";
$this->_domain_uuid = $_SESSION['domain_uuid'];
// collect misc info
$this->domain_count = count($_SESSION["domains"]);
$this->_domain_count = count($_SESSION["domains"]);
// collect db_info
global $db_type, $db_path, $db_host, $db_port, $db_name, $db_username, $db_password;

View File

@@ -74,9 +74,9 @@ include "root.php";
echo "$message\n";
}
function install() {
function install_phase_1() {
ini_set('max_execution_time',3600);
$this->write_progress("Install started for FusionPBX");
$this->write_progress("Install phase 1 started for FusionPBX");
$this->create_config_php();
$this->write_progress("\tExecuting config.php");
require $this->config_php;
@@ -88,8 +88,14 @@ include "root.php";
$this->write_progress("\tRunning requires");
require "resources/require.php";
$this->create_menus();
$this->write_progress("Install phase 1 complete for FusionPBX");
}
function install_phase_2() {
ini_set('max_execution_time',3600);
$this->write_progress("Install phase 2 started for FusionPBX");
$this->app_defaults();
$this->write_progress("Install complete for FusionPBX");
$this->write_progress("Install phase 2 complete for FusionPBX");
}
function upgrade() {
@@ -551,9 +557,9 @@ include "root.php";
}
protected function create_domain() {
$this->write_progress("\tChecking if domain exists '" . $this->global_settings->domain_name . "'");
$this->write_progress("\tChecking if domain exists '" . $this->global_settings->domain_name() . "'");
$sql = "select * from v_domains ";
$sql .= "where domain_name = '".$this->global_settings->domain_name."' ";
$sql .= "where domain_name = '".$this->global_settings->domain_name()."' ";
$sql .= "limit 1";
$this->write_debug($sql);
$prep_statement = $this->dbh->prepare(check_sql($sql));
@@ -856,7 +862,7 @@ include "root.php";
}
protected function create_superuser() {
$this->write_progress("\tChecking if superuser exists '" . $this->global_settings->domain_name . "'");
$this->write_progress("\tChecking if superuser exists '" . $this->admin_username . "'");
$sql = "select * from v_users ";
$sql .= "where domain_uuid = '".$this->global_settings->domain_uuid()."' ";
$sql .= "and username = '".$this->admin_username."' ";
@@ -877,7 +883,7 @@ include "root.php";
$this->write_debug($sql);
$this->dbh->exec(check_sql($sql));
}else{
$this->write_progress("\t... creating super user '" . $this->admin_username . "'");
$this->write_progress("\t... creating super user");
//add a user and then add the user to the superadmin group
//prepare the values
$this->admin_uuid = uuid();

View File

@@ -46,8 +46,8 @@ include "root.php";
$this->config_lua = "/etc/fusionpbx/config.lua";
}elseif (is_dir("/usr/local/etc/fusionpbx")){
$this->config_lua = "/usr/local/etc/fusionpbx/config.lua";
}elseif(strlen($this->global_settings->script_dir) > 0) {
$this->config_lua = $this->global_settings->script_dir."/resources/config.lua";
}elseif(strlen($this->global_settings->switch_script_dir()) > 0) {
$this->config_lua = $this->global_settings->switch_script_dir()."/resources/config.lua";
}else{
throw new Exception("Could not work out where to put the config.lua");
}
@@ -181,19 +181,23 @@ include "root.php";
}
}
function install() {
$this->write_progress("Install started for switch");
function install_phase_1() {
$this->write_progress("Install phase 1 started for switch");
$this->copy_conf();
$this->copy_scripts();
$this->write_progress("Install phase 1 completed for switch");
}
function install_phase_2() {
$this->write_progress("Install phase 2 started for switch");
$this->create_config_lua();
$this->restart_switch();
$this->write_progress("Install completed for switch");
$this->write_progress("Install phase 2 completed for switch");
}
function upgrade() {
$this->copy_scripts();
$this->create_config_lua();
$this->restart_switch();
}
protected function copy_conf() {
@@ -279,6 +283,15 @@ include "root.php";
public function create_config_lua() {
$this->write_progress("\tCreating " . $this->config_lua);
$path = dirname($this->config_lua);
$parent_dir = basename($path);
if($parent_dir == 'resources' and !file_exists($path)){
$this->write_progress("\t... creating missing '$path'");
if (!mkdir($path, 0755, true)) {
throw new Exception("Failed to create the missing resources directory '$path'");
}
}
global $db;
//get the odbc information
$sql = "select count(*) as num_rows from v_databases ";
@@ -335,7 +348,7 @@ include "root.php";
$tmp .= normalize_path_to_os(" voicemail_dir = [[".$this->global_settings->switch_voicemail_vdir()."]];\n");
}
if (strlen($this->global_settings->switch_script_dir()) > 0) {
$tmp .= normalize_path_to_os(" script_dir = [[".$this->global_settings->switch_script_dir()."]];\n");
$tmp .= normalize_path_to_os(" scripts_dir = [[".$this->global_settings->switch_script_dir()."]];\n");
}
$tmp .= normalize_path_to_os(" php_dir = [[".PHP_BINDIR."]];\n");
if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") {
@@ -359,8 +372,10 @@ include "root.php";
$tmp .= " database[\"switch\"] = \"odbc://freeswitch:".$dsn_username.":".$dsn_password."\";\n";
}
elseif ($this->global_settings->db_type() == "pgsql") {
$tmp .= " database[\"system\"] = \"pgsql://hostaddr=".$this->global_settings->db_host()." port=".$this->global_settings->db_port()." dbname=".$this->global_settings->db_name()." user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='".$this->global_settings->db_name()."'\";\n";
$tmp .= " database[\"switch\"] = \"pgsql://hostaddr=".$this->global_settings->db_host()." port=".$this->global_settings->db_port()." dbname=freeswitch user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='freeswitch'\";\n";
$lua_db_host = $this->global_settings->db_host();
if($lua_db_host == 'localhost') { $lua_db_host = '127.0.0.1'; } // lua cannot resolve localhost
$tmp .= " database[\"system\"] = \"pgsql://hostaddr=".$lua_db_host." port=".$this->global_settings->db_port()." dbname=".$this->global_settings->db_name()." user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='".$this->global_settings->db_name()."'\";\n";
$tmp .= " database[\"switch\"] = \"pgsql://hostaddr=".$lua_db_host." port=".$this->global_settings->db_port()." dbname=freeswitch user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='freeswitch'\";\n";
}
elseif ($this->global_settings->db_type() == "sqlite") {
$tmp .= " database[\"system\"] = \"sqlite://".$this->global_settings->db_path()."/".$this->global_settings->db_name()."\";\n";
@@ -404,7 +419,7 @@ include "root.php";
$tmp .= " dofile(\"/etc/fusionpbx/local.lua\");\n";
$tmp .= " elseif (file_exists(\"/usr/local/etc/fusionpbx/local.lua\")) then\n";
$tmp .= " dofile(\"/usr/local/etc/fusionpbx/local.lua\");\n";
$tmp .= " elseif (file_exists(script_dir..\"/resources/local.lua\")) then\n";
$tmp .= " elseif (file_exists(scripts_dir..\"/resources/local.lua\")) then\n";
$tmp .= " require(\"resources.local\");\n";
$tmp .= " end\n";
fwrite($fout, $tmp);

View File

@@ -58,8 +58,8 @@
<param name="rtp-ip" value="$${local_ip_v6}"/>
<!-- ip address to bind to, DO NOT USE HOSTNAMES ONLY IP ADDRESSES -->
<param name="sip-ip" value="$${local_ip_v6}"/>
<param name="ext-rtp-ip" value="$${external_rtp_ip}"/>
<param name="ext-sip-ip" value="$${external_sip_ip}"/>
<param name="ext-rtp-ip" value="$${external_rtp_ip}" enabled="false"/>
<param name="ext-sip-ip" value="$${external_sip_ip}" enabled="false"/>
<param name="rtp-timeout-sec" value="300"/>
<param name="rtp-hold-timeout-sec" value="1800"/>
<!--<param name="enable-3pcc" value="true"/>-->

View File

@@ -287,7 +287,7 @@ if ($domains_processed == 1) {
$array[$x]['default_setting_category'] = 'theme';
$array[$x]['default_setting_subcategory'] = 'background_color';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = '#ffffff';
$array[$x]['default_setting_value'] = '#6c89b5';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_order'] = '0';
$array[$x]['default_setting_description'] = 'Set a background (HTML compatible) color.';
@@ -295,7 +295,7 @@ if ($domains_processed == 1) {
$array[$x]['default_setting_category'] = 'theme';
$array[$x]['default_setting_subcategory'] = 'background_color';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = '#e7ebf1';
$array[$x]['default_setting_value'] = '#144794';
$array[$x]['default_setting_order'] = '1';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Set a secondary background (HTML compatible) color, for a gradient effect.';