Example #1
0
     //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 ";
 $sql .= "where domain_uuid=:domain_uuid ";
 $sql .= "and user_uuid=:user_uuid ";
 $prep_statement = $db->prepare(check_sql($sql));
 $prep_statement->bindParam(':domain_uuid', $_SESSION["domain_uuid"]);
 $prep_statement->bindParam(':user_uuid', $_SESSION["user_uuid"]);
 $prep_statement->execute();
 $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
 $_SESSION["groups"] = $result;
 unset($sql, $row_count, $prep_statement);
Example #2
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();
     }
 }
Example #3
0
 protected function copy_conf()
 {
     //send a message
     $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(), 02770, 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, 02770, true);
     }
     $voicemail_dir = join(DIRECTORY_SEPARATOR, array($this->global_settings->switch_storage_dir(), 'voicemail'));
     if (!is_readable($voicemail_dir)) {
         mkdir($voicemail_dir, 02770, true);
     }
     //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();
     }
 }