mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Merge remote-tracking branch 'remotes/fusionpbx/master' into Enhance_Install
This commit is contained in:
@@ -381,7 +381,11 @@ include "root.php";
|
||||
if (!is_array($_SESSION[$_SESSION['domain_uuid']]['outbound_routes'])) {
|
||||
//get the outbound routes from the database
|
||||
$sql = "select * from v_dialplans as d, v_dialplan_details as s ";
|
||||
$sql .= "where d.domain_uuid = '".$this->domain_uuid."' ";
|
||||
$sql .= "where ";
|
||||
$sql .= "( ";
|
||||
$sql .= "d.domain_uuid = '".$this->domain_uuid."' ";
|
||||
$sql .= "or d.domain_uuid is null ";
|
||||
$sql .= ") ";
|
||||
$sql .= "and d.app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3' ";
|
||||
$sql .= "and d.dialplan_enabled = 'true' ";
|
||||
$sql .= "and d.dialplan_uuid = s.dialplan_uuid ";
|
||||
|
||||
@@ -1112,8 +1112,26 @@ $text['label-accountcode']['ro'] = "Cod cont";
|
||||
$text['label-accountcode']['he'] = "קוד חשבון";
|
||||
|
||||
$text['label-fax_send_greeting']['en-us'] = "Greeting";
|
||||
$text['label-fax_send_greeting']['es-cl'] = "";
|
||||
$text['label-fax_send_greeting']['pt-pt'] = "";
|
||||
$text['label-fax_send_greeting']['fr-fr'] = "";
|
||||
$text['label-fax_send_greeting']['pt-br'] = "";
|
||||
$text['label-fax_send_greeting']['pl'] = "";
|
||||
$text['label-fax_send_greeting']['sv-se'] = "";
|
||||
$text['label-fax_send_greeting']['de-at'] = "";
|
||||
$text['label-fax_send_greeting']['ro'] = "";
|
||||
$text['label-fax_send_greeting']['he'] = "";
|
||||
|
||||
$text['label-fax_send_channels']['en-us'] = "Number of channels";
|
||||
$text['label-fax_send_channels']['es-cl'] = "";
|
||||
$text['label-fax_send_channels']['pt-pt'] = "";
|
||||
$text['label-fax_send_channels']['fr-fr'] = "";
|
||||
$text['label-fax_send_channels']['pt-br'] = "";
|
||||
$text['label-fax_send_channels']['pl'] = "";
|
||||
$text['label-fax_send_channels']['sv-se'] = "";
|
||||
$text['label-fax_send_channels']['de-at'] = "";
|
||||
$text['label-fax_send_channels']['ro'] = "";
|
||||
$text['label-fax_send_channels']['he'] = "";
|
||||
|
||||
$text['header-sent']['en-us'] = "Sent Faxes";
|
||||
$text['header-sent']['es-cl'] = "Los Faxes Enviados";
|
||||
|
||||
@@ -42,6 +42,15 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0);
|
||||
// $device_template = check_str($_REQUEST['template']);
|
||||
//}
|
||||
|
||||
//get the mac address for Cisco 79xx in the URL as &name=SEP000000000000
|
||||
if (empty($mac)){
|
||||
$name = check_str($_REQUEST['name']);
|
||||
if (substr($name, 0, 3) == "SEP") {
|
||||
$mac = strtolower(substr($name, 3, 12));
|
||||
unset($name);
|
||||
}
|
||||
}
|
||||
|
||||
//check alternate MAC source
|
||||
if (empty($mac)){
|
||||
//set the http user agent
|
||||
@@ -283,7 +292,7 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0);
|
||||
|
||||
//deliver the customized config over HTTP/HTTPS
|
||||
//need to make sure content-type is correct
|
||||
if ($_REQUEST['content_type'] = 'application/octet-stream') {
|
||||
if ($_REQUEST['content_type'] == 'application/octet-stream') {
|
||||
$file_name = str_replace("{\$mac}",$mac,$file);
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-Type: application/octet-stream');
|
||||
|
||||
@@ -402,7 +402,7 @@ include "root.php";
|
||||
//get the contacts array and add to the template engine
|
||||
if (strlen($device_uuid) > 0 and strlen($domain_uuid) > 0 and $_SESSION['provision']['directory']['boolean'] == "true") {
|
||||
//get contacts from the database
|
||||
$sql = "select c.contact_organization, c.contact_name_given, c.contact_name_family, p.phone_number, p.phone_extension ";
|
||||
$sql = "select c.contact_category, c.contact_organization, c.contact_name_given, c.contact_name_family, p.phone_number, p.phone_extension ";
|
||||
$sql .= "from v_contacts as c, v_contact_phones as p ";
|
||||
$sql .= "where c.domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and c.contact_uuid = p.contact_uuid ";
|
||||
@@ -801,6 +801,13 @@ include "root.php";
|
||||
$tmp_array = '';
|
||||
$i = 0;
|
||||
|
||||
//build the provision array
|
||||
foreach($_SESSION['provision'] as $key=>$val) {
|
||||
if (strlen($val['var']) > 0) { $value = $val['var']; }
|
||||
if (strlen($val['text']) > 0) { $value = $val['text']; }
|
||||
$provision[$key] = $value;
|
||||
}
|
||||
|
||||
//get the devices
|
||||
$sql = "select * from v_devices ";
|
||||
//$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
|
||||
|
||||
@@ -126,6 +126,9 @@ if ($domains_processed == 1) {
|
||||
$config = $_SESSION['switch']['scripts']['dir']."/resources/config.lua";
|
||||
}
|
||||
$fout = fopen($config,"w");
|
||||
if(!$fout){
|
||||
throw new Exception("Failed to open '$config' for writing");
|
||||
}
|
||||
$tmp = "\n";
|
||||
$tmp .= "--set the variables\n";
|
||||
if (strlen($_SESSION['switch']['sounds']['dir']) > 0) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
$text['title-install_first_time']['en-us'] = "First Time Install";
|
||||
$text['title-install_first_time']['es-cl'] = "";
|
||||
$text['title-install_first_time']['pt-pt'] = "";
|
||||
$text['title-install_first_time']['es-cl'] = "Instale Primera Vez";
|
||||
$text['title-install_first_time']['pt-pt'] = "Première installation";
|
||||
$text['title-install_first_time']['fr-fr'] = "";
|
||||
$text['title-install_first_time']['pt-br'] = "";
|
||||
$text['title-install_first_time']['pl'] = "";
|
||||
@@ -78,10 +78,37 @@ $text['message-delete']['de-at'] = "Erfolgreich gelöscht";
|
||||
$text['message-delete']['ar-eg'] = "تم المسح";
|
||||
|
||||
$text['label-ft-install']['en-us'] = "First Time Install";
|
||||
$text['label-ft-install']['es-cl'] = "";
|
||||
$text['label-ft-install']['pt-pt'] = "";
|
||||
$text['label-ft-install']['fr-fr'] = "";
|
||||
$text['label-ft-install']['pt-br'] = "";
|
||||
$text['label-ft-install']['pl'] = "";
|
||||
$text['label-ft-install']['sv-se'] = "";
|
||||
$text['label-ft-install']['uk'] = "";
|
||||
$text['label-ft-install']['de-at'] = "";
|
||||
$text['label-ft-install']['ar-eg'] = "";
|
||||
|
||||
$text['description-ft-install']['en-us'] = "Perform all actions for a First Time Install";
|
||||
$text['description-ft-install']['es-cl'] = "";
|
||||
$text['description-ft-install']['pt-pt'] = "";
|
||||
$text['description-ft-install']['fr-fr'] = "";
|
||||
$text['description-ft-install']['pt-br'] = "";
|
||||
$text['description-ft-install']['pl'] = "";
|
||||
$text['description-ft-install']['sv-se'] = "";
|
||||
$text['description-ft-install']['uk'] = "";
|
||||
$text['description-ft-install']['de-at'] = "";
|
||||
$text['description-ft-install']['ar-eg'] = "";
|
||||
|
||||
$text['label-add-switch']['en-us'] = "Add a new switch";
|
||||
$text['description-add-switch']['en-us'] = "Add a new switch";
|
||||
$text['label-add-switch']['es-cl'] = "";
|
||||
$text['label-add-switch']['pt-pt'] = "";
|
||||
$text['label-add-switch']['fr-fr'] = "";
|
||||
$text['label-add-switch']['pt-br'] = "";
|
||||
$text['label-add-switch']['pl'] = "";
|
||||
$text['label-add-switch']['sv-se'] = "";
|
||||
$text['label-add-switch']['uk'] = "";
|
||||
$text['label-add-switch']['de-at'] = "";
|
||||
$text['label-add-switch']['ar-eg'] = "";
|
||||
|
||||
$text['label-select_language']['en-us'] = "Language";
|
||||
$text['label-select_language']['es-cl'] = "";
|
||||
|
||||
@@ -78,21 +78,6 @@ if (!if_group("superadmin")) {
|
||||
echo "</table>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
echo "<form name='frm' method='post' action='/core/install/install_add_switch.php'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo " <td width='30%' class='vncell'>\n";
|
||||
echo " <input id='do_add-switch' type='submit' class='btn' value='".$text['label-add-switch']."'/>";
|
||||
echo " </td>\n";
|
||||
echo " <td width='70%' class='vtable' style='height: 50px;'>\n";
|
||||
echo " <label for='do_add-switch'>";
|
||||
echo " ".$text['description-add-switch'];
|
||||
echo " </label>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
echo "<br><br>";
|
||||
|
||||
echo "<p>WiP</p>";
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2015
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -28,7 +28,7 @@ require_once "root.php";
|
||||
require_once "resources/functions.php";
|
||||
require_once "resources/classes/text.php";
|
||||
|
||||
//initialize varibles we are going to use
|
||||
//initialize variables we are going to use
|
||||
$event_host = '';
|
||||
$event_port = '';
|
||||
$event_password = '';
|
||||
@@ -63,7 +63,7 @@ if (is_link('/etc/localtime')) {
|
||||
// Ubuntu / Debian.
|
||||
$data = file_get_contents('/etc/timezone');
|
||||
if ($data) {
|
||||
$timezone = $data;
|
||||
$timezone = rtrim($data);
|
||||
}
|
||||
} elseif (file_exists('/etc/sysconfig/clock')) {
|
||||
// RHEL / CentOS
|
||||
@@ -80,7 +80,6 @@ $first_time_install = true;
|
||||
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
|
||||
$first_time_install = false;
|
||||
} elseif (file_exists("/etc/fusionpbx/config.php")) {
|
||||
//linux
|
||||
$first_time_install = false;
|
||||
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
|
||||
$first_time_install = false;
|
||||
@@ -98,7 +97,7 @@ if(!$first_time_install) {
|
||||
$install_step = '';
|
||||
$return_install_step = '';
|
||||
|
||||
if (count($_POST)>0) {
|
||||
if (count($_POST) > 0) {
|
||||
$install_language = check_str($_POST["install_language"]);
|
||||
$install_step = check_str($_POST["install_step"]);
|
||||
$return_install_step = check_str($_POST["return_install_step"]);
|
||||
@@ -130,7 +129,7 @@ if(!$install_step) { $install_step = 'select_language'; }
|
||||
if (isset($_SESSION['domain']['template']['name']) and strlen($_SESSION['domain']['template']['name']) != 0) {
|
||||
$default_template = $_SESSION['domain']['template']['name'];
|
||||
}
|
||||
|
||||
|
||||
//set a default enviroment if first_time
|
||||
if($first_time_install){
|
||||
//initialize some varibles to cut down on warnings
|
||||
@@ -147,7 +146,7 @@ if(!$install_step) { $install_step = 'select_language'; }
|
||||
//buffer the content
|
||||
ob_end_clean(); //clean the buffer
|
||||
ob_start();
|
||||
|
||||
|
||||
$messages = array();
|
||||
if (!extension_loaded('PDO')) {
|
||||
$messages[] = "<b>PHP PDO was not detected</b>. Please install it before proceeding";
|
||||
@@ -168,7 +167,7 @@ if(!$install_step) { $install_step = 'select_language'; }
|
||||
"<sm>You can use the following to find what ports are allowed<pre>semanage port -l | grep '^http_port_t'</pre></sm>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//action code
|
||||
if($return_install_step == 'config_detail'){
|
||||
//check for all required data
|
||||
@@ -185,11 +184,8 @@ if(!$install_step) { $install_step = 'select_language'; }
|
||||
|
||||
//set the max execution time to 1 hour
|
||||
ini_set('max_execution_time',3600);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//display messages
|
||||
if (count($messages)>0) {
|
||||
echo "<br />\n";
|
||||
@@ -224,6 +220,9 @@ if(!$install_step) { $install_step = 'select_language'; }
|
||||
echo " </div>\n";
|
||||
echo "</form>\n";
|
||||
}elseif($install_step == 'detect_config'){
|
||||
if(!($event_host == '' || $event_host == 'localhost' || $event_host == '::1' || $event_host == '127.0.0.1' )){
|
||||
echo "<p><b>Warning</b> you have choosen a value other than localhost for event_host, this is unsoported at present</p>\n";
|
||||
}
|
||||
include "resources/page_parts/install_event_socket.php";
|
||||
if($detect_ok){
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
@@ -238,6 +237,12 @@ if(!$install_step) { $install_step = 'select_language'; }
|
||||
echo " <button type='submit' id='next'>".$text['button-next']."</button>\n";
|
||||
echo " </div>\n";
|
||||
echo "</form>\n";
|
||||
}else{
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo " <div style='text-align:right'>\n";
|
||||
echo " <button type='button' onclick=\"history.go(-1);\">".$text['button-back']."</button>\n";
|
||||
echo " </div>\n";
|
||||
echo "</form>\n";
|
||||
}
|
||||
}
|
||||
elseif($install_step == 'config_detail'){
|
||||
@@ -262,7 +267,7 @@ if(!$install_step) { $install_step = 'select_language'; }
|
||||
try {
|
||||
$switch_detect->detect();
|
||||
} catch(Exception $e){
|
||||
echo "<p>Failed to detect confgiuration detect_switch reported: " . $e->getMessage() . "</p>\n";
|
||||
echo "<p>Failed to detect configuration detect_switch reported: " . $e->getMessage() . "</p>\n";
|
||||
$detect_ok = false;
|
||||
}
|
||||
if($detect_ok){
|
||||
@@ -285,32 +290,34 @@ if(!$install_step) { $install_step = 'select_language'; }
|
||||
#set_error_handler("error_handler");
|
||||
try {
|
||||
require_once "resources/classes/install_fusionpbx.php";
|
||||
$fusionPBX = new install_fusionpbx($domain_name, null, $switch_detect);
|
||||
$domain_uuid = $fusionPBX->domain_uuid();
|
||||
//$fusionPBX->debug = true;
|
||||
$fusionPBX->admin_username = $admin_username;
|
||||
$fusionPBX->admin_password = $admin_password;
|
||||
$fusionPBX->default_country = $install_default_country;
|
||||
$fusionPBX->install_language = $install_language;
|
||||
$fusionPBX->template_name = $install_template_name;
|
||||
$system = new install_fusionpbx($domain_name, null, $switch_detect);
|
||||
$domain_uuid = $system->domain_uuid();
|
||||
$system->admin_username = $admin_username;
|
||||
$system->admin_password = $admin_password;
|
||||
$system->default_country = $install_default_country;
|
||||
$system->install_language = $install_language;
|
||||
$system->template_name = $install_template_name;
|
||||
foreach($_POST as $key=>$value){
|
||||
if(substr($key,0,3) == "db_"){
|
||||
$fusionPBX->$key = $value;
|
||||
$system->$key = $value;
|
||||
}
|
||||
}
|
||||
$fusionPBX->install();
|
||||
|
||||
|
||||
require_once "resources/classes/install_switch.php";
|
||||
$switch = new install_switch($domain_name, $domain_uuid, $switch_detect);
|
||||
//$switch->debug = true;
|
||||
//$system->debug = true;
|
||||
$system->install();
|
||||
$switch->install();
|
||||
$system->app_defaults();
|
||||
$switch_detect->restart_switch();
|
||||
}catch(Exception $e){
|
||||
echo "</pre>\n";
|
||||
echo "<p><b>Failed to install</b><br/>" . $e->getMessage() . "</p>\n";
|
||||
try {
|
||||
require_once "resources/classes/install_fusionpbx.php";
|
||||
$fusionPBX = new install_fusionpbx($domain_name, $domain_uuid, $switch_detect);
|
||||
$fusionPBX->remove_config();
|
||||
$system = new install_fusionpbx($domain_name, $domain_uuid, $switch_detect);
|
||||
$system->remove_config();
|
||||
}catch(Exception $e){
|
||||
echo "<p><b>Failed to remove config:</b> " . $e->getMessage() . "</p>\n";
|
||||
}
|
||||
@@ -345,6 +352,7 @@ if($first_time_install){
|
||||
$_SESSION['permissions'][]['permission_name'] = 'superadmin';
|
||||
$_SESSION['menu'] = '';
|
||||
}
|
||||
|
||||
// add the content to the template and then send output
|
||||
$body = ob_get_contents(); //get the output from the buffer
|
||||
ob_end_clean(); //clean the buffer
|
||||
|
||||
@@ -35,11 +35,11 @@ include "root.php";
|
||||
protected $config_php;
|
||||
protected $menu_uuid = 'b4750c3f-2a86-b00d-b7d0-345c14eca286';
|
||||
protected $dbh;
|
||||
|
||||
|
||||
public function domain_uuid() { return $this->_domain_uuid; }
|
||||
|
||||
public $debug = false;
|
||||
|
||||
|
||||
public $install_msg;
|
||||
public $install_language = 'en-us';
|
||||
public $admin_username;
|
||||
@@ -54,7 +54,7 @@ include "root.php";
|
||||
public $db_name;
|
||||
public $db_username;
|
||||
public $db_password;
|
||||
|
||||
|
||||
function __construct($domain_name, $domain_uuid, $detect_switch) {
|
||||
if(!is_a($detect_switch, 'detect_switch')){
|
||||
throw new Exception('The parameter $detect_switch must be a detect_switch object (or a subclass of)');
|
||||
@@ -94,9 +94,8 @@ include "root.php";
|
||||
$this->create_superuser();
|
||||
require "resources/require.php";
|
||||
$this->create_menus();
|
||||
$this->app_defaults();
|
||||
}
|
||||
|
||||
|
||||
protected function create_config_php() {
|
||||
$tmp_config = "<?php\n";
|
||||
$tmp_config .= "/* \$Id\$ */\n";
|
||||
@@ -184,10 +183,11 @@ include "root.php";
|
||||
$tmp_config .= " error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ); //hide notices and warnings";
|
||||
$tmp_config .= "\n";
|
||||
$tmp_config .= "?>";
|
||||
|
||||
if((file_exists($this->config_php) and !is_writable($this->config_php))
|
||||
or !is_writable(dirname($this->config_php))
|
||||
){
|
||||
|
||||
if((file_exists($this->config_php)
|
||||
and !is_writable($this->config_php))
|
||||
or !is_writable(dirname($this->config_php))
|
||||
) {
|
||||
throw new Exception("cannot write to '" . $this->config_php . "'" );
|
||||
}
|
||||
$this->write_progress("Creating " . $this->config_php);
|
||||
@@ -196,7 +196,7 @@ include "root.php";
|
||||
unset($tmp_config);
|
||||
fclose($fout);
|
||||
}
|
||||
|
||||
|
||||
protected function create_database() {
|
||||
require $this->config_php;
|
||||
$this->write_progress("Creating database as " . $this->db_type);
|
||||
@@ -205,6 +205,7 @@ include "root.php";
|
||||
global $db;
|
||||
$db = $this->dbh;
|
||||
}
|
||||
|
||||
protected function create_database_sqlite() {
|
||||
//sqlite database will be created when the config.php is loaded and only if the database file does not exist
|
||||
try {
|
||||
@@ -268,7 +269,7 @@ include "root.php";
|
||||
}
|
||||
|
||||
protected function create_database_pgsql() {
|
||||
|
||||
|
||||
//if $this->db_create_username provided, attempt to create new PG role and database
|
||||
if (strlen($this->db_create_username) > 0) {
|
||||
try {
|
||||
@@ -281,16 +282,16 @@ include "root.php";
|
||||
} catch (PDOException $error) {
|
||||
throw new Exception("error connecting to database: " . $error->getMessage());
|
||||
}
|
||||
|
||||
|
||||
//create the database, user, grant perms
|
||||
$this->dbh->exec("CREATE DATABASE {$this->db_name}");
|
||||
$this->dbh->exec("CREATE USER {$this->db_username} WITH PASSWORD '{$this->db_password}'");
|
||||
$this->dbh->exec("GRANT ALL ON {$this->db_name} TO {$this->db_username}");
|
||||
|
||||
|
||||
//close database connection_aborted
|
||||
$this->dbh = null;
|
||||
}
|
||||
|
||||
|
||||
//open database connection with $this->db_name
|
||||
try {
|
||||
if (strlen($this->db_port) == 0) { $this->db_port = "5432"; }
|
||||
@@ -303,7 +304,7 @@ include "root.php";
|
||||
catch (PDOException $error) {
|
||||
throw new Exception("error connecting to database: " . $error->getMessage());
|
||||
}
|
||||
|
||||
|
||||
//add the database structure
|
||||
require_once "resources/classes/schema.php";
|
||||
$schema = new schema;
|
||||
@@ -311,7 +312,7 @@ include "root.php";
|
||||
$schema->db_type = $this->db_type;
|
||||
$schema->sql();
|
||||
$schema->exec();
|
||||
|
||||
|
||||
//get the contents of the sql file
|
||||
if (file_exists('/usr/share/examples/fusionpbx/resources/install/sql/pgsql.sql')){
|
||||
$filename = "/usr/share/examples/fusionpbx/resources/install/sql/pgsql.sql";
|
||||
@@ -320,10 +321,10 @@ include "root.php";
|
||||
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/pgsql.sql';
|
||||
}
|
||||
$file_contents = file_get_contents($filename);
|
||||
|
||||
|
||||
//replace \r\n with \n then explode on \n
|
||||
$file_contents = str_replace("\r\n", "\n", $file_contents);
|
||||
|
||||
|
||||
//loop line by line through all the lines of sql code
|
||||
$string_array = explode("\n", $file_contents);
|
||||
$x = 0;
|
||||
@@ -340,7 +341,7 @@ include "root.php";
|
||||
}
|
||||
unset ($file_contents, $sql);
|
||||
}
|
||||
|
||||
|
||||
protected function create_database_mysql() {
|
||||
//database connection
|
||||
try {
|
||||
@@ -377,7 +378,7 @@ include "root.php";
|
||||
catch (PDOException $error) {
|
||||
throw new Exception("error creating database: " . $error->getMessage() . "\n" . $sql );
|
||||
}
|
||||
|
||||
|
||||
//create the table, user and set the permissions only if the db_create_username was provided
|
||||
if (strlen($this->db_create_username) > 0) {
|
||||
//select the mysql database
|
||||
@@ -389,7 +390,7 @@ include "root.php";
|
||||
throw new Exception("error conencting to database: " . $error->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//create user and set the permissions
|
||||
try {
|
||||
$tmp_sql = "CREATE USER '".$this->db_username."'@'%' IDENTIFIED BY '".$this->db_password."'; ";
|
||||
@@ -400,7 +401,7 @@ include "root.php";
|
||||
print "error: " . $error->getMessage() . "<br/>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//set account to unlimited use
|
||||
try {
|
||||
if ($this->db_host == "localhost" || $this->db_host == "127.0.0.1") {
|
||||
@@ -408,7 +409,7 @@ include "root.php";
|
||||
$tmp_sql .= "IDENTIFIED BY '".$this->db_password."' ";
|
||||
$tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; ";
|
||||
$this->dbh->query($tmp_sql);
|
||||
|
||||
|
||||
$tmp_sql = "GRANT USAGE ON * . * TO '".$this->db_username."'@'127.0.0.1' ";
|
||||
$tmp_sql .= "IDENTIFIED BY '".$this->db_password."' ";
|
||||
$tmp_sql .= "WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; ";
|
||||
@@ -426,7 +427,7 @@ include "root.php";
|
||||
print "error: " . $error->getMessage() . "<br/>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//create the database and set the create user with permissions
|
||||
try {
|
||||
$tmp_sql = "CREATE DATABASE IF NOT EXISTS ".$this->db_name."; ";
|
||||
@@ -437,7 +438,7 @@ include "root.php";
|
||||
print "error: " . $error->getMessage() . "<br/>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//set user permissions
|
||||
try {
|
||||
$this->dbh->query("GRANT ALL PRIVILEGES ON ".$this->db_name.".* TO '".$this->db_username."'@'%'; ");
|
||||
@@ -447,7 +448,7 @@ include "root.php";
|
||||
print "error: " . $error->getMessage() . "<br/>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//make the changes active
|
||||
try {
|
||||
$tmp_sql = "FLUSH PRIVILEGES; ";
|
||||
@@ -458,9 +459,9 @@ include "root.php";
|
||||
print "error: " . $error->getMessage() . "<br/>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} //if (strlen($this->db_create_username) > 0)
|
||||
|
||||
|
||||
//select the database
|
||||
try {
|
||||
$this->dbh->query("USE ".$this->db_name.";");
|
||||
@@ -470,7 +471,7 @@ include "root.php";
|
||||
print "error: " . $error->getMessage() . "<br/>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//add the database structure
|
||||
require_once "resources/classes/schema.php";
|
||||
$schema = new schema;
|
||||
@@ -478,7 +479,7 @@ include "root.php";
|
||||
$schema->db_type = $this->db_type;
|
||||
$schema->sql();
|
||||
$schema->exec();
|
||||
|
||||
|
||||
//add the defaults data into the database
|
||||
//get the contents of the sql file
|
||||
if (file_exists('/usr/share/examples/fusionpbx/resources/install/sql/mysql.sql')){
|
||||
@@ -488,10 +489,10 @@ include "root.php";
|
||||
$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/sql/mysql.sql';
|
||||
}
|
||||
$file_contents = file_get_contents($filename);
|
||||
|
||||
|
||||
//replace \r\n with \n then explode on \n
|
||||
$file_contents = str_replace("\r\n", "\n", $file_contents);
|
||||
|
||||
|
||||
//loop line by line through all the lines of sql code
|
||||
$string_array = explode("\n", $file_contents);
|
||||
$x = 0;
|
||||
@@ -513,7 +514,6 @@ include "root.php";
|
||||
unset ($file_contents, $sql);
|
||||
}
|
||||
|
||||
|
||||
protected function create_domain() {
|
||||
$this->write_progress("Checking if domain exists '" . $this->domain_name . "'");
|
||||
$sql = "select * from v_domains ";
|
||||
@@ -530,7 +530,7 @@ include "root.php";
|
||||
if($result['domain_enabled'] != 'true'){
|
||||
throw new Exception("Domain already exists but is disabled, this is unexpected");
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$this->write_progress("... creating domain");
|
||||
$sql = "insert into v_domains ";
|
||||
$sql .= "(";
|
||||
@@ -544,11 +544,11 @@ include "root.php";
|
||||
$sql .= "'".$this->domain_name."', ";
|
||||
$sql .= "'' ";
|
||||
$sql .= ");";
|
||||
|
||||
|
||||
$this->write_debug($sql);
|
||||
$this->dbh->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
|
||||
//domain settings
|
||||
$x = 0;
|
||||
$tmp[$x]['name'] = 'uuid';
|
||||
@@ -580,7 +580,7 @@ include "root.php";
|
||||
$tmp[$x]['subcategory'] = 'template';
|
||||
$tmp[$x]['enabled'] = 'true';
|
||||
$x++;
|
||||
|
||||
|
||||
//switch settings
|
||||
$tmp[$x]['name'] = 'dir';
|
||||
$tmp[$x]['value'] = $switch_bin_dir;
|
||||
@@ -684,7 +684,7 @@ include "root.php";
|
||||
$tmp[$x]['subcategory'] = 'dialplan';
|
||||
$tmp[$x]['enabled'] = 'false';
|
||||
$x++;
|
||||
|
||||
|
||||
//server settings
|
||||
$tmp[$x]['name'] = 'dir';
|
||||
$tmp[$x]['value'] = $this->detect_switch->temp_dir();
|
||||
@@ -705,7 +705,7 @@ include "root.php";
|
||||
$tmp[$x]['subcategory'] = 'backup';
|
||||
$tmp[$x]['enabled'] = 'true';
|
||||
$x++;
|
||||
|
||||
|
||||
$this->dbh->beginTransaction();
|
||||
foreach($tmp as $row) {
|
||||
$sql = "insert into v_default_settings ";
|
||||
@@ -732,7 +732,7 @@ include "root.php";
|
||||
}
|
||||
$this->dbh->commit();
|
||||
unset($tmp);
|
||||
|
||||
|
||||
//get the list of installed apps from the core and mod directories
|
||||
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
|
||||
$x=0;
|
||||
@@ -740,7 +740,7 @@ include "root.php";
|
||||
include($config_path);
|
||||
$x++;
|
||||
}
|
||||
|
||||
|
||||
//add the groups
|
||||
$x = 0;
|
||||
$tmp[$x]['group_name'] = 'superadmin';
|
||||
@@ -814,7 +814,7 @@ include "root.php";
|
||||
$this->dbh->commit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function create_superuser() {
|
||||
$this->write_progress("Checking if superuser exists '" . $this->domain_name . "'");
|
||||
$sql = "select * from v_users ";
|
||||
@@ -933,14 +933,14 @@ include "root.php";
|
||||
unset($sql);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function create_menus() {
|
||||
$this->write_progress("Creating menus");
|
||||
//set the defaults
|
||||
$menu_name = 'default';
|
||||
$menu_language = 'en-us';
|
||||
$menu_description = 'Default Menu Set';
|
||||
|
||||
|
||||
$this->write_progress("Checking if menu exists");
|
||||
$sql = "select count(*) from v_menus ";
|
||||
$sql .= "where menu_uuid = '".$this->menu_uuid."' ";
|
||||
@@ -971,7 +971,7 @@ include "root.php";
|
||||
}
|
||||
$this->dbh->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
|
||||
//add the menu items
|
||||
require_once "resources/classes/menu.php";
|
||||
$menu = new menu;
|
||||
@@ -981,16 +981,19 @@ include "root.php";
|
||||
unset($menu);
|
||||
}
|
||||
}
|
||||
|
||||
protected function app_defaults() {
|
||||
|
||||
public function app_defaults() {
|
||||
$this->write_progress("Running app_defaults");
|
||||
|
||||
|
||||
//set needed session settings
|
||||
$_SESSION["username"] = $this->admin_username;
|
||||
$_SESSION["domain_uuid"] = $this->_domain_uuid;
|
||||
require $this->config_php;
|
||||
require "resources/require.php";
|
||||
|
||||
$_SESSION['event_socket_ip_address'] = $this->detect_switch->event_host;
|
||||
$_SESSION['event_socket_port'] = $this->detect_switch->event_port;
|
||||
$_SESSION['event_socket_password'] = $this->detect_switch->event_password;
|
||||
|
||||
//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 ";
|
||||
@@ -1002,7 +1005,7 @@ include "root.php";
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$_SESSION["groups"] = $result;
|
||||
unset($sql, $row_count, $prep_statement);
|
||||
|
||||
|
||||
//get the permissions assigned to the groups that the user is a member of set the permissions in $_SESSION['permissions']
|
||||
$x = 0;
|
||||
$sql = "select distinct(permission_name) from v_group_permissions ";
|
||||
@@ -1017,37 +1020,41 @@ include "root.php";
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
$prep_statementsub = $this->dbh->prepare($sql);
|
||||
$prep_statementsub->execute();
|
||||
$_SESSION['permissions'] = $prep_statementsub->fetchAll(PDO::FETCH_NAMED);
|
||||
unset($sql, $prep_statementsub);
|
||||
$prep_statement_sub = $this->dbh->prepare($sql);
|
||||
$prep_statement_sub->execute();
|
||||
$_SESSION['permissions'] = $prep_statement_sub->fetchAll(PDO::FETCH_NAMED);
|
||||
unset($sql, $prep_statement_sub);
|
||||
|
||||
//include the config.php
|
||||
$db_type = $this->db_type;
|
||||
$db_path = $this->db_path;
|
||||
$db_host = $this->db_host;
|
||||
$db_port = $this->db_port;
|
||||
$db_name = $this->db_name;
|
||||
$db_username = $this->db_username;
|
||||
$db_password = $this->db_password;
|
||||
|
||||
|
||||
|
||||
|
||||
//add the database structure
|
||||
require_once "resources/classes/schema.php";
|
||||
global $db, $db_type, $db_name, $db_username, $db_password, $db_host, $db_path, $db_port;
|
||||
|
||||
$schema = new schema;
|
||||
echo $schema->schema();
|
||||
|
||||
|
||||
//run all app_defaults.php files
|
||||
$default_language = $this->install_language;
|
||||
$domain = new domains;
|
||||
$domain->upgrade();
|
||||
|
||||
|
||||
//synchronize the config with the saved settings
|
||||
save_switch_xml();
|
||||
|
||||
|
||||
//do not show the apply settings reminder on the login page
|
||||
$_SESSION["reload_xml"] = false;
|
||||
|
||||
|
||||
//clear the menu
|
||||
$_SESSION["menu"] = "";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function remove_config() {
|
||||
if (file_exists('/bin/rm')) {
|
||||
$this->write_debug('rm -f ' . $this->config_php);
|
||||
@@ -1064,4 +1071,5 @@ include "root.php";
|
||||
clearstatcache();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -35,7 +35,14 @@ include "root.php";
|
||||
public $debug = false;
|
||||
|
||||
function __construct($domain_name, $domain_uuid, $detect_switch) {
|
||||
if(!is_a($detect_switch, 'detect_switch')){
|
||||
if($detect_switch == null){
|
||||
if(strlen($_SESSION['event_socket_ip_address']) == 0 or strlen($_SESSION['event_socket_port']) == 0 or strlen($_SESSION['event_socket_password']) == 0 ){
|
||||
throw new Exception('The parameter $detect_switch was empty and i could not find the event socket details from the session');
|
||||
}
|
||||
$detect_switch = new detect_switch($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
$domain_name = $_SESSION['domain_name'];
|
||||
$domain_uuid = $_SESSION['domain_uuid'];
|
||||
}elseif(!is_a($detect_switch, 'detect_switch')){
|
||||
throw new Exception('The parameter $detect_switch must be a detect_switch object (or a subclass of)');
|
||||
}
|
||||
$this->domain_uuid = $domain_uuid;
|
||||
@@ -166,13 +173,9 @@ include "root.php";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function install() {
|
||||
$this->copy_conf();
|
||||
$this->copy_scripts();
|
||||
//tell freeswitch to restart
|
||||
$this->write_progress("Restarting switch");
|
||||
$this->detect_switch->restart_switch();
|
||||
}
|
||||
|
||||
function upgrade() {
|
||||
@@ -182,10 +185,10 @@ include "root.php";
|
||||
function copy_conf() {
|
||||
$this->write_progress("Copying Config");
|
||||
//make a backup of the config
|
||||
if (file_exists($this->detect_switch->conf_dir())) {
|
||||
$this->backup_dir($this->detect_switch->conf_dir(), 'fusionpbx_switch_config');
|
||||
$this->recursive_delete($this->detect_switch->conf_dir());
|
||||
}
|
||||
if (file_exists($this->detect_switch->conf_dir())) {
|
||||
$this->backup_dir($this->detect_switch->conf_dir(), 'fusionpbx_switch_config');
|
||||
$this->recursive_delete($this->detect_switch->conf_dir());
|
||||
}
|
||||
//make sure the conf directory exists
|
||||
if (!is_dir($this->detect_switch->conf_dir())) {
|
||||
if (!mkdir($this->detect_switch->conf_dir(), 0774, true)) {
|
||||
@@ -236,15 +239,21 @@ include "root.php";
|
||||
|
||||
function copy_scripts() {
|
||||
$this->write_progress("Copying Scripts");
|
||||
if (file_exists($this->detect_switch->script_dir())) {
|
||||
if (strlen($_SESSION['switch']['scripts']['dir']) > 0) {
|
||||
$script_dir = $_SESSION['switch']['scripts']['dir'];
|
||||
}
|
||||
else {
|
||||
$script_dir = $this->detect_switch->script_dir();
|
||||
}
|
||||
if (file_exists($script_dir)) {
|
||||
if (file_exists('/usr/share/examples/fusionpbx/resources/install/scripts')){
|
||||
$src_dir = '/usr/share/examples/fusionpbx/resources/install/scripts';
|
||||
}
|
||||
else {
|
||||
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts';
|
||||
}
|
||||
$dst_dir = $this->detect_switch->script_dir();
|
||||
if (is_readable($this->detect_switch->script_dir())) {
|
||||
$dst_dir = $script_dir;
|
||||
if (is_readable($script_dir)) {
|
||||
$this->recursive_copy($src_dir, $dst_dir, $_SESSION['scripts']['options']['text']);
|
||||
unset($src_dir, $dst_dir);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
echo "<input type='hidden' name='install_step' value='execute'/>\n";
|
||||
|
||||
echo "<input type='hidden' name='event_host' value='$event_host'/>\n";
|
||||
echo "<input type='hidden' name='event_port' value='$event_host'/>\n";
|
||||
echo "<input type='hidden' name='event_port' value='$event_port'/>\n";
|
||||
echo "<input type='hidden' name='event_password' value='$event_password'/>\n";
|
||||
echo "<input type='hidden' name='db_type' value='$db_type'/>\n";
|
||||
echo "<input type='hidden' name='admin_username' value='$admin_username'/>\n";
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
echo "<input type='hidden' name='install_step' value='config_database'/>\n";
|
||||
|
||||
echo "<input type='hidden' name='event_host' value='$event_host'/>\n";
|
||||
echo "<input type='hidden' name='event_port' value='$event_host'/>\n";
|
||||
echo "<input type='hidden' name='event_port' value='$event_port'/>\n";
|
||||
echo "<input type='hidden' name='event_password' value='$event_password'/>\n";
|
||||
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
@@ -31,10 +31,10 @@
|
||||
try {
|
||||
$switch_detect->detect();
|
||||
} catch(Exception $e){
|
||||
$messages[] = "Failed to detect confgiuration detect_switch reported: " . $e->getMessage();
|
||||
echo "<p><b>Failed to detect configuration</b> detect_switch reported: " . $e->getMessage() ."</p>\n";
|
||||
$detect_ok = false;
|
||||
}
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<form method='post' name='detect_switch' action=''>\n";
|
||||
echo "<input type='hidden' name='install_language' value='".$_SESSION['domain']['language']['code']."'/>\n";
|
||||
echo "<input type='hidden' name='install_step' value='detect_config'/>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
@@ -26,19 +26,6 @@
|
||||
|
||||
|
||||
if ($domains_processed == 1) {
|
||||
//process if the scripts directory exists
|
||||
if (strlen($_SESSION['switch']['scripts']['dir']) > 0) {
|
||||
//if the resource scripts resource directory does not exist then create it
|
||||
if (!is_dir($_SESSION['switch']['scripts']['dir']."/resources")) {
|
||||
mkdir($_SESSION['switch']['scripts']['dir']."/resources",0755,true);
|
||||
}
|
||||
|
||||
//copy the files and directories from resources/install
|
||||
$install = new install;
|
||||
$install->domain_uuid = $domain_uuid;
|
||||
$install->switch_scripts_dir = $_SESSION['switch']['scripts']['dir'];
|
||||
$install->copy_scripts();
|
||||
}
|
||||
|
||||
//update the software table
|
||||
$sql = "select count(*) as num_rows from v_software ";
|
||||
|
||||
@@ -72,10 +72,8 @@ if (sizeof($_POST) > 0) {
|
||||
//update scripts folder, if allowed (default)
|
||||
if ($_SESSION['switch']['scripts']['dir'] != '') {
|
||||
//copy the files and directories from resources/install
|
||||
$install = new install;
|
||||
$install->domain_uuid = $domain_uuid;
|
||||
$install->switch_scripts_dir = $_SESSION['switch']['scripts']['dir'];
|
||||
$install->copy_scripts();
|
||||
$obj = new install_switch;
|
||||
$obj->upgrade();
|
||||
//set the message
|
||||
$response_message = $text['message-upgrade_source_scripts'];
|
||||
}
|
||||
|
||||
@@ -67,7 +67,10 @@
|
||||
$obj = new schema;
|
||||
echo $obj->schema("text");
|
||||
|
||||
//run all app_defaults.php files
|
||||
//request the switch to perform upgrade functions
|
||||
$obj = new install_switch;
|
||||
$obj->upgrade();
|
||||
|
||||
require_once "resources/classes/domains.php";
|
||||
$domain = new domains;
|
||||
$domain->upgrade();
|
||||
|
||||
127
resources/classes/config.php
Normal file
127
resources/classes/config.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* config
|
||||
*
|
||||
* @method get config.php
|
||||
* @method find find the path to the config.php file
|
||||
* @method exists determin if the the config.php file exists
|
||||
*/
|
||||
class config {
|
||||
|
||||
/**
|
||||
* database variables and config path
|
||||
*/
|
||||
public $db_type;
|
||||
public $db_name;
|
||||
public $db_username;
|
||||
public $db_password;
|
||||
public $db_host;
|
||||
public $db_path;
|
||||
public $db_port;
|
||||
public $config_path;
|
||||
|
||||
/**
|
||||
* Called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
//place holder
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when there are no references to a particular object
|
||||
* unset the variables used in the class
|
||||
*/
|
||||
public function __destruct() {
|
||||
foreach ($this as $key => $value) {
|
||||
unset($this->$key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the config.php exists
|
||||
* @var string $db_type - type of database
|
||||
* @var string $db_name - name of the database
|
||||
* @var string $db_username - username to access the database
|
||||
* @var string $db_password - password to access the database
|
||||
* @var string $db_host - hostname of the database server
|
||||
* @var string $db_path - path of the database file
|
||||
* @var string $db_port - network port to connect to the database
|
||||
*/
|
||||
public function get() {
|
||||
$this->find();
|
||||
if ($this->exists()) {
|
||||
require $this->config_path;
|
||||
$this->db_type = $db_type;
|
||||
$this->db_name = $db_name;
|
||||
$this->db_username = $db_username;
|
||||
$this->db_password = $db_password;
|
||||
$this->db_host = $db_host;
|
||||
$this->db_path = $db_path;
|
||||
$this->db_port = $db_port;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the path to the config.php
|
||||
* @var string $config_path - full path to the config.php file
|
||||
*/
|
||||
public function find() {
|
||||
//get the PROJECT PATH
|
||||
include "root.php";
|
||||
// find the file
|
||||
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
|
||||
$this->config_path = $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php";
|
||||
} elseif (file_exists("/etc/fusionpbx/config.php")) {
|
||||
$this->config_path = "/etc/fusionpbx/config.php";
|
||||
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
|
||||
$this->config_path = "/usr/local/etc/fusionpbx/config.php";
|
||||
}
|
||||
else {
|
||||
$this->config_path = '';
|
||||
}
|
||||
//return the path
|
||||
return $this->config_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the config.php exists
|
||||
*/
|
||||
public function exists() {
|
||||
$this->find();
|
||||
if (strlen($this->config_path) > 0) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
$config = new config;
|
||||
$config_exists = $config->exists();
|
||||
$config_path = $config->find();
|
||||
$config->get();
|
||||
$db_type = $config->db_type;
|
||||
$db_name = $config->db_name;
|
||||
$db_username = $config->db_username;
|
||||
$db_password = $config->db_password;
|
||||
$db_host = $config->db_host;
|
||||
$db_path = $config->db_path;
|
||||
$db_port = $config->db_port;
|
||||
echo "config_path: ".$config_path."\n";
|
||||
if ($config_exists) {
|
||||
echo "config_exists: true\n";
|
||||
} else {
|
||||
echo "config_exists: false\n";
|
||||
}
|
||||
echo "db_type: ".$db_type."\n";
|
||||
echo "db_name: ".$db_name."\n";
|
||||
echo "db_username: ".$db_username."\n";
|
||||
echo "db_password: ".$db_password."\n";
|
||||
echo "db_host: ".$db_host."\n";
|
||||
echo "db_path: ".$db_path."\n";
|
||||
echo "db_port: ".$db_port."\n";
|
||||
*/
|
||||
|
||||
?>
|
||||
@@ -215,7 +215,20 @@
|
||||
public function upgrade() {
|
||||
|
||||
//set the global variable
|
||||
global $db, $db_type, $db_name, $db_username, $db_password, $db_host, $db_path, $db_port;
|
||||
global $db;
|
||||
|
||||
//get the db variables
|
||||
$config = new config;
|
||||
$config_exists = $config->exists();
|
||||
$config_path = $config->find();
|
||||
$config->get();
|
||||
$db_type = $config->db_type;
|
||||
$db_name = $config->db_name;
|
||||
$db_username = $config->db_username;
|
||||
$db_password = $config->db_password;
|
||||
$db_host = $config->db_host;
|
||||
$db_path = $config->db_path;
|
||||
$db_port = $config->db_port;
|
||||
|
||||
//get the PROJECT PATH
|
||||
include "root.php";
|
||||
|
||||
@@ -448,8 +448,20 @@ include "root.php";
|
||||
public function schema ($format) {
|
||||
|
||||
//set the global variable
|
||||
global $db, $db_type, $db_name, $db_username, $db_password;
|
||||
global $db_host, $db_path, $db_port, $upgrade_data_types, $text;
|
||||
global $db, $upgrade_data_types, $text;
|
||||
|
||||
//get the db variables
|
||||
$config = new config;
|
||||
$config_exists = $config->exists();
|
||||
$config_path = $config->find();
|
||||
$config->get();
|
||||
$db_type = $config->db_type;
|
||||
$db_name = $config->db_name;
|
||||
$db_username = $config->db_username;
|
||||
$db_password = $config->db_password;
|
||||
$db_host = $config->db_host;
|
||||
$db_path = $config->db_path;
|
||||
$db_port = $config->db_port;
|
||||
|
||||
//get the PROJECT PATH
|
||||
include "root.php";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
-- @usage without queue
|
||||
-- api: originate {fax_file='',wav_file='',fax_dtmf=''}user/108@domain.local &lua(fax_queue/exec.lua)
|
||||
-- api: originate {fax_file='',wav_file='',fax_dtmf=''}user/108@domain.local &lua(app/fax/resources/scripts/queue/exec.lua)
|
||||
-- @usage with queue task
|
||||
-- api: originate {fax_task_uuid=''}user/108@domain.local &lua(fax_queue/exec.lua)
|
||||
-- api: originate {fax_task_uuid=''}user/108@domain.local &lua(app/fax/resources/scripts/queue/exec.lua)
|
||||
-- @fax_dtmf
|
||||
-- 0-9*# - dtmf symbols
|
||||
-- @200 - dtmf duration in ms
|
||||
@@ -18,7 +18,7 @@ local log = require "resources.functions.log".fax_task
|
||||
-- If we handle queue task
|
||||
local fax_task_uuid = session:getVariable('fax_task_uuid')
|
||||
local task if fax_task_uuid then
|
||||
local Tasks = require "fax_queue.tasks"
|
||||
local Tasks = require "app.fax.resources.scripts.queue.tasks"
|
||||
task = Tasks.select_task(fax_task_uuid)
|
||||
if not task then
|
||||
log.warningf("Can not found fax task: %q", tostring(fax_task_uuid))
|
||||
@@ -132,6 +132,12 @@ local function check()
|
||||
end
|
||||
|
||||
local function task()
|
||||
local session_uuid = session:getVariable('uuid')
|
||||
|
||||
session:setVariable('fax_queue_task_session', session_uuid)
|
||||
|
||||
log.infof("SESSION UUID: %s", session_uuid)
|
||||
|
||||
session:waitForAnswer(session)
|
||||
|
||||
while not session:answered() do
|
||||
@@ -2,7 +2,7 @@ require "resources.functions.config"
|
||||
|
||||
require "resources.functions.sleep"
|
||||
local log = require "resources.functions.log".next_fax_task
|
||||
local Tasks = require "fax_queue.tasks"
|
||||
local Tasks = require "app.fax.resources.scripts.queue.tasks"
|
||||
local Esl = require "resources.functions.esl"
|
||||
|
||||
local FAX_OPTIONS = {
|
||||
@@ -28,22 +28,26 @@ local function next_task()
|
||||
local esl
|
||||
local ok, err = pcall(function()
|
||||
|
||||
for k, v in pairs(task) do
|
||||
print(string.format(" `%s` => `%s`", tostring(k), tostring(v)))
|
||||
end
|
||||
|
||||
local mode = (task.retry_counter % #FAX_OPTIONS) + 1
|
||||
local dial_string = '{' ..
|
||||
task.dial_string .. "api_hangup_hook='lua fax_queue/retry.lua'," ..
|
||||
task.dial_string .. "api_hangup_hook='lua app/fax/resources/scripts/queue/retry.lua'," ..
|
||||
FAX_OPTIONS[mode] ..
|
||||
'}' .. task.uri
|
||||
|
||||
local originate = 'originate ' .. dial_string .. ' &lua(fax_queue/exec.lua)'
|
||||
local originate = 'originate ' .. dial_string .. ' &lua(app/fax/resources/scripts/queue/exec.lua)'
|
||||
|
||||
log.notice(originate)
|
||||
esl = assert(Esl.new())
|
||||
local ok, err = esl:api(originate)
|
||||
log.notice(ok or err)
|
||||
local ok, status, info = esl:api(originate)
|
||||
if not ok then
|
||||
Tasks.wait_task(task, false, info)
|
||||
if task.status ~= 0 then
|
||||
Tasks.remove_task(task)
|
||||
end
|
||||
log.noticef('Can not originate to `%s` cause: %s: %s ', task.uri, tostring(status), tostring(info))
|
||||
else
|
||||
log.noticef("originate successfuly: %s", tostring(info))
|
||||
end
|
||||
end)
|
||||
|
||||
if esl then esl:close() end
|
||||
@@ -7,10 +7,10 @@
|
||||
local log = require "resources.functions.log".fax_retry
|
||||
local Database = require "resources.functions.database"
|
||||
local Settings = require "resources.functions.lazy_settings"
|
||||
local Tasks = require "fax_queue.tasks"
|
||||
local Tasks = require "app.fax.resources.scripts.queue.tasks"
|
||||
|
||||
local fax_task_uuid = env:getHeader('fax_task_uuid')
|
||||
local task = Tasks.select_task(fax_task_uuid)
|
||||
local task = Tasks.select_task(fax_task_uuid)
|
||||
if not task then
|
||||
log.warningf("Can not find fax task: %q", tostring(fax_task_uuid))
|
||||
return
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
-- Channel/FusionPBX variables
|
||||
local uuid = env:getHeader("uuid")
|
||||
local fax_queue_task_session = env:getHeader('fax_queue_task_session')
|
||||
local domain_uuid = env:getHeader("domain_uuid") or task.domain_uuid
|
||||
local domain_name = env:getHeader("domain_name") or task.domain_name
|
||||
local origination_caller_id_name = env:getHeader("origination_caller_id_name") or '000000000000000'
|
||||
@@ -76,6 +77,7 @@
|
||||
|
||||
log.noticef([[<<< CALL RESULT >>>
|
||||
uuid: = '%s'
|
||||
task_session_uuid: = '%s'
|
||||
answered: = '%s'
|
||||
fax_file: = '%s'
|
||||
wav_file: = '%s'
|
||||
@@ -90,6 +92,7 @@
|
||||
fax_options = '%s'
|
||||
]],
|
||||
tostring(uuid) ,
|
||||
tostring(fax_queue_task_session) ,
|
||||
tostring(answered) ,
|
||||
tostring(fax_file) ,
|
||||
tostring(wav_file) ,
|
||||
@@ -338,9 +341,15 @@
|
||||
end
|
||||
end
|
||||
|
||||
Tasks.wait_task(task, answered, hangup_cause_q850)
|
||||
if task.status ~= 0 then
|
||||
Tasks.remove_task(task)
|
||||
-- if task use group call then retry.lua will be called multiple times
|
||||
-- here we check eathre that channel which execute `exec.lua`
|
||||
-- Note that if there no one execute `exec.lua` we do not need call this
|
||||
-- becase it should deal in `next.lua`
|
||||
if fax_queue_task_session == uuid then
|
||||
Tasks.wait_task(task, answered, hangup_cause_q850)
|
||||
if task.status ~= 0 then
|
||||
Tasks.remove_task(task)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -103,6 +103,14 @@ local remove_finished_tasks_sql = [[
|
||||
delete from v_fax_tasks where task_status > 3
|
||||
]]
|
||||
|
||||
local function serialize(task, header)
|
||||
local str = header or ''
|
||||
for k, v in pairs(task) do
|
||||
str = str .. ('\n %q = %q'):format(tostring(k), tostring(v))
|
||||
end
|
||||
return str
|
||||
end
|
||||
|
||||
local function get_db()
|
||||
if not db then
|
||||
db = assert(Database.new('system'))
|
||||
@@ -23,6 +23,12 @@
|
||||
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
-- POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
local send_mail = require 'resources.functions.send_mail'
|
||||
|
||||
local function T(str)
|
||||
return text[str][default_language..'-'..default_dialect] or text[str]['en-us']
|
||||
end
|
||||
|
||||
--define a function to send email
|
||||
function send_email(id, uuid)
|
||||
--get voicemail message details
|
||||
@@ -103,10 +109,12 @@
|
||||
end
|
||||
|
||||
--prepare the headers
|
||||
headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",';
|
||||
headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",';
|
||||
headers = headers..'"X-FusionPBX-Call-UUID":"'..uuid..'",';
|
||||
headers = headers..'"X-FusionPBX-Email-Type":"voicemail"}';
|
||||
local headers = {
|
||||
["X-FusionPBX-Domain-UUID"] = domain_uuid;
|
||||
["X-FusionPBX-Domain-Name"] = domain_name;
|
||||
["X-FusionPBX-Call-UUID"] = uuid;
|
||||
["X-FusionPBX-Email-Type"] = 'voicemail';
|
||||
}
|
||||
|
||||
--prepare the subject
|
||||
local f = io.open(file_subject, "r");
|
||||
@@ -134,11 +142,11 @@
|
||||
body = body:gsub("${sip_to_user}", id);
|
||||
body = body:gsub("${dialed_user}", id);
|
||||
if (voicemail_file == "attach") then
|
||||
body = body:gsub("${message}", text['label-attached'][default_language.."-"..default_dialect]);
|
||||
body = body:gsub("${message}", T'label-attached');
|
||||
elseif (voicemail_file == "link") then
|
||||
body = body:gsub("${message}", "<a href='https://"..domain_name.."/app/voicemails/voicemail_messages.php?action=download&type=vm&t=bin&id="..id.."&voicemail_uuid="..db_voicemail_uuid.."&uuid="..uuid.."&src=email'>"..text['label-download'][default_language.."-"..default_dialect].."</a>");
|
||||
body = body:gsub("${message}", "<a href='https://"..domain_name.."/app/voicemails/voicemail_messages.php?action=download&type=vm&t=bin&id="..id.."&voicemail_uuid="..db_voicemail_uuid.."&uuid="..uuid.."&src=email'>"..T'label-download'.."</a>");
|
||||
else
|
||||
body = body:gsub("${message}", "<a href='https://"..domain_name.."/app/voicemails/voicemail_messages.php?action=autoplay&id="..db_voicemail_uuid.."&uuid="..uuid.."'>"..text['label-listen'][default_language.."-"..default_dialect].."</a>");
|
||||
body = body:gsub("${message}", "<a href='https://"..domain_name.."/app/voicemails/voicemail_messages.php?action=autoplay&id="..db_voicemail_uuid.."&uuid="..uuid.."'>"..T'label-listen'.."</a>");
|
||||
end
|
||||
body = body:gsub(" ", " ");
|
||||
body = body:gsub("%s+", "");
|
||||
@@ -147,22 +155,15 @@
|
||||
body = body:gsub("\n", "");
|
||||
body = trim(body);
|
||||
|
||||
--send the email
|
||||
--prepare file
|
||||
file = voicemail_dir.."/"..id.."/msg_"..uuid.."."..vm_message_ext;
|
||||
if (voicemail_file == "attach") then
|
||||
freeswitch.email("",
|
||||
"",
|
||||
"To: "..voicemail_mail_to.."\nFrom: "..voicemail_mail_to.."\nX-Headers: "..headers.."\nSubject: "..subject,
|
||||
body,
|
||||
file
|
||||
);
|
||||
else
|
||||
freeswitch.email("",
|
||||
"",
|
||||
"To: "..voicemail_mail_to.."\nFrom: "..voicemail_mail_to.."\nX-Headers: "..headers.."\nSubject: "..subject,
|
||||
body
|
||||
);
|
||||
end
|
||||
|
||||
--send the email
|
||||
send_mail(headers,
|
||||
voicemail_mail_to,
|
||||
{subject, body},
|
||||
(voicemail_file == "attach") and file
|
||||
);
|
||||
end
|
||||
|
||||
--whether to keep the voicemail message and details local after email
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
-- xml_handler.lua
|
||||
-- Part of FusionPBX
|
||||
-- Copyright (C) 2015 Mark J Crane <markjcrane@fusionpbx.com>
|
||||
-- All rights reserved.
|
||||
--
|
||||
-- Redistribution and use in source and binary forms, with or without
|
||||
-- modification, are permitted provided that the following conditions are met:
|
||||
--
|
||||
-- 1. Redistributions of source code must retain the above copyright notice,
|
||||
-- this list of conditions and the following disclaimer.
|
||||
--
|
||||
-- 2. Redistributions in binary form must reproduce the above copyright
|
||||
-- notice, this list of conditions and the following disclaimer in the
|
||||
-- documentation and/or other materials provided with the distribution.
|
||||
--
|
||||
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
-- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
-- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
-- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
-- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
-- POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
--get the cache
|
||||
hostname = trim(api:execute("switchname", ""));
|
||||
if (trim(api:execute("module_exists", "mod_memcache")) == "true") then
|
||||
XML_STRING = trim(api:execute("memcache", "get configuration:ivr.conf:" .. hostname));
|
||||
else
|
||||
XML_STRING = "-ERR NOT FOUND";
|
||||
end
|
||||
|
||||
--set the cache
|
||||
if (XML_STRING == "-ERR NOT FOUND") or (XML_STRING == "-ERR CONNECTION FAILURE") then
|
||||
|
||||
--connect to the database
|
||||
require "resources.functions.database_handle";
|
||||
dbh = database_handle('system');
|
||||
|
||||
--exits the script if we didn't connect properly
|
||||
assert(dbh:connected());
|
||||
|
||||
--get the ivr menu from the database
|
||||
sql = [[SELECT * FROM v_ivr_menus
|
||||
WHERE ivr_menu_uuid = ']] .. ivr_menu_uuid ..[['
|
||||
AND ivr_menu_enabled = 'true' ]];
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[ivr_menu] SQL: " .. sql .. "\n");
|
||||
end
|
||||
status = dbh:query(sql, function(row)
|
||||
domain_uuid = row["domain_uuid"];
|
||||
ivr_menu_name = row["ivr_menu_name"];
|
||||
--ivr_menu_extension = row["ivr_menu_extension"];
|
||||
ivr_menu_greet_long = row["ivr_menu_greet_long"];
|
||||
ivr_menu_greet_short = row["ivr_menu_greet_short"];
|
||||
ivr_menu_invalid_sound = row["ivr_menu_invalid_sound"];
|
||||
ivr_menu_exit_sound = row["ivr_menu_exit_sound"];
|
||||
ivr_menu_confirm_macro = row["ivr_menu_confirm_macro"];
|
||||
ivr_menu_confirm_key = row["ivr_menu_confirm_key"];
|
||||
ivr_menu_tts_engine = row["ivr_menu_tts_engine"];
|
||||
ivr_menu_tts_voice = row["ivr_menu_tts_voice"];
|
||||
ivr_menu_confirm_attempts = row["ivr_menu_confirm_attempts"];
|
||||
ivr_menu_timeout = row["ivr_menu_timeout"];
|
||||
--ivr_menu_exit_app = row["ivr_menu_exit_app"];
|
||||
--ivr_menu_exit_data = row["ivr_menu_exit_data"];
|
||||
ivr_menu_inter_digit_timeout = row["ivr_menu_inter_digit_timeout"];
|
||||
ivr_menu_max_failures = row["ivr_menu_max_failures"];
|
||||
ivr_menu_max_timeouts = row["ivr_menu_max_timeouts"];
|
||||
ivr_menu_digit_len = row["ivr_menu_digit_len"];
|
||||
|
||||
ivr_menu_direct_dial = row["ivr_menu_direct_dial"];
|
||||
ivr_menu_ringback = row["ivr_menu_ringback"];
|
||||
ivr_menu_cid_prefix = row["ivr_menu_cid_prefix"];
|
||||
ivr_menu_description = row["ivr_menu_description"];
|
||||
end);
|
||||
|
||||
--recording path
|
||||
|
||||
|
||||
--start the xml array
|
||||
local xml = {}
|
||||
table.insert(xml, [[<?xml version="1.0" encoding="UTF-8" standalone="no"?>]]);
|
||||
table.insert(xml, [[<document type="freeswitch/xml">]]);
|
||||
table.insert(xml, [[ <section name="configuration">]]);
|
||||
table.insert(xml, [[ <configuration name="ivr.conf" description="IVR Menus">]]);
|
||||
|
||||
table.insert(xml, [[ <menus>]]);
|
||||
dbh:query(sql, function(row)
|
||||
|
||||
--build the xml
|
||||
table.insert(xml, [[ <menu name="]]..ivr_menu_uuid..[[" description="]]..ivr_menu_name..[[" ]]);
|
||||
table.insert(xml, [[ greet-long="]]..ivr_menu_greet_long..[[" ]]);
|
||||
table.insert(xml, [[ greet-short="]]..ivr_menu_greet_short..[[" ]]);
|
||||
table.insert(xml, [[ invalid-sound="]]..ivr_menu_invalid_sound..[[" ]]);
|
||||
table.insert(xml, [[ exit-sound="]]..ivr_menu_exit_sound..[[" ]]);
|
||||
table.insert(xml, [[ confirm-macro="]]..ivr_menu_confirm_macro..[[" ]]);
|
||||
table.insert(xml, [[ confirm-key="]]..ivr_menu_confirm_key..[[" ]]);
|
||||
table.insert(xml, [[ tts-engine="]]..ivr_menu_tts_engine..[[" ]]);
|
||||
table.insert(xml, [[ tts-voice="]]..ivr_menu_tts_voice..[[" ]]);
|
||||
table.insert(xml, [[ confirm-attempts="]]..ivr_menu_confirm_attempts..[[" ]]);
|
||||
table.insert(xml, [[ timeout="]]..ivr_menu_timeout..[[" ]]);
|
||||
table.insert(xml, [[ inter-digit-timeout="]]..ivr_menu_inter_digit_timeout..[[" ]]);
|
||||
table.insert(xml, [[ max-failures="]]..ivr_menu_max_failures..[[" ]]);
|
||||
table.insert(xml, [[ max-timeouts="]]..ivr_menu_max_timeouts..[[" ]]);
|
||||
table.insert(xml, [[ digit-len="]]..ivr_menu_digit_len..[[" ]]);
|
||||
table.insert(xml, [[ />]]);
|
||||
|
||||
--get the ivr menu options
|
||||
sql = [[SELECT * FROM v_ivr_menu_options WHERE ivr_menu_uuid = ']] .. ivr_menu_uuid ..[[' ORDER BY ivr_menu_option_order asc ]];
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[ivr_menu] SQL: " .. sql .. "\n");
|
||||
end
|
||||
status = dbh:query(sql, function(r)
|
||||
dbh:query(sql, function(r)
|
||||
ivr_menu_option_digits = r.ivr_menu_option_digits
|
||||
ivr_menu_option_action = r.ivr_menu_option_action
|
||||
ivr_menu_option_param = r.ivr_menu_option_param
|
||||
ivr_menu_option_description = row.ivr_menu_option_description
|
||||
table.insert(xml, [[<entry action="]]..ivr_menu_option_action..[[" digits="]]..ivr_menu_option_digits..[[" param="]]..ivr_menu_option_param..[["/><!--]]..ivr_menu_option_description..[[-->]]);
|
||||
end)
|
||||
|
||||
--direct dial
|
||||
if (ivr_menu_direct_dial == "true") then
|
||||
table.insert(xml, [[<entry action="menu-exec-app" digits="/(^(\d{2,5}))$/" param="transfer $1 XML features"/>\n");
|
||||
end
|
||||
end)
|
||||
table.insert(xml, [[ </menus>]]);
|
||||
|
||||
--close the extension tag if it was left open
|
||||
table.insert(xml, [[ </configuration>]]);
|
||||
table.insert(xml, [[ </section>]]);
|
||||
table.insert(xml, [[</document>]]);
|
||||
XML_STRING = table.concat(xml, "\n");
|
||||
if (debug["xml_string"]) then
|
||||
freeswitch.consoleLog("notice", "[xml_handler] XML_STRING: " .. XML_STRING .. "\n");
|
||||
end
|
||||
|
||||
--close the database connection
|
||||
dbh:release();
|
||||
--freeswitch.consoleLog("notice", "[xml_handler]"..api:execute("eval ${dsn}"));
|
||||
|
||||
--set the cache
|
||||
result = trim(api:execute("memcache", "set configuration:ivr.conf:" .. hostname .." '"..XML_STRING:gsub("'", "'").."' ".."expire['ivr.conf']"));
|
||||
|
||||
--send the xml to the console
|
||||
if (debug["xml_string"]) then
|
||||
local file = assert(io.open(temp_dir .. "/ivr.conf.xml", "w"));
|
||||
file:write(XML_STRING);
|
||||
file:close();
|
||||
end
|
||||
|
||||
--send to the console
|
||||
if (debug["cache"]) then
|
||||
freeswitch.consoleLog("notice", "[xml_handler] configuration:ivr.conf:" .. hostname .." source: database\n");
|
||||
end
|
||||
else
|
||||
--replace the ' back to a single quote
|
||||
XML_STRING = XML_STRING:gsub("'", "'");
|
||||
--send to the console
|
||||
if (debug["cache"]) then
|
||||
freeswitch.consoleLog("notice", "[xml_handler] configuration:ivr.conf source: memcache\n");
|
||||
end
|
||||
end --if XML_STRING
|
||||
@@ -9,7 +9,7 @@
|
||||
require "resources.functions.sleep";
|
||||
|
||||
local log = require "resources.functions.log".fax_queue_monitor
|
||||
local Next = require "fax_queue.next"
|
||||
local Next = require "app.fax.resources.scripts.queue.next"
|
||||
|
||||
mkdir(scripts_dir .. "/run");
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
require "fax_queue.next".poll_once()
|
||||
require "app.fax.resources.scripts.queue.next".poll_once()
|
||||
@@ -117,7 +117,11 @@ function EventSocket:api(cmd)
|
||||
local event, err = self:_request('api ' .. cmd)
|
||||
if not event then return nil, err end
|
||||
local body = event:getBody()
|
||||
if body then return body end
|
||||
if body then
|
||||
local ok, status, msg = split_status(body)
|
||||
if ok == nil then return body end
|
||||
return ok, status, msg
|
||||
end
|
||||
return event:getReply()
|
||||
end
|
||||
|
||||
@@ -134,6 +138,13 @@ if freeswitch then
|
||||
|
||||
local api
|
||||
|
||||
-- [+-][OK|ERR|USAGE|...][Message]
|
||||
local function split_status(str)
|
||||
local ok, status, msg = string.match(str, "^%s*([-+])([^%s]+)%s*(.-)%s*$")
|
||||
if not ok then return nil, str end
|
||||
return ok == '+', status, msg
|
||||
end
|
||||
|
||||
function EventSocket:__init()
|
||||
self._api = api or freeswitch.API()
|
||||
api = self._api
|
||||
@@ -142,10 +153,9 @@ end
|
||||
|
||||
function EventSocket:api(cmd)
|
||||
local result = self._api:executeString(cmd)
|
||||
if result and result:sub(1, 4) == '-ERR' then
|
||||
return nil, result:sub(5)
|
||||
end
|
||||
return result
|
||||
local ok, status, msg = split_status(result)
|
||||
if ok == nil then return result end
|
||||
return ok, status, msg
|
||||
end
|
||||
|
||||
function EventSocket:close()
|
||||
|
||||
107
resources/install/scripts/resources/functions/send_mail.lua
Normal file
107
resources/install/scripts/resources/functions/send_mail.lua
Normal file
@@ -0,0 +1,107 @@
|
||||
|
||||
local send_mail
|
||||
|
||||
if not freeswitch then
|
||||
local Settings = require "resources.functions.lazy_settings"
|
||||
local Database = require "resources.functions.database"
|
||||
local log = require "resources.functions.log".sendmail
|
||||
local sendmail = require "sendmail"
|
||||
local uuid = require "uuid"
|
||||
|
||||
function send_mail(headers, address, message, file)
|
||||
local domain_uuid = headers["X-FusionPBX-Domain-UUID"]
|
||||
local domain_name = headers["X-FusionPBX-Domain-Name"]
|
||||
local email_type = headers["X-FusionPBX-Email-Type"] or 'info'
|
||||
local call_uuid = headers["X-FusionPBX-Email-Type"]
|
||||
local db = dbh or Database.new('system')
|
||||
local settings = Settings.new(db, domain_name, domain_uuid)
|
||||
|
||||
local ssl = settings:get('email', 'smtp_secure', 'var');
|
||||
|
||||
local ok, err = sendmail{
|
||||
server = {
|
||||
address = settings:get('email','smtp_host','var');
|
||||
user = settings:get('email','smtp_username','var');
|
||||
password = settings:get('email','smtp_password','var');
|
||||
ssl = (ssl == 'true') and { verify = {"none"} };
|
||||
},
|
||||
|
||||
from = {
|
||||
title = settings:get('email', 'smtp_from_name', 'var');
|
||||
address = settings:get('email', 'smtp_from', 'var');
|
||||
},
|
||||
|
||||
to = {
|
||||
address = address;
|
||||
},
|
||||
|
||||
message = message;
|
||||
file = file;
|
||||
}
|
||||
|
||||
if not ok then
|
||||
log.warningf("Mailer Error: %s", err)
|
||||
|
||||
local email_uuid = uuid.new()
|
||||
local sql = "insert into v_emails ( "
|
||||
sql = sql .. "email_uuid, "
|
||||
if call_uuid then sql = sql .. "call_uuid, " end
|
||||
sql = sql .. "domain_uuid, "
|
||||
sql = sql .. "sent_date, "
|
||||
sql = sql .. "type, "
|
||||
sql = sql .. "status, "
|
||||
sql = sql .. "email "
|
||||
sql = sql .. ") values ( "
|
||||
sql = sql .. "'" .. email_uuid .. "', "
|
||||
if call_uuid then sql = sql .. "'" .. call_uuid .. "', " end
|
||||
sql = sql .. "'" .. domain_uuid .. "', "
|
||||
sql = sql .. "now(),"
|
||||
sql = sql .. "'" .. email_type .. "', "
|
||||
sql = sql .. "'failed', "
|
||||
sql = sql .. "'' "
|
||||
sql = sql .. ") "
|
||||
|
||||
db:query(sql)
|
||||
|
||||
log.infof("Retained in v_emails as email_uuid = %s", email_uuid)
|
||||
else
|
||||
log.infof("Mail to %s sent!", address)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if freeswitch then
|
||||
function send_mail(headers, address, message, file)
|
||||
local xheaders = "{"
|
||||
for k,v in pairs(headers) do
|
||||
xheaders = xheaders .. ('"%s":"%s",'):format(k, v)
|
||||
end
|
||||
xheaders = xheaders:sub(1,-2) .. '}'
|
||||
|
||||
local subject = message[1]
|
||||
local body = message[2] or ''
|
||||
|
||||
local mail_headers =
|
||||
"To: " .. address .. "\n" ..
|
||||
"From: " .. address .. "\n" ..
|
||||
"Subject: " .. subject .. "\n" ..
|
||||
"X-Headers: " .. xheaders
|
||||
|
||||
if file then
|
||||
freeswitch.email(address, address, mail_headers, body, file)
|
||||
else
|
||||
freeswitch.email(address, address, mail_headers, body, file)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return send_mail
|
||||
|
||||
-- local headers = {
|
||||
-- ["X-FusionPBX-Domain-UUID"] = '2d171c4c-b237-49ca-9d76-9cffc1618fa7';
|
||||
-- ["X-FusionPBX-Domain-Name"] = 'domain.com';
|
||||
-- ["X-FusionPBX-Email-Type"] = 'voicemail';
|
||||
-- }
|
||||
-- send_mail(headers, 'alexey@domain.com', {'hello', 'world'})
|
||||
|
||||
|
||||
@@ -1267,10 +1267,24 @@ if (!function_exists('switch_conf_xml')) {
|
||||
|
||||
//prepare the php variables
|
||||
if (stristr(PHP_OS, 'WIN')) {
|
||||
$bindir = getenv(PHPRC);
|
||||
$v_mailer_app ='""'. $bindir."/php". '" -f '.$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/secure/v_mailto.php -- "';
|
||||
$v_mailer_app = sprintf("'%s'", $v_mailer_app);
|
||||
$bindir = find_php_by_extension();
|
||||
if(!$bindir)
|
||||
$bindir = getenv(PHPRC);
|
||||
|
||||
$secure_path = path_join($_SERVER["DOCUMENT_ROOT"], PROJECT_PATH, 'secure');
|
||||
|
||||
$v_mail_bat = path_join($secure_path, 'mailto.bat');
|
||||
$v_mail_cmd = '@' .
|
||||
'"' . str_replace('/', '\\', path_join($bindir, 'php.exe')) . '" ' .
|
||||
'"' . str_replace('/', '\\', path_join($secure_path, 'v_mailto.php')) . '" ';
|
||||
|
||||
$fout = fopen($v_mail_bat, "w+");
|
||||
fwrite($fout, $v_mail_cmd);
|
||||
fclose($fout);
|
||||
|
||||
$v_mailer_app = '"' . str_replace('/', '\\', $v_mail_bat) . '"';
|
||||
$v_mailer_app_args = "";
|
||||
unset($v_mail_bat, $v_mail_cmd, $secure_path, $bindir, $fout);
|
||||
}
|
||||
else {
|
||||
if (file_exists(PHP_BINDIR.'/php')) { define("PHP_BIN", "php"); }
|
||||
@@ -1453,4 +1467,50 @@ if (!function_exists('save_switch_xml')) {
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('path_join')) {
|
||||
function path_join() {
|
||||
$args = func_get_args();
|
||||
$paths = array();
|
||||
foreach ($args as $arg) {
|
||||
$paths = array_merge($paths, (array)$arg);
|
||||
}
|
||||
|
||||
$prefix = null;
|
||||
foreach($paths as &$path) {
|
||||
if($prefix === null && strlen($path) > 0) {
|
||||
if(substr($path, 0, 1) == '/') $prefix = '/';
|
||||
else $prefix = '';
|
||||
}
|
||||
$path = trim( $path, '/' );
|
||||
}
|
||||
|
||||
if($prefix === null){
|
||||
return '';
|
||||
}
|
||||
|
||||
$paths = array_filter($paths);
|
||||
|
||||
return $prefix . join('/', $paths);
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('find_php_by_extension')) {
|
||||
/*Tesetd on WAMP and OpenServer*/
|
||||
function find_php_by_extension(){
|
||||
$bin_dir = get_cfg_var('extension_dir');
|
||||
|
||||
while($bin_dir){
|
||||
$bin_dir = dirname($bin_dir);
|
||||
$php_bin = path_join($bin_dir, 'php.exe');
|
||||
if(file_exists($php_bin))
|
||||
break;
|
||||
}
|
||||
|
||||
if(!$bin_dir)
|
||||
return false;
|
||||
|
||||
return $bin_dir;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
# Image Version
|
||||
image_version: "P0S3-08-7-00"
|
||||
|
||||
# Proxy Server
|
||||
proxy1_address: "192.168.1.1"
|
||||
|
||||
# Proxy Server Port (default - 5060)
|
||||
proxy1_port:"5060"
|
||||
|
||||
# Emergency Proxy info
|
||||
proxy_emergency: "192.168.1.1"
|
||||
proxy_emergency_port: "5060"
|
||||
|
||||
# Backup Proxy info
|
||||
proxy_backup: "192.168.1.1"
|
||||
proxy_backup_port: "5060"
|
||||
|
||||
# Outbound Proxy info
|
||||
outbound_proxy: ""
|
||||
outbound_proxy_port: "5060"
|
||||
|
||||
# NAT/Firewall Traversal
|
||||
nat_enable: "0"
|
||||
nat_address: ""
|
||||
voip_control_port: "5060"
|
||||
start_media_port: "16384"
|
||||
end_media_port: "32766"
|
||||
nat_received_processing: "0"
|
||||
|
||||
# Proxy Registration (0-disable (default), 1-enable)
|
||||
proxy_register: "1"
|
||||
|
||||
# Phone Registration Expiration [1-3932100 sec] (Default - 3600)
|
||||
timer_register_expires: "80"
|
||||
|
||||
# Codec for media stream (g711ulaw (default), g711alaw, g729)
|
||||
preferred_codec: "none"
|
||||
|
||||
# TOS bits in media stream [0-5] (Default - 5)
|
||||
tos_media: "5"
|
||||
|
||||
# Enable VAD (0-disable (default), 1-enable)
|
||||
enable_vad: "0"
|
||||
|
||||
# Allow for the bridge on a 3way call to join remaining parties upon hangup
|
||||
cnf_join_enable: "1" ; 0-Disabled, 1-Enabled (default)
|
||||
|
||||
# Allow Transfer to be completed while target phone is still ringing
|
||||
semi_attended_transfer: "0" ; 0-Disabled, 1-Enabled (default)
|
||||
|
||||
# Telnet Level (enable or disable the ability to telnet into this phone
|
||||
telnet_level: "2" ; 0-Disabled (default), 1-Enabled, 2-Privileged
|
||||
|
||||
# Inband DTMF Settings (0-disable, 1-enable (default))
|
||||
dtmf_inband: "1"
|
||||
|
||||
# Out of band DTMF Settings (none-disable, avt-avt enable (default), avt_always - always avt )
|
||||
dtmf_outofband: "avt"
|
||||
|
||||
# DTMF dB Level Settings (1-6dB down, 2-3db down, 3-nominal (default), 4-3db up, 5-6dB up)
|
||||
dtmf_db_level: "3"
|
||||
|
||||
# SIP Timers
|
||||
timer_t1: "500" ; Default 500 msec
|
||||
timer_t2: "4000" ; Default 4 sec
|
||||
sip_retx: "10" ; Default 11
|
||||
sip_invite_retx: "6" ; Default 7
|
||||
timer_invite_expires: "180" ; Default 180 sec
|
||||
|
||||
# Setting for Message speeddial to UOne box
|
||||
messages_uri: "*97"
|
||||
|
||||
# TFTP Phone Specific Configuration File Directory
|
||||
tftp_cfg_dir: ""
|
||||
|
||||
# Time Server
|
||||
sntp_mode: "unicast"
|
||||
sntp_server: "192.168.1.1"
|
||||
time_zone: "EST"
|
||||
dst_offset: "1"
|
||||
dst_start_month: "Mar"
|
||||
dst_start_day: ""
|
||||
dst_start_day_of_week: "Sun"
|
||||
dst_start_week_of_month: "2"
|
||||
dst_start_time: "02"
|
||||
dst_stop_month: "Nov"
|
||||
dst_stop_day: ""
|
||||
dst_stop_day_of_week: "Sunday"
|
||||
dst_stop_week_of_month: "1"
|
||||
dst_stop_time: "2"
|
||||
dst_auto_adjust: "1"
|
||||
|
||||
# Do Not Disturb Control (0-off, 1-on, 2-off with no user control, 3-on with no user control)
|
||||
dnd_control: "2" ; Default 0 (Do Not Disturb feature is off)
|
||||
|
||||
# Caller ID Blocking (0-disabled, 1-enabled, 2-disabled no user control, 3-enabled no user control)
|
||||
callerid_blocking: "0" ; Default 0 (Disable sending all calls as anonymous)
|
||||
|
||||
# Anonymous Call Blocking (0-disbaled, 1-enabled, 2-disabled no user control, 3-enabled no user control)
|
||||
anonymous_call_block: "0" ; Default 0 (Disable blocking of anonymous calls)
|
||||
|
||||
# Call Waiting (0-disabled, 1-enabled, 2-disabled with no user control, 3-enabled with no user control)
|
||||
call_waiting: "1" ; Default 1 (Call Waiting enabled)
|
||||
|
||||
# DTMF AVT Payload (Dynamic payload range for AVT tones - 96-127)
|
||||
dtmf_avt_payload: "101" ; Default 100
|
||||
|
||||
# XML file that specifies the dialplan desired
|
||||
dial_template: "dialplan"
|
||||
|
||||
# Network Media Type (auto, full100, full10, half100, half10)
|
||||
network_media_type: "auto"
|
||||
|
||||
#Autocompletion During Dial (0-off, 1-on [default])
|
||||
autocomplete: "1"
|
||||
|
||||
#Time Format (0-12hr, 1-24hr [default])
|
||||
time_format_24hr: "0"
|
||||
|
||||
# URL for external Phone Services
|
||||
#services_url: "http://{$domain_name}/app/provision/?file=services.php"
|
||||
|
||||
# URL for external Directory location
|
||||
directory_url: "http://{$domain_name}/app/provision/?file=directory.php"
|
||||
|
||||
# URL for branding logo
|
||||
#logo_url: "http://{$domain_name}/app/provision/logo.bmp"
|
||||
|
||||
# Remote Party ID
|
||||
remote_party_id: 1 ; 0-Disabled (default), 1-Enabled
|
||||
|
||||
|
||||
@@ -1,19 +1,150 @@
|
||||
phone_label: "{$display_name_1}"
|
||||
proxy1_address: "{$server_address_1}"
|
||||
{if isset($cisco_time_zone)}
|
||||
# Image version
|
||||
image_version: "{$cisco_image_version}"
|
||||
{/if}
|
||||
|
||||
# Phone settings
|
||||
phone_label: "{$label}"
|
||||
proxy_register: 1
|
||||
timer_register_expires: 300
|
||||
preferred_codec: g711ulaw
|
||||
enable_vad: 0
|
||||
dial_template: "dialplan"
|
||||
|
||||
line1_name: "{$user_id_1}"
|
||||
line1_displayname: "{$user_id_1}"
|
||||
line1_shortname: "{$short_name_1}"
|
||||
line1_authname: "{$auth_id_1}"
|
||||
line1_password: "{$user_password_1}"
|
||||
{foreach $lines as $row}reg.{$row.line_number}.displayName="{$row.display_name}"
|
||||
#registration information
|
||||
proxy{$row.line_number}_address: "{$row.server_address}"
|
||||
proxy{$row.line_number}_port:"{$row.sip_port}"
|
||||
line{$row.line_number}_name: "{$row.user_id}"
|
||||
line{$row.line_number}_displayname: "{$row.user_id}"
|
||||
line{$row.line_number}_shortname: "{$row.display_name}"
|
||||
line{$row.line_number}_authname: "{$row.auth_id}"
|
||||
line{$row.line_number}_password: "{$row.password}"
|
||||
|
||||
line2_name: "{$user_id_2}"
|
||||
line2_displayname: "{$user_id_2}"
|
||||
line2_shortname: "{$short_name_2}"
|
||||
line2_authname: "{$auth_id_2}"
|
||||
line2_password: "{$user_password_2}"
|
||||
{/foreach}
|
||||
# Emergency Proxy info
|
||||
proxy_emergency: "{$proxy_emergency}"
|
||||
proxy_emergency_port: "{$proxy_emergency_port}"
|
||||
|
||||
# Backup Proxy info
|
||||
proxy_backup: "{$proxy_backup}"
|
||||
proxy_backup_port: "{$proxy_backup_port}"
|
||||
|
||||
# Outbound Proxy info
|
||||
outbound_proxy: "{$outbound_proxy}"
|
||||
outbound_proxy_port: "{$outbound_proxy_port}"
|
||||
|
||||
# NAT/Firewall Traversal
|
||||
voip_control_port: "5060"
|
||||
start_media_port: "16384"
|
||||
end_media_port: "32768"
|
||||
nat_received_processing: "0"
|
||||
nat_enable: "{if isset($nat_enable)}{$nat_enable}{else}1{/if}"
|
||||
nat_address: "{$nat_nat_address}"
|
||||
|
||||
# Sync value of the phone used for remote reset
|
||||
sync: 1 ; Default 1
|
||||
|
||||
# Proxy Registration (0-disable (default), 1-enable)
|
||||
proxy_register: "1"
|
||||
|
||||
# Phone Registration Expiration [1-3932100 sec] (Default - 3600)
|
||||
timer_register_expires: "80"
|
||||
|
||||
# Codec for media stream (g711ulaw (default), g711alaw, g729)
|
||||
preferred_codec: "none"
|
||||
|
||||
# TOS bits in media stream [0-5] (Default - 5)
|
||||
tos_media: "5"
|
||||
|
||||
# Enable VAD (0-disable (default), 1-enable)
|
||||
enable_vad: "0"
|
||||
|
||||
# Allow for the bridge on a 3way call to join remaining parties upon hangup
|
||||
cnf_join_enable: "1" ; 0-Disabled, 1-Enabled (default)
|
||||
|
||||
# Allow Transfer to be completed while target phone is still ringing
|
||||
semi_attended_transfer: "0" ; 0-Disabled, 1-Enabled (default)
|
||||
|
||||
# Telnet Level (enable or disable the ability to telnet into this phone
|
||||
telnet_level: "2" ; 0-Disabled (default), 1-Enabled, 2-Privileged
|
||||
|
||||
# Inband DTMF Settings (0-disable, 1-enable (default))
|
||||
dtmf_inband: "1"
|
||||
|
||||
# Out of band DTMF Settings (none-disable, avt-avt enable (default), avt_always - always avt )
|
||||
dtmf_outofband: "avt"
|
||||
|
||||
# DTMF dB Level Settings (1-6dB down, 2-3db down, 3-nominal (default), 4-3db up, 5-6dB up)
|
||||
dtmf_db_level: "3"
|
||||
|
||||
# SIP Timers
|
||||
timer_t1: "500" ; Default 500 msec
|
||||
timer_t2: "4000" ; Default 4 sec
|
||||
sip_retx: "10" ; Default 11
|
||||
sip_invite_retx: "6" ; Default 7
|
||||
timer_invite_expires: "180" ; Default 180 sec
|
||||
|
||||
# Setting for Message speeddial to UOne box
|
||||
messages_uri: "*97"
|
||||
|
||||
# TFTP Phone Specific Configuration File Directory
|
||||
tftp_cfg_dir: ""
|
||||
|
||||
# Time Server
|
||||
sntp_mode: "unicast"
|
||||
sntp_server: "{$sntp_server}"
|
||||
{if isset($cisco_time_zone)}
|
||||
time_zone: "{$cisco_time_zone}"
|
||||
{/if}
|
||||
dst_offset: "1"
|
||||
dst_start_month: "Mar"
|
||||
dst_start_day: ""
|
||||
dst_start_day_of_week: "Sun"
|
||||
dst_start_week_of_month: "2"
|
||||
dst_start_time: "02"
|
||||
dst_stop_month: "Nov"
|
||||
dst_stop_day: ""
|
||||
dst_stop_day_of_week: "Sunday"
|
||||
dst_stop_week_of_month: "1"
|
||||
dst_stop_time: "2"
|
||||
dst_auto_adjust: "1"
|
||||
|
||||
# Do Not Disturb Control (0-off, 1-on, 2-off with no user control, 3-on with no user control)
|
||||
dnd_control: "2" ; Default 0 (Do Not Disturb feature is off)
|
||||
|
||||
# Caller ID Blocking (0-disabled, 1-enabled, 2-disabled no user control, 3-enabled no user control)
|
||||
callerid_blocking: "0" ; Default 0 (Disable sending all calls as anonymous)
|
||||
|
||||
# Anonymous Call Blocking (0-disbaled, 1-enabled, 2-disabled no user control, 3-enabled no user control)
|
||||
anonymous_call_block: "0" ; Default 0 (Disable blocking of anonymous calls)
|
||||
|
||||
# Call Waiting (0-disabled, 1-enabled, 2-disabled with no user control, 3-enabled with no user control)
|
||||
call_waiting: "1" ; Default 1 (Call Waiting enabled)
|
||||
|
||||
# DTMF AVT Payload (Dynamic payload range for AVT tones - 96-127)
|
||||
dtmf_avt_payload: "101" ; Default 100
|
||||
|
||||
# XML file that specifies the dialplan desired
|
||||
dial_template: "dialplan"
|
||||
|
||||
# Network Media Type (auto, full100, full10, half100, half10)
|
||||
network_media_type: "auto"
|
||||
|
||||
#Autocompletion During Dial (0-off, 1-on [default])
|
||||
autocomplete: "1"
|
||||
|
||||
#Time Format (0-12hr, 1-24hr [default])
|
||||
time_format_24hr: "0"
|
||||
|
||||
# URL for external Phone Services
|
||||
#services_url: "http://{$domain_name}/app/provision/file/services.xml"
|
||||
|
||||
# URL for external Directory location
|
||||
directory_url: "http://{$domain_name}/app/provision/file/directory.xml"
|
||||
|
||||
# URL for branding logo
|
||||
#logo_url: "http://{$domain_name}/app/provision/logo.bmp"
|
||||
|
||||
# Remote Party ID
|
||||
remote_party_id: 1 ; 0-Disabled (default), 1-Enabled
|
||||
|
||||
@@ -1,31 +1,25 @@
|
||||
<CiscoIPPhoneMenu>
|
||||
<CiscoIPPhoneDirectory>
|
||||
<Title>Enterprise</Title>
|
||||
<Prompt>Please choose...</Prompt>
|
||||
<SoftKeyItem>
|
||||
<Name>Dial</Name>
|
||||
<URL>SoftKey:Select</URL>
|
||||
<Position>1</Position>
|
||||
</SoftKeyItem>
|
||||
{assign var=x value=1}
|
||||
{foreach $contacts as $row}
|
||||
{if $row.contact_category == "enterprise"}
|
||||
<MenuItem>
|
||||
{if $row.contact_name_given != ""}
|
||||
<Name>{$row.contact_name_given} {$row.contact_name_family}</Name>
|
||||
{else}
|
||||
<Name>{$row.contact_organization}</Name>
|
||||
{/if}
|
||||
{if $row.phone_number != ""}
|
||||
<URL>Dial:{$row.phone_number}#</URL>
|
||||
{else}
|
||||
<URL>Dial:{$row.phone_extension}#</URL>
|
||||
{/if}
|
||||
</MenuItem>
|
||||
{/if}
|
||||
{/foreach}
|
||||
<SoftKeyItem>
|
||||
<Name>Exit</Name>
|
||||
<URL>SoftKey:Exit</URL>
|
||||
<Position>4</Position>
|
||||
</SoftKeyItem>
|
||||
</CiscoIPPhoneMenu>
|
||||
{assign var=x value=1}
|
||||
{foreach $contacts as $row}{if $row.contact_category == "enterprise"}
|
||||
<DirectoryEntry>
|
||||
{if $row.contact_name_given != ""}
|
||||
<Name>{$row.contact_name_given} {$row.contact_name_family}</Name>
|
||||
{else}
|
||||
<Name>{$row.contact_organization}</Name>
|
||||
{/if}
|
||||
{if $row.phone_number != ""}
|
||||
<Telephone>{$row.phone_number}</Telephone>
|
||||
{else}
|
||||
<Telephone>{$row.phone_extension}</Telephone>
|
||||
{/if}
|
||||
</DirectoryEntry>
|
||||
{/if}
|
||||
{assign var=x value=$x+1}
|
||||
{/foreach}
|
||||
</CiscoIPPhoneDirectory>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,31 +1,24 @@
|
||||
<CiscoIPPhoneMenu>
|
||||
<CiscoIPPhoneDirectory>
|
||||
<Title>Personal</Title>
|
||||
<Prompt>Please choose...</Prompt>
|
||||
<SoftKeyItem>
|
||||
<Name>Dial</Name>
|
||||
<URL>SoftKey:Select</URL>
|
||||
<Position>1</Position>
|
||||
</SoftKeyItem>
|
||||
{assign var=x value=1}
|
||||
{foreach $contacts as $row}
|
||||
{if $row.contact_category == "personal"}
|
||||
<MenuItem>
|
||||
{if $row.contact_name_given != ""}
|
||||
<Name>{$row.contact_name_given} {$row.contact_name_family}</Name>
|
||||
{else}
|
||||
<Name>{$row.contact_organization}</Name>
|
||||
{/if}
|
||||
{if $row.phone_number != ""}
|
||||
<URL>Dial:{$row.phone_number}#</URL>
|
||||
{else}
|
||||
<URL>Dial:{$row.phone_extension}#</URL>
|
||||
{/if}
|
||||
</MenuItem>
|
||||
{/if}
|
||||
{/foreach}
|
||||
<SoftKeyItem>
|
||||
<Name>Exit</Name>
|
||||
<URL>SoftKey:Exit</URL>
|
||||
<Position>4</Position>
|
||||
</SoftKeyItem>
|
||||
</CiscoIPPhoneMenu>
|
||||
{assign var=x value=1}
|
||||
{foreach $contacts as $row}{if $row.contact_category == "personal"}
|
||||
<DirectoryEntry>
|
||||
{if $row.contact_name_given != ""}
|
||||
<Name>{$row.contact_name_given} {$row.contact_name_family}</Name>
|
||||
{else}
|
||||
<Name>{$row.contact_organization}</Name>
|
||||
{/if}
|
||||
{if $row.phone_number != ""}
|
||||
<Telephone>{$row.phone_number}</Telephone>
|
||||
{else}
|
||||
<Telephone>{$row.phone_extension}</Telephone>
|
||||
{/if}
|
||||
</DirectoryEntry>
|
||||
{/if}
|
||||
{assign var=x value=$x+1}
|
||||
{/foreach}
|
||||
</CiscoIPPhoneDirectory>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,32 +1,21 @@
|
||||
<CiscoIPPhoneMenu>
|
||||
<CiscoIPPhoneDirectory>
|
||||
<Title>Speed Dial</Title>
|
||||
<Prompt>Please choose...</Prompt>
|
||||
<SoftKeyItem>
|
||||
<Name>Dial</Name>
|
||||
<URL>SoftKey:Select</URL>
|
||||
<Position>1</Position>
|
||||
</SoftKeyItem>
|
||||
{assign var=x value=1}
|
||||
{foreach $contacts as $row}
|
||||
{if $row.contact_category == "speed dial"}
|
||||
<MenuItem>
|
||||
{if $row.contact_name_given != ""}
|
||||
<Name>{$row.contact_name_given} {$row.contact_name_family}</Name>
|
||||
{else}
|
||||
<Name>{$row.contact_organization}</Name>
|
||||
{/if}
|
||||
{if $row.phone_number != ""}
|
||||
<URL>Dial:{$row.phone_number}#</URL>
|
||||
{else}
|
||||
<URL>Dial:{$row.phone_extension}#</URL>
|
||||
{/if}
|
||||
</MenuItem>
|
||||
{/if}
|
||||
{assign var=x value=$x+1}
|
||||
{/foreach}
|
||||
<SoftKeyItem>
|
||||
<Name>Exit</Name>
|
||||
<URL>SoftKey:Exit</URL>
|
||||
<Position>4</Position>
|
||||
</SoftKeyItem>
|
||||
</CiscoIPPhoneMenu>
|
||||
{assign var=x value=1}
|
||||
{foreach $contacts as $row}{if $row.contact_category == "speed dial"}
|
||||
<DirectoryEntry>
|
||||
{if $row.contact_name_given != ""}
|
||||
<Name>{$row.contact_name_given} {$row.contact_name_family}</Name>
|
||||
{else}
|
||||
<Name>{$row.contact_organization}</Name>
|
||||
{/if}
|
||||
{if $row.phone_number != ""}
|
||||
<Telephone>{$row.phone_number}</Telephone>
|
||||
{else}
|
||||
<Telephone>{$row.phone_extension}</Telephone>
|
||||
{/if}
|
||||
</DirectoryEntry>
|
||||
{/if}
|
||||
{assign var=x value=$x+1}
|
||||
{/foreach}
|
||||
</CiscoIPPhoneDirectory>
|
||||
|
||||
@@ -1,28 +1,17 @@
|
||||
<CiscoIPPhoneMenu>
|
||||
<Title>Contacts</Title>
|
||||
<Prompt>Please choose...</Prompt>
|
||||
|
||||
<!--
|
||||
<MenuItem>
|
||||
<Name>Personal</Name>
|
||||
<URL>http://{$domain_name}/app/provision?file=directory-personal.xml&mac={$mac}</URL>
|
||||
<URL>http://{$domain_name}/app/provision/file/directory-personal.xml</URL>
|
||||
</MenuItem>
|
||||
-->
|
||||
<MenuItem>
|
||||
<Name>Enterprise</Name>
|
||||
<URL>http://{$domain_name}/app/provision?file=directory-enterprise&mac={$mac}</URL>
|
||||
--> <MenuItem> <Name>Enterprise</Name>
|
||||
<URL>http://{$domain_name}/app/provision/file/directory-enterprise.xml?mac={$mac}</URL>
|
||||
</MenuItem>
|
||||
<MenuItem>
|
||||
<Name>Speed Dial</Name>
|
||||
<URL>http://{$domain_name}/app/provision/?file=directory-speed_dial&mac={$mac}</URL>
|
||||
<URL>http://{$domain_name}/app/provision/file/directory-speed_dial.xml?mac={$mac}</URL>
|
||||
</MenuItem>
|
||||
<SoftKeyItem>
|
||||
<Name>Select</Name>
|
||||
<URL>SoftKey:Select</URL>
|
||||
<Position>1</Position>
|
||||
</SoftKeyItem>
|
||||
<SoftKeyItem>
|
||||
<Name>Exit</Name>
|
||||
<URL>SoftKey:Exit</URL>
|
||||
<Position>4</Position>
|
||||
</SoftKeyItem>
|
||||
</CiscoIPPhoneMenu>
|
||||
@@ -0,0 +1,30 @@
|
||||
<tones>
|
||||
<tone c1="31164" i1="-1772" c2="30743" i2="-1985" c3="31164" i3="-1772" c4="30743" i4="-1985" d="34" t="ringing">
|
||||
<part m="on" t="400"/>
|
||||
<part m="off" t="200"/>
|
||||
<part m="on" t="400"/>
|
||||
<part m="off" t="2000"/>
|
||||
<repeat c="65535"/>
|
||||
</tone>
|
||||
<tone c1="31164" i1="-1772" c2="31164" i2="-1772" d="17" t="reorder">
|
||||
<part m="on" t="400"/>
|
||||
<part m="off" t="350"/>
|
||||
<part m="on" t="225"/>
|
||||
<part m="off" t="525"/>
|
||||
<repeat c="65535"/>
|
||||
</tone>
|
||||
<tone c1="31164" i1="-1772" d="1" t="busy">
|
||||
<part m="on" t="375"/>
|
||||
<part m="off" t="375"/>
|
||||
<repeat c="65535"/>
|
||||
</tone>
|
||||
<tone c1="31538" i1="-1556" c2="30831" i2="-1942" d="2" t="odial">
|
||||
<part m="on" t="65535"/>
|
||||
<repeat c="65535"/>
|
||||
</tone>
|
||||
<tone c1="31538" i1="-1556" c2="30831" i2="-1942" d="2" t="idial">
|
||||
<part m="on" t="65535"/>
|
||||
<repeat c="65535"/>
|
||||
</tone>
|
||||
</tones>
|
||||
|
||||
30
resources/templates/provision/cisco/7960/RINGLIST.XML
Normal file
30
resources/templates/provision/cisco/7960/RINGLIST.XML
Normal file
@@ -0,0 +1,30 @@
|
||||
<CiscoIPPhoneRingList>
|
||||
<Ring>
|
||||
<DisplayName>Chirp 3</DisplayName>
|
||||
<FileName>ringer3.pcm</FileName>
|
||||
</Ring>
|
||||
<Ring>
|
||||
<DisplayName>Old Style</DisplayName>
|
||||
<FileName>ringer1.pcm</FileName>
|
||||
</Ring>
|
||||
<Ring>
|
||||
<DisplayName>Door Chime</DisplayName>
|
||||
<FileName>doorchime.pcm</FileName>
|
||||
</Ring>
|
||||
<Ring>
|
||||
<DisplayName>Red Alert</DisplayName>
|
||||
<FileName>redalert.pcm</FileName>
|
||||
</Ring>
|
||||
<Ring>
|
||||
<DisplayName>Terri</DisplayName>
|
||||
<FileName>terri.pcm</FileName>
|
||||
</Ring>
|
||||
<Ring>
|
||||
<DisplayName>Door Chime 2</DisplayName>
|
||||
<FileName>chime2.pcm</FileName>
|
||||
</Ring>
|
||||
<Ring>
|
||||
<DisplayName>Silence</DisplayName>
|
||||
<FileName>silence.pcm</FileName>
|
||||
</Ring>
|
||||
</CiscoIPPhoneRingList>
|
||||
@@ -1,131 +0,0 @@
|
||||
# Image Version
|
||||
image_version: "P0S3-08-7-00"
|
||||
|
||||
# Proxy Server
|
||||
proxy1_address: "192.168.1.1"
|
||||
|
||||
# Proxy Server Port (default - 5060)
|
||||
proxy1_port:"5060"
|
||||
|
||||
# Emergency Proxy info
|
||||
proxy_emergency: "192.168.1.1"
|
||||
proxy_emergency_port: "5060"
|
||||
|
||||
# Backup Proxy info
|
||||
proxy_backup: "192.168.1.1"
|
||||
proxy_backup_port: "5060"
|
||||
|
||||
# Outbound Proxy info
|
||||
outbound_proxy: ""
|
||||
outbound_proxy_port: "5060"
|
||||
|
||||
# NAT/Firewall Traversal
|
||||
nat_enable: "0"
|
||||
nat_address: ""
|
||||
voip_control_port: "5060"
|
||||
start_media_port: "16384"
|
||||
end_media_port: "32766"
|
||||
nat_received_processing: "0"
|
||||
|
||||
# Proxy Registration (0-disable (default), 1-enable)
|
||||
proxy_register: "1"
|
||||
|
||||
# Phone Registration Expiration [1-3932100 sec] (Default - 3600)
|
||||
timer_register_expires: "3600"
|
||||
|
||||
# Codec for media stream (g711ulaw (default), g711alaw, g729)
|
||||
preferred_codec: "none"
|
||||
|
||||
# TOS bits in media stream [0-5] (Default - 5)
|
||||
tos_media: "5"
|
||||
|
||||
# Enable VAD (0-disable (default), 1-enable)
|
||||
enable_vad: "0"
|
||||
|
||||
# Allow for the bridge on a 3way call to join remaining parties upon hangup
|
||||
cnf_join_enable: "1" ; 0-Disabled, 1-Enabled (default)
|
||||
|
||||
# Allow Transfer to be completed while target phone is still ringing
|
||||
semi_attended_transfer: "0" ; 0-Disabled, 1-Enabled (default)
|
||||
|
||||
# Telnet Level (enable or disable the ability to telnet into this phone
|
||||
telnet_level: "2" ; 0-Disabled (default), 1-Enabled, 2-Privileged
|
||||
|
||||
# Inband DTMF Settings (0-disable, 1-enable (default))
|
||||
dtmf_inband: "1"
|
||||
|
||||
# Out of band DTMF Settings (none-disable, avt-avt enable (default), avt_always - always avt )
|
||||
dtmf_outofband: "avt"
|
||||
|
||||
# DTMF dB Level Settings (1-6dB down, 2-3db down, 3-nominal (default), 4-3db up, 5-6dB up)
|
||||
dtmf_db_level: "3"
|
||||
|
||||
# SIP Timers
|
||||
timer_t1: "500" ; Default 500 msec
|
||||
timer_t2: "4000" ; Default 4 sec
|
||||
sip_retx: "10" ; Default 11
|
||||
sip_invite_retx: "6" ; Default 7
|
||||
timer_invite_expires: "180" ; Default 180 sec
|
||||
|
||||
# Setting for Message speeddial to UOne box
|
||||
messages_uri: "*98"
|
||||
|
||||
# TFTP Phone Specific Configuration File Directory
|
||||
tftp_cfg_dir: ""
|
||||
|
||||
# Time Server
|
||||
sntp_mode: "unicast"
|
||||
sntp_server: "192.168.1.1"
|
||||
time_zone: "EST"
|
||||
dst_offset: "1"
|
||||
dst_start_month: "Mar"
|
||||
dst_start_day: ""
|
||||
dst_start_day_of_week: "Sun"
|
||||
dst_start_week_of_month: "2"
|
||||
dst_start_time: "02"
|
||||
dst_stop_month: "Nov"
|
||||
dst_stop_day: ""
|
||||
dst_stop_day_of_week: "Sunday"
|
||||
dst_stop_week_of_month: "1"
|
||||
dst_stop_time: "2"
|
||||
dst_auto_adjust: "1"
|
||||
|
||||
# Do Not Disturb Control (0-off, 1-on, 2-off with no user control, 3-on with no user control)
|
||||
dnd_control: "0" ; Default 0 (Do Not Disturb feature is off)
|
||||
|
||||
# Caller ID Blocking (0-disabled, 1-enabled, 2-disabled no user control, 3-enabled no user control)
|
||||
callerid_blocking: "0" ; Default 0 (Disable sending all calls as anonymous)
|
||||
|
||||
# Anonymous Call Blocking (0-disbaled, 1-enabled, 2-disabled no user control, 3-enabled no user control)
|
||||
anonymous_call_block: "0" ; Default 0 (Disable blocking of anonymous calls)
|
||||
|
||||
# Call Waiting (0-disabled, 1-enabled, 2-disabled with no user control, 3-enabled with no user control)
|
||||
call_waiting: "1" ; Default 1 (Call Waiting enabled)
|
||||
|
||||
# DTMF AVT Payload (Dynamic payload range for AVT tones - 96-127)
|
||||
dtmf_avt_payload: "101" ; Default 100
|
||||
|
||||
# XML file that specifies the dialplan desired
|
||||
dial_template: "dialplan"
|
||||
|
||||
# Network Media Type (auto, full100, full10, half100, half10)
|
||||
network_media_type: "auto"
|
||||
|
||||
#Autocompletion During Dial (0-off, 1-on [default])
|
||||
autocomplete: "1"
|
||||
|
||||
#Time Format (0-12hr, 1-24hr [default])
|
||||
time_format_24hr: "0"
|
||||
|
||||
# URL for external Phone Services
|
||||
#services_url: "http://192.168.1.1/xmlservices/index.php"
|
||||
|
||||
# URL for external Directory location
|
||||
#directory_url: "http://192.168.1.1/xmlservices/PhoneDirectory.php"
|
||||
|
||||
# URL for branding logo
|
||||
#logo_url: "http://192.168.1.1/cisco/bmp/trixbox.bmp"
|
||||
|
||||
# Remote Party ID
|
||||
remote_party_id: 1 ; 0-Disabled (default), 1-Enabled
|
||||
|
||||
|
||||
@@ -1,43 +1,150 @@
|
||||
phone_label: "{$display_name_1}"
|
||||
proxy1_address: "{$server_address_1}"
|
||||
{if isset($cisco_time_zone)}
|
||||
# Image version
|
||||
image_version: "{$cisco_image_version}"
|
||||
{/if}
|
||||
|
||||
# Phone settings
|
||||
phone_label: "{$label}"
|
||||
proxy_register: 1
|
||||
timer_register_expires: 300
|
||||
preferred_codec: g711ulaw
|
||||
enable_vad: 0
|
||||
dial_template: "dialplan"
|
||||
|
||||
line1_name: "{$user_id_1}"
|
||||
line1_displayname: "{$user_id_1}"
|
||||
line1_shortname: "{$short_name_1}"
|
||||
line1_authname: "{$auth_id_1}"
|
||||
line1_password: "{$user_password_1}"
|
||||
{foreach $lines as $row}reg.{$row.line_number}.displayName="{$row.display_name}"
|
||||
#registration information
|
||||
proxy{$row.line_number}_address: "{$row.server_address}"
|
||||
proxy{$row.line_number}_port:"{$row.sip_port}"
|
||||
line{$row.line_number}_name: "{$row.user_id}"
|
||||
line{$row.line_number}_displayname: "{$row.user_id}"
|
||||
line{$row.line_number}_shortname: "{$row.display_name}"
|
||||
line{$row.line_number}_authname: "{$row.auth_id}"
|
||||
line{$row.line_number}_password: "{$row.password}"
|
||||
|
||||
line2_name: "{$user_id_2}"
|
||||
line2_displayname: "{$user_id_2}"
|
||||
line2_shortname: "{$short_name_2}"
|
||||
line2_authname: "{$auth_id_2}"
|
||||
line2_password: "{$user_password_2}"
|
||||
{/foreach}
|
||||
# Emergency Proxy info
|
||||
proxy_emergency: "{$proxy_emergency}"
|
||||
proxy_emergency_port: "{$proxy_emergency_port}"
|
||||
|
||||
line3_name: "{$user_id_3}"
|
||||
line3_displayname: "{$user_id_3}"
|
||||
line3_shortname: "{$short_name_3}"
|
||||
line3_authname: "{$auth_id_3}"
|
||||
line3_password: "{$user_password_3}"
|
||||
# Backup Proxy info
|
||||
proxy_backup: "{$proxy_backup}"
|
||||
proxy_backup_port: "{$proxy_backup_port}"
|
||||
|
||||
# Outbound Proxy info
|
||||
outbound_proxy: "{$outbound_proxy}"
|
||||
outbound_proxy_port: "{$outbound_proxy_port}"
|
||||
|
||||
# NAT/Firewall Traversal
|
||||
voip_control_port: "5060"
|
||||
start_media_port: "16384"
|
||||
end_media_port: "32768"
|
||||
nat_received_processing: "0"
|
||||
nat_enable: "{if isset($nat_enable)}{$nat_enable}{else}1{/if}"
|
||||
nat_address: "{$nat_nat_address}"
|
||||
|
||||
line4_name: "{$user_id_4}"
|
||||
line4_displayname: "{$user_id_4}"
|
||||
line4_shortname: "{$short_name_4}"
|
||||
line4_authname: "{$auth_id_4}"
|
||||
line4_password: "{$user_password_4}"
|
||||
# Sync value of the phone used for remote reset
|
||||
sync: 1 ; Default 1
|
||||
|
||||
line5_name: "{$user_id_5}"
|
||||
line5_displayname: "{$user_id_5}"
|
||||
line5_shortname: "{$short_name_5}"
|
||||
line5_authname: "{$auth_id_5}"
|
||||
line5_password: "{$user_password_5}"
|
||||
# Proxy Registration (0-disable (default), 1-enable)
|
||||
proxy_register: "1"
|
||||
|
||||
# Phone Registration Expiration [1-3932100 sec] (Default - 3600)
|
||||
timer_register_expires: "80"
|
||||
|
||||
# Codec for media stream (g711ulaw (default), g711alaw, g729)
|
||||
preferred_codec: "none"
|
||||
|
||||
# TOS bits in media stream [0-5] (Default - 5)
|
||||
tos_media: "5"
|
||||
|
||||
line6_name: "{$user_id_6}"
|
||||
line6_displayname: "{$user_id_6}"
|
||||
line6_shortname: "{$short_name_6}"
|
||||
line6_authname: "{$auth_id_6}"
|
||||
line6_password: "{$user_password_6}"
|
||||
# Enable VAD (0-disable (default), 1-enable)
|
||||
enable_vad: "0"
|
||||
|
||||
# Allow for the bridge on a 3way call to join remaining parties upon hangup
|
||||
cnf_join_enable: "1" ; 0-Disabled, 1-Enabled (default)
|
||||
|
||||
# Allow Transfer to be completed while target phone is still ringing
|
||||
semi_attended_transfer: "0" ; 0-Disabled, 1-Enabled (default)
|
||||
|
||||
# Telnet Level (enable or disable the ability to telnet into this phone
|
||||
telnet_level: "2" ; 0-Disabled (default), 1-Enabled, 2-Privileged
|
||||
|
||||
# Inband DTMF Settings (0-disable, 1-enable (default))
|
||||
dtmf_inband: "1"
|
||||
|
||||
# Out of band DTMF Settings (none-disable, avt-avt enable (default), avt_always - always avt )
|
||||
dtmf_outofband: "avt"
|
||||
|
||||
# DTMF dB Level Settings (1-6dB down, 2-3db down, 3-nominal (default), 4-3db up, 5-6dB up)
|
||||
dtmf_db_level: "3"
|
||||
|
||||
# SIP Timers
|
||||
timer_t1: "500" ; Default 500 msec
|
||||
timer_t2: "4000" ; Default 4 sec
|
||||
sip_retx: "10" ; Default 11
|
||||
sip_invite_retx: "6" ; Default 7
|
||||
timer_invite_expires: "180" ; Default 180 sec
|
||||
|
||||
# Setting for Message speeddial to UOne box
|
||||
messages_uri: "*97"
|
||||
|
||||
# TFTP Phone Specific Configuration File Directory
|
||||
tftp_cfg_dir: ""
|
||||
|
||||
# Time Server
|
||||
sntp_mode: "unicast"
|
||||
sntp_server: "{$sntp_server}"
|
||||
{if isset($cisco_time_zone)}
|
||||
time_zone: "{$cisco_time_zone}"
|
||||
{/if}
|
||||
dst_offset: "1"
|
||||
dst_start_month: "Mar"
|
||||
dst_start_day: ""
|
||||
dst_start_day_of_week: "Sun"
|
||||
dst_start_week_of_month: "2"
|
||||
dst_start_time: "02"
|
||||
dst_stop_month: "Nov"
|
||||
dst_stop_day: ""
|
||||
dst_stop_day_of_week: "Sunday"
|
||||
dst_stop_week_of_month: "1"
|
||||
dst_stop_time: "2"
|
||||
dst_auto_adjust: "1"
|
||||
|
||||
# Do Not Disturb Control (0-off, 1-on, 2-off with no user control, 3-on with no user control)
|
||||
dnd_control: "2" ; Default 0 (Do Not Disturb feature is off)
|
||||
|
||||
# Caller ID Blocking (0-disabled, 1-enabled, 2-disabled no user control, 3-enabled no user control)
|
||||
callerid_blocking: "0" ; Default 0 (Disable sending all calls as anonymous)
|
||||
|
||||
# Anonymous Call Blocking (0-disbaled, 1-enabled, 2-disabled no user control, 3-enabled no user control)
|
||||
anonymous_call_block: "0" ; Default 0 (Disable blocking of anonymous calls)
|
||||
|
||||
# Call Waiting (0-disabled, 1-enabled, 2-disabled with no user control, 3-enabled with no user control)
|
||||
call_waiting: "1" ; Default 1 (Call Waiting enabled)
|
||||
|
||||
# DTMF AVT Payload (Dynamic payload range for AVT tones - 96-127)
|
||||
dtmf_avt_payload: "101" ; Default 100
|
||||
|
||||
# XML file that specifies the dialplan desired
|
||||
dial_template: "dialplan"
|
||||
|
||||
# Network Media Type (auto, full100, full10, half100, half10)
|
||||
network_media_type: "auto"
|
||||
|
||||
#Autocompletion During Dial (0-off, 1-on [default])
|
||||
autocomplete: "1"
|
||||
|
||||
#Time Format (0-12hr, 1-24hr [default])
|
||||
time_format_24hr: "0"
|
||||
|
||||
# URL for external Phone Services
|
||||
#services_url: "http://{$domain_name}/app/provision/file/services.xml"
|
||||
|
||||
# URL for external Directory location
|
||||
directory_url: "http://{$domain_name}/app/provision/file/directory.xml"
|
||||
|
||||
# URL for branding logo
|
||||
#logo_url: "http://{$domain_name}/app/provision/logo.bmp"
|
||||
|
||||
# Remote Party ID
|
||||
remote_party_id: 1 ; 0-Disabled (default), 1-Enabled
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<CiscoIPPhoneDirectory>
|
||||
<Title>Enterprise</Title>
|
||||
<Prompt>Please choose...</Prompt>
|
||||
{assign var=x value=1}
|
||||
{foreach $contacts as $row}{if $row.contact_category == "enterprise"}
|
||||
<DirectoryEntry>
|
||||
{if $row.contact_name_given != ""}
|
||||
<Name>{$row.contact_name_given} {$row.contact_name_family}</Name>
|
||||
{else}
|
||||
<Name>{$row.contact_organization}</Name>
|
||||
{/if}
|
||||
{if $row.phone_number != ""}
|
||||
<Telephone>{$row.phone_number}</Telephone>
|
||||
{else}
|
||||
<Telephone>{$row.phone_extension}</Telephone>
|
||||
{/if}
|
||||
</DirectoryEntry>
|
||||
{/if}
|
||||
{assign var=x value=$x+1}
|
||||
{/foreach}
|
||||
</CiscoIPPhoneDirectory>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<CiscoIPPhoneDirectory>
|
||||
<Title>Personal</Title>
|
||||
<Prompt>Please choose...</Prompt>
|
||||
{assign var=x value=1}
|
||||
{foreach $contacts as $row}{if $row.contact_category == "personal"}
|
||||
<DirectoryEntry>
|
||||
{if $row.contact_name_given != ""}
|
||||
<Name>{$row.contact_name_given} {$row.contact_name_family}</Name>
|
||||
{else}
|
||||
<Name>{$row.contact_organization}</Name>
|
||||
{/if}
|
||||
{if $row.phone_number != ""}
|
||||
<Telephone>{$row.phone_number}</Telephone>
|
||||
{else}
|
||||
<Telephone>{$row.phone_extension}</Telephone>
|
||||
{/if}
|
||||
</DirectoryEntry>
|
||||
{/if}
|
||||
{assign var=x value=$x+1}
|
||||
{/foreach}
|
||||
</CiscoIPPhoneDirectory>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<CiscoIPPhoneDirectory>
|
||||
<Title>Speed Dial</Title>
|
||||
<Prompt>Please choose...</Prompt>
|
||||
{assign var=x value=1}
|
||||
{foreach $contacts as $row}{if $row.contact_category == "speed dial"}
|
||||
<DirectoryEntry>
|
||||
{if $row.contact_name_given != ""}
|
||||
<Name>{$row.contact_name_given} {$row.contact_name_family}</Name>
|
||||
{else}
|
||||
<Name>{$row.contact_organization}</Name>
|
||||
{/if}
|
||||
{if $row.phone_number != ""}
|
||||
<Telephone>{$row.phone_number}</Telephone>
|
||||
{else}
|
||||
<Telephone>{$row.phone_extension}</Telephone>
|
||||
{/if}
|
||||
</DirectoryEntry>
|
||||
{/if}
|
||||
{assign var=x value=$x+1}
|
||||
{/foreach}
|
||||
</CiscoIPPhoneDirectory>
|
||||
17
resources/templates/provision/cisco/7960/directory.xml
Normal file
17
resources/templates/provision/cisco/7960/directory.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<CiscoIPPhoneMenu>
|
||||
<Title>Contacts</Title>
|
||||
<Prompt>Please choose...</Prompt>
|
||||
|
||||
<!--
|
||||
<MenuItem>
|
||||
<Name>Personal</Name>
|
||||
<URL>http://{$domain_name}/app/provision/file/directory-personal.xml</URL>
|
||||
</MenuItem>
|
||||
--> <MenuItem> <Name>Enterprise</Name>
|
||||
<URL>http://{$domain_name}/app/provision/file/directory-enterprise.xml?mac={$mac}</URL>
|
||||
</MenuItem>
|
||||
<MenuItem>
|
||||
<Name>Speed Dial</Name>
|
||||
<URL>http://{$domain_name}/app/provision/file/directory-speed_dial.xml?mac={$mac}</URL>
|
||||
</MenuItem>
|
||||
</CiscoIPPhoneMenu>
|
||||
Reference in New Issue
Block a user