示例#1
0
 protected function copy_conf()
 {
     $this->write_progress("\tCopying Config");
     //make a backup of the config
     if (file_exists($this->global_settings->switch_conf_dir())) {
         $this->backup_dir($this->global_settings->switch_conf_dir(), 'fusionpbx_switch_config');
         recursive_delete($this->global_settings->switch_conf_dir());
     }
     //make sure the conf directory exists
     if (!is_dir($this->global_settings->switch_conf_dir())) {
         if (!mkdir($this->global_settings->switch_conf_dir(), 0774, true)) {
             throw new Exception("Failed to create the switch conf directory '" . $this->global_settings->switch_conf_dir() . "'. ");
         }
     }
     //copy resources/templates/conf to the freeswitch conf dir
     if (file_exists('/usr/share/examples/fusionpbx/resources/templates/conf')) {
         $src_dir = "/usr/share/examples/fusionpbx/resources/templates/conf";
     } else {
         $src_dir = $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/resources/templates/conf";
     }
     $dst_dir = $this->global_settings->switch_conf_dir();
     if (is_readable($dst_dir)) {
         recursive_copy($src_dir, $dst_dir);
         unset($src_dir, $dst_dir);
     }
     $fax_dir = join(DIRECTORY_SEPARATOR, array($this->global_settings->switch_storage_dir(), 'fax'));
     if (!is_readable($fax_dir)) {
         mkdir($fax_dir, 0777, true);
     }
     $voicemail_dir = join(DIRECTORY_SEPARATOR, array($this->global_settings->switch_storage_dir(), 'voicemail'));
     if (!is_readable($voicemail_dir)) {
         mkdir($voicemail_dir, 0777, true);
     }
     //create the dialplan/default.xml for single tenant or dialplan/domain.xml
     if (file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/app/dialplan")) {
         $dialplan = new dialplan();
         $dialplan->domain_uuid = $this->domain_uuid;
         $dialplan->domain = $this->domain_name;
         $dialplan->switch_dialplan_dir = join(DIRECTORY_SEPARATOR, array($this->global_settings->switch_conf_dir(), "/dialplan"));
         $dialplan->restore_advanced_xml();
         if ($this->_debug) {
             print_r($dialplan->result, $message);
             $this->write_debug($message);
         }
     }
     //write the xml_cdr.conf.xml file
     if (file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/app/xml_cdr")) {
         xml_cdr_conf_xml();
     }
     //write the switch.conf.xml file
     if (file_exists($this->global_settings->switch_conf_dir())) {
         switch_conf_xml();
     }
 }
示例#2
0
     require_once "resources/classes/install.php";
     $install = new install();
     $install->domain_uuid = $_SESSION["domain_uuid"];
     $install->domain = $domain_name;
     $install->switch_conf_dir = $switch_conf_dir;
     $install->switch_scripts_dir = $switch_scripts_dir;
     //	$install->switch_sounds_dir = $switch_sounds_dir;
     $install->copy_conf();
     $install->copy();
     //create the dialplan/default.xml for single tenant or dialplan/domain.xml
     if (file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/app/dialplan")) {
         $dialplan = new dialplan();
         $dialplan->domain_uuid = $_SESSION["domain_uuid"];
         $dialplan->domain = $domain_name;
         $dialplan->switch_dialplan_dir = $switch_dialplan_dir;
         $dialplan->restore_advanced_xml();
         //print_r($dialplan->result);
     }
     //write the xml_cdr.conf.xml file
     if (file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/app/xml_cdr")) {
         xml_cdr_conf_xml();
     }
     //write the switch.conf.xml file
     if (file_exists($switch_conf_dir)) {
         switch_conf_xml();
     }
 }
 //login the user account
 $_SESSION["username"] = $admin_username;
 //get the groups assigned to the user and then set the groups in $_SESSION["groups"]
 $sql = "SELECT * FROM v_group_users ";