From 7adab1e59f3ec8798d05032adbfd6a754a2c1a23 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Fri, 4 Dec 2015 12:18:11 +0000 Subject: [PATCH 01/15] Add git information to system info --- app/system/app_languages.php | 10 ++++++++++ app/system/system.php | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/app/system/app_languages.php b/app/system/app_languages.php index 0906685a9b..e367817dea 100644 --- a/app/system/app_languages.php +++ b/app/system/app_languages.php @@ -80,6 +80,16 @@ $text['label-os']['sv-se'] = "Operativsystem"; $text['label-os']['uk'] = "Операційна система "; $text['label-os']['de-at'] = "Betriebssystem"; +$text['label-git-info']['en-us'] = "Git Information"; +$text['label-git-info']['es-cl'] = ""; +$text['label-git-info']['pt-pt'] = ""; +$text['label-git-info']['fr-fr'] = ""; +$text['label-git-info']['pt-br'] = ""; +$text['label-git-info']['pl'] = ""; +$text['label-git-info']['sv-se'] = ""; +$text['label-git-info']['uk'] = ""; +$text['label-git-info']['de-at'] = ""; + $text['label-memcache_status']['en-us'] = "Memcache Status"; $text['label-memcache_status']['es-cl'] = "Estado de Memcache"; $text['label-memcache_status']['pt-pt'] = "Estado da Memcache"; diff --git a/app/system/system.php b/app/system/system.php index eb77d27d99..4c72da3862 100644 --- a/app/system/system.php +++ b/app/system/system.php @@ -85,6 +85,24 @@ $document['title'] = $text['title-sys-status']; echo " \n"; echo "\n"; + $git_path = normalize_path_to_os($_SERVER["DOCUMENT_ROOT"]."/.git"); + $git_branch = shell_exec('git --git-dir='.$git_path.' name-rev --name-only HEAD'); + rtrim($git_branch); + $git_commit = shell_exec('git --git-dir='.$git_path.' rev-parse HEAD'); + rtrim($git_commit); + $git_origin = shell_exec('git --git-dir='.$git_path.' config --get remote.origin.url'); + rtrim($git_commit); + echo "\n"; + echo " \n"; + echo " ".$text['label-git-info']."\n"; + echo " \n"; + echo " \n"; + echo " Branch: '$git_branch'
\n"; + echo " Commit: '$git_commit'
\n"; + echo " Origin: '$git_origin'
\n"; + echo " \n"; + echo "\n"; + echo "\n"; From 612065417eeac5387c4e776cbf096f91c9198c69 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 4 Dec 2015 17:35:02 -0700 Subject: [PATCH 02/15] Update the wakeup phrases. --- .../templates/conf/lang/en/ivr/wakeup.xml | 151 ++++++++++-------- 1 file changed, 85 insertions(+), 66 deletions(-) diff --git a/resources/templates/conf/lang/en/ivr/wakeup.xml b/resources/templates/conf/lang/en/ivr/wakeup.xml index 8c41736405..7ce070c06f 100644 --- a/resources/templates/conf/lang/en/ivr/wakeup.xml +++ b/resources/templates/conf/lang/en/ivr/wakeup.xml @@ -5,49 +5,51 @@ - - - - - - - - - - - - - - - - - - - - + + - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,13 +59,7 @@ - - - - - - - + @@ -73,13 +69,10 @@ - - - + - - - + + @@ -90,13 +83,20 @@ - - - - - - - + + + + + + + + + + + + + + @@ -104,26 +104,45 @@ - + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + - - + + - + \ No newline at end of file From a7a80e0abe887cc4913c44f14142a698572c950e Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 10:02:24 -0700 Subject: [PATCH 03/15] Create a new app_uuid when creating a dialplan however when copying a time condition, inbound and outbound route keep the original app_uuid. --- app/dialplan/dialplan_copy.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/dialplan/dialplan_copy.php b/app/dialplan/dialplan_copy.php index c99d664145..1160fc769f 100644 --- a/app/dialplan/dialplan_copy.php +++ b/app/dialplan/dialplan_copy.php @@ -77,6 +77,15 @@ else { } unset ($prep_statement); +//copy the app_uuid only for specific dialplans + switch ($app_uuid) { + case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4": //inbound routes + case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3": //outbound routes + case "4b821450-926b-175a-af93-a03c441818b1": //time conditions + default: + $app_uuid = null; + } + //copy the dialplan $dialplan_uuid = uuid(); $sql = "insert into v_dialplans "; @@ -95,7 +104,12 @@ else { $sql .= "("; $sql .= "'".$domain_uuid."', "; $sql .= "'$dialplan_uuid', "; - $sql .= "'$app_uuid', "; + if ($app_uuid == null) { + $sql .= "null, "; + } + else { + $sql .= "'$app_uuid', "; + } $sql .= "'".$dialplan_name."-copy', "; $sql .= "'$dialplan_order', "; $sql .= "'$dialplan_continue', "; From 68e1af780954d0b73f333ab462b3209a233ab807 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 10:13:22 -0700 Subject: [PATCH 04/15] Use set and unset instead. --- app/dialplan/dialplan_copy.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/dialplan/dialplan_copy.php b/app/dialplan/dialplan_copy.php index 1160fc769f..8d295a4b7f 100644 --- a/app/dialplan/dialplan_copy.php +++ b/app/dialplan/dialplan_copy.php @@ -83,7 +83,7 @@ else { case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3": //outbound routes case "4b821450-926b-175a-af93-a03c441818b1": //time conditions default: - $app_uuid = null; + unset($app_uuid); } //copy the dialplan @@ -104,11 +104,11 @@ else { $sql .= "("; $sql .= "'".$domain_uuid."', "; $sql .= "'$dialplan_uuid', "; - if ($app_uuid == null) { - $sql .= "null, "; + if (isset($app_uuid)) { + $sql .= "'$app_uuid', "; } else { - $sql .= "'$app_uuid', "; + $sql .= "null, "; } $sql .= "'".$dialplan_name."-copy', "; $sql .= "'$dialplan_order', "; From f240d25e4e466b889c6c97a21a89f9e30a852646 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 10:26:10 -0700 Subject: [PATCH 05/15] Change how the app_uuid is handled on device copy. --- app/dialplan/dialplan_copy.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/dialplan/dialplan_copy.php b/app/dialplan/dialplan_copy.php index 8d295a4b7f..de81736106 100644 --- a/app/dialplan/dialplan_copy.php +++ b/app/dialplan/dialplan_copy.php @@ -77,13 +77,13 @@ else { } unset ($prep_statement); -//copy the app_uuid only for specific dialplans +//create a new app_uuid when copying a dialplan except for these exceptions switch ($app_uuid) { case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4": //inbound routes case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3": //outbound routes case "4b821450-926b-175a-af93-a03c441818b1": //time conditions default: - unset($app_uuid); + $app_uuid = uuid(); } //copy the dialplan @@ -104,12 +104,7 @@ else { $sql .= "("; $sql .= "'".$domain_uuid."', "; $sql .= "'$dialplan_uuid', "; - if (isset($app_uuid)) { - $sql .= "'$app_uuid', "; - } - else { - $sql .= "null, "; - } + $sql .= "'$app_uuid', "; $sql .= "'".$dialplan_name."-copy', "; $sql .= "'$dialplan_order', "; $sql .= "'$dialplan_continue', "; From 8909ce9e63e2a11256c9ce77e53fbe2afa172100 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 12:25:34 -0700 Subject: [PATCH 06/15] Detect the host type for PostgreSQL so it works with host or ip address. Also improve the code consistency by correcting the indentation and adding a few more comments. --- .../resources/classes/global_settings.php | 4 +- .../resources/classes/install_switch.php | 279 +++++++++--------- 2 files changed, 147 insertions(+), 136 deletions(-) diff --git a/core/install/resources/classes/global_settings.php b/core/install/resources/classes/global_settings.php index b93bc371fb..251153e5d2 100644 --- a/core/install/resources/classes/global_settings.php +++ b/core/install/resources/classes/global_settings.php @@ -35,7 +35,7 @@ require_once "root.php"; public function get_switch_dirs() { return $this->_switch_dirs; } public function get_switch_vdirs() { return $this->_switch_vdirs; } - // dirs - detected by from the switch + // dirs - detected from the switch protected $_switch_base_dir = ''; protected $_switch_cache_dir = ''; protected $_switch_certs_dir = ''; @@ -157,7 +157,7 @@ require_once "root.php"; $this->_switch_event_host = $_SESSION['event_socket_ip_address']; $this->_switch_event_port = $_SESSION['event_socket_port']; $this->_switch_event_password = $_SESSION['event_socket_password']; - + // domain info $this->_domain_name = $_SESSION['domain_name']; $this->_domain_uuid = $_SESSION['domain_uuid']; diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 3fb3950cb6..5b5e953c80 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -285,149 +285,160 @@ include "root.php"; } public function create_config_lua() { - $this->write_progress("\tCreating " . $this->config_lua); - $path = dirname($this->config_lua); - $parent_dir = basename($path); - if($parent_dir == 'resources' and !file_exists($path)){ - $this->write_progress("\t... creating missing '$path'"); - if (!mkdir($path, 0755, true)) { - throw new Exception("Failed to create the missing resources directory '$path'"); - } - } - - global $db; - //get the odbc information - $sql = "select count(*) as num_rows from v_databases "; - $sql .= "where database_driver = 'odbc' "; - if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } - $prep_statement = $db->prepare($sql); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - unset($prep_statement); - if ($row['num_rows'] > 0) { - $odbc_num_rows = $row['num_rows']; - $sql = "select * from v_databases "; - $sql .= "where database_driver = 'odbc' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - foreach ($result as &$row) { - $dsn_name = $row["database_name"]; - $dsn_username = $row["database_username"]; - $dsn_password = $row["database_password"]; - break; //limit to 1 row + //define the database connection as global + global $db; + + //send progress + $this->write_progress("\tCreating " . $this->config_lua); + + //set the directories + $path = dirname($this->config_lua); + $parent_dir = basename($path); + if ($parent_dir == 'resources' and !file_exists($path)){ + $this->write_progress("\t... creating missing '$path'"); + if (!mkdir($path, 0755, true)) { + throw new Exception("Failed to create the missing resources directory '$path'"); } - unset ($prep_statement); + } + + //get the odbc information + $sql = "select count(*) as num_rows from v_databases "; + $sql .= "where database_driver = 'odbc' "; + if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + unset($prep_statement); + if ($row['num_rows'] > 0) { + $odbc_num_rows = $row['num_rows']; + $sql = "select * from v_databases "; + $sql .= "where database_driver = 'odbc' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + foreach ($result as &$row) { + $dsn_name = $row["database_name"]; + $dsn_username = $row["database_username"]; + $dsn_password = $row["database_password"]; + break; //limit to 1 row + } + unset ($prep_statement); + } + else { + $odbc_num_rows = '0'; + } + } + + //config.lua + $fout = fopen($this->config_lua,"w"); + if(!$fout){ + throw new Exception("Failed to open '".$this->config_lua."' for writing"); + } + $tmp = "\n"; + $tmp .= "--set the variables\n"; + if (strlen($this->global_settings->switch_sounds_dir()) > 0) { + $tmp .= normalize_path_to_os(" sounds_dir = [[".$this->global_settings->switch_sounds_dir()."]];\n"); + } + if (strlen($this->global_settings->switch_phrases_vdir()) > 0) { + $tmp .= normalize_path_to_os(" phrases_dir = [[".$this->global_settings->switch_phrases_vdir()."]];\n"); + } + if (strlen($this->global_settings->switch_db_dir()) > 0) { + $tmp .= normalize_path_to_os(" database_dir = [[".$this->global_settings->switch_db_dir()."]];\n"); + } + if (strlen($this->global_settings->switch_recordings_dir()) > 0) { + $tmp .= normalize_path_to_os(" recordings_dir = [[".$this->global_settings->switch_recordings_dir()."]];\n"); + } + if (strlen($this->global_settings->switch_storage_dir()) > 0) { + $tmp .= normalize_path_to_os(" storage_dir = [[".$this->global_settings->switch_storage_dir()."]];\n"); + } + if (strlen($this->global_settings->switch_voicemail_vdir()) > 0) { + $tmp .= normalize_path_to_os(" voicemail_dir = [[".$this->global_settings->switch_voicemail_vdir()."]];\n"); + } + if (strlen($this->global_settings->switch_script_dir()) > 0) { + $tmp .= normalize_path_to_os(" scripts_dir = [[".$this->global_settings->switch_script_dir()."]];\n"); + } + $tmp .= normalize_path_to_os(" php_dir = [[".PHP_BINDIR."]];\n"); + if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") { + $tmp .= " php_bin = \"php.exe\";\n"; } else { - $odbc_num_rows = '0'; + $tmp .= " php_bin = \"php\";\n"; } - } + $tmp .= normalize_path_to_os(" document_root = [[".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."]];\n"); + $tmp .= "\n"; - //config.lua - $fout = fopen($this->config_lua,"w"); - if(!$fout){ - throw new Exception("Failed to open '".$this->config_lua."' for writing"); - } - $tmp = "\n"; - $tmp .= "--set the variables\n"; - if (strlen($this->global_settings->switch_sounds_dir()) > 0) { - $tmp .= normalize_path_to_os(" sounds_dir = [[".$this->global_settings->switch_sounds_dir()."]];\n"); - } - if (strlen($this->global_settings->switch_phrases_vdir()) > 0) { - $tmp .= normalize_path_to_os(" phrases_dir = [[".$this->global_settings->switch_phrases_vdir()."]];\n"); - } - if (strlen($this->global_settings->switch_db_dir()) > 0) { - $tmp .= normalize_path_to_os(" database_dir = [[".$this->global_settings->switch_db_dir()."]];\n"); - } - if (strlen($this->global_settings->switch_recordings_dir()) > 0) { - $tmp .= normalize_path_to_os(" recordings_dir = [[".$this->global_settings->switch_recordings_dir()."]];\n"); - } - if (strlen($this->global_settings->switch_storage_dir()) > 0) { - $tmp .= normalize_path_to_os(" storage_dir = [[".$this->global_settings->switch_storage_dir()."]];\n"); - } - if (strlen($this->global_settings->switch_voicemail_vdir()) > 0) { - $tmp .= normalize_path_to_os(" voicemail_dir = [[".$this->global_settings->switch_voicemail_vdir()."]];\n"); - } - if (strlen($this->global_settings->switch_script_dir()) > 0) { - $tmp .= normalize_path_to_os(" scripts_dir = [[".$this->global_settings->switch_script_dir()."]];\n"); - } - $tmp .= normalize_path_to_os(" php_dir = [[".PHP_BINDIR."]];\n"); - if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") { - $tmp .= " php_bin = \"php.exe\";\n"; - } - else { - $tmp .= " php_bin = \"php\";\n"; - } - $tmp .= normalize_path_to_os(" document_root = [[".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."]];\n"); - $tmp .= "\n"; + if ((strlen($this->global_settings->db_type()) > 0) || (strlen($dsn_name) > 0)) { + $tmp .= "--database information\n"; + $tmp .= " database = {}\n"; + $tmp .= " database[\"type\"] = \"".$this->global_settings->db_type()."\";\n"; + $tmp .= " database[\"name\"] = \"".$this->global_settings->db_name()."\";\n"; + $tmp .= normalize_path_to_os(" database[\"path\"] = [[".$this->global_settings->db_path()."]];\n"); - if ((strlen($this->global_settings->db_type()) > 0) || (strlen($dsn_name) > 0)) { - $tmp .= "--database information\n"; - $tmp .= " database = {}\n"; - $tmp .= " database[\"type\"] = \"".$this->global_settings->db_type()."\";\n"; - $tmp .= " database[\"name\"] = \"".$this->global_settings->db_name()."\";\n"; - $tmp .= normalize_path_to_os(" database[\"path\"] = [[".$this->global_settings->db_path()."]];\n"); - - if (strlen($dsn_name) > 0) { - $tmp .= " database[\"system\"] = \"odbc://".$dsn_name.":".$dsn_username.":".$dsn_password."\";\n"; - $tmp .= " database[\"switch\"] = \"odbc://freeswitch:".$dsn_username.":".$dsn_password."\";\n"; + if (strlen($dsn_name) > 0) { + $tmp .= " database[\"system\"] = \"odbc://".$dsn_name.":".$dsn_username.":".$dsn_password."\";\n"; + $tmp .= " database[\"switch\"] = \"odbc://freeswitch:".$dsn_username.":".$dsn_password."\";\n"; + } + elseif ($this->global_settings->db_type() == "pgsql") { + $db_host = $this->global_settings->db_host(); + if (filter_var($db_host, FILTER_VALIDATE_IP)) { + $host_type = "hostaddr"; + } + else { + $host_type = "host"; + } + if($db_host == 'localhost') { $db_host = '127.0.0.1'; } // lua cannot resolve localhost + $tmp .= " database[\"system\"] = \"pgsql://".$host_type."=".$db_host." port=".$this->global_settings->db_port()." dbname=".$this->global_settings->db_name()." user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='".$this->global_settings->db_name()."'\";\n"; + $tmp .= " database[\"switch\"] = \"pgsql://".$host_type."=".$db_host." port=".$this->global_settings->db_port()." dbname=freeswitch user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='freeswitch'\";\n"; + } + elseif ($this->global_settings->db_type() == "sqlite") { + $tmp .= " database[\"system\"] = \"sqlite://".$this->global_settings->db_path()."/".$this->global_settings->db_name()."\";\n"; + $tmp .= " database[\"switch\"] = \"sqlite://".$_SESSION['switch']['db']['dir']."\";\n"; + } + elseif ($this->global_settings->db_type() == "mysql") { + $tmp .= " database[\"system\"] = \"\";\n"; + $tmp .= " database[\"switch\"] = \"\";\n"; + } + $tmp .= "\n"; } - elseif ($this->global_settings->db_type() == "pgsql") { - $lua_db_host = $this->global_settings->db_host(); - if($lua_db_host == 'localhost') { $lua_db_host = '127.0.0.1'; } // lua cannot resolve localhost - $tmp .= " database[\"system\"] = \"pgsql://hostaddr=".$lua_db_host." port=".$this->global_settings->db_port()." dbname=".$this->global_settings->db_name()." user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='".$this->global_settings->db_name()."'\";\n"; - $tmp .= " database[\"switch\"] = \"pgsql://hostaddr=".$lua_db_host." port=".$this->global_settings->db_port()." dbname=freeswitch user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='freeswitch'\";\n"; - } - elseif ($this->global_settings->db_type() == "sqlite") { - $tmp .= " database[\"system\"] = \"sqlite://".$this->global_settings->db_path()."/".$this->global_settings->db_name()."\";\n"; - $tmp .= " database[\"switch\"] = \"sqlite://".$_SESSION['switch']['db']['dir']."\";\n"; - } - elseif ($this->global_settings->db_type() == "mysql") { - $tmp .= " database[\"system\"] = \"\";\n"; - $tmp .= " database[\"switch\"] = \"\";\n"; + $tmp .= "--set defaults\n"; + $tmp .= " expire = {}\n"; + $tmp .= " expire[\"directory\"] = \"3600\";\n"; + $tmp .= " expire[\"dialplan\"] = \"3600\";\n"; + $tmp .= " expire[\"languages\"] = \"3600\";\n"; + $tmp .= " expire[\"sofia.conf\"] = \"3600\";\n"; + $tmp .= " expire[\"acl.conf\"] = \"3600\";\n"; + $tmp .= "\n"; + $tmp .= "--set xml_handler\n"; + $tmp .= " xml_handler = {}\n"; + $tmp .= " xml_handler[\"fs_path\"] = false;\n"; + $tmp .= "\n"; + $tmp .= "--set the debug options\n"; + $tmp .= " debug[\"params\"] = false;\n"; + $tmp .= " debug[\"sql\"] = false;\n"; + $tmp .= " debug[\"xml_request\"] = false;\n"; + $tmp .= " debug[\"xml_string\"] = false;\n"; + $tmp .= " debug[\"cache\"] = false;\n"; + $tmp .= "\n"; + $tmp .= "--additional info\n"; + $tmp .= " domain_count = ".$this->global_settings->domain_count().";\n"; + $tmp .= normalize_path_to_os(" temp_dir = [[".$this->global_settings->switch_temp_dir()."]];\n"); + if (isset($_SESSION['domain']['dial_string']['text'])) { + $tmp .= " dial_string = \"".$_SESSION['domain']['dial_string']['text']."\";\n"; } $tmp .= "\n"; - } - $tmp .= "--set defaults\n"; - $tmp .= " expire = {}\n"; - $tmp .= " expire[\"directory\"] = \"3600\";\n"; - $tmp .= " expire[\"dialplan\"] = \"3600\";\n"; - $tmp .= " expire[\"languages\"] = \"3600\";\n"; - $tmp .= " expire[\"sofia.conf\"] = \"3600\";\n"; - $tmp .= " expire[\"acl.conf\"] = \"3600\";\n"; - $tmp .= "\n"; - $tmp .= "--set xml_handler\n"; - $tmp .= " xml_handler = {}\n"; - $tmp .= " xml_handler[\"fs_path\"] = false;\n"; - $tmp .= "\n"; - $tmp .= "--set the debug options\n"; - $tmp .= " debug[\"params\"] = false;\n"; - $tmp .= " debug[\"sql\"] = false;\n"; - $tmp .= " debug[\"xml_request\"] = false;\n"; - $tmp .= " debug[\"xml_string\"] = false;\n"; - $tmp .= " debug[\"cache\"] = false;\n"; - $tmp .= "\n"; - $tmp .= "--additional info\n"; - $tmp .= " domain_count = ".$this->global_settings->domain_count().";\n"; - $tmp .= normalize_path_to_os(" temp_dir = [[".$this->global_settings->switch_temp_dir()."]];\n"); - if (isset($_SESSION['domain']['dial_string']['text'])) { - $tmp .= " dial_string = \"".$_SESSION['domain']['dial_string']['text']."\";\n"; - } - $tmp .= "\n"; - $tmp .= "--include local.lua\n"; - $tmp .= " require(\"resources.functions.file_exists\");\n"; - $tmp .= " if (file_exists(\"/etc/fusionpbx/local.lua\")) then\n"; - $tmp .= " dofile(\"/etc/fusionpbx/local.lua\");\n"; - $tmp .= " elseif (file_exists(\"/usr/local/etc/fusionpbx/local.lua\")) then\n"; - $tmp .= " dofile(\"/usr/local/etc/fusionpbx/local.lua\");\n"; - $tmp .= " elseif (file_exists(scripts_dir..\"/resources/local.lua\")) then\n"; - $tmp .= " require(\"resources.local\");\n"; - $tmp .= " end\n"; - fwrite($fout, $tmp); - unset($tmp); - fclose($fout); + $tmp .= "--include local.lua\n"; + $tmp .= " require(\"resources.functions.file_exists\");\n"; + $tmp .= " if (file_exists(\"/etc/fusionpbx/local.lua\")) then\n"; + $tmp .= " dofile(\"/etc/fusionpbx/local.lua\");\n"; + $tmp .= " elseif (file_exists(\"/usr/local/etc/fusionpbx/local.lua\")) then\n"; + $tmp .= " dofile(\"/usr/local/etc/fusionpbx/local.lua\");\n"; + $tmp .= " elseif (file_exists(scripts_dir..\"/resources/local.lua\")) then\n"; + $tmp .= " require(\"resources.local\");\n"; + $tmp .= " end\n"; + fwrite($fout, $tmp); + unset($tmp); + fclose($fout); } protected function restart_switch() { From a89ad63831da0351f7779a22ab99b8bdec0759bc Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 12:36:08 -0700 Subject: [PATCH 07/15] Remove the domain name from the switch recordings SESSION variable. The path for single and multi-tenant are handled the same and all will used their domain name. --- resources/classes/domains.php | 39 ----------------------------------- 1 file changed, 39 deletions(-) diff --git a/resources/classes/domains.php b/resources/classes/domains.php index 2c2bbadee1..c0cc1e751f 100644 --- a/resources/classes/domains.php +++ b/resources/classes/domains.php @@ -186,30 +186,6 @@ //set the context $_SESSION["context"] = $_SESSION["domain_name"]; - //recordings add the domain to the path if there is more than one domains - if (count($_SESSION["domains"]) > 1) { - if (strlen($_SESSION['switch']['recordings']['dir']) > 0) { - if (substr($_SESSION['switch']['recordings']['dir'], -strlen($_SESSION["domain_name"])) != $_SESSION["domain_name"]) { - //get the default recordings directory - $sql = "select * from v_default_settings "; - $sql .= "where default_setting_enabled = 'true' "; - $sql .= "and default_setting_category = 'switch' "; - $sql .= "and default_setting_subcategory = 'recordings' "; - $sql .= "and default_setting_name = 'dir' "; - $prep_statement = $db->prepare($sql); - $prep_statement->execute(); - $result_default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED); - foreach ($result_default_settings as $row) { - $name = $row['default_setting_name']; - $category = $row['default_setting_category']; - $subcategory = $row['default_setting_subcategory']; - $switch_recordings_dir = $row['default_setting_value']; - } - //add the domain - $_SESSION['switch']['recordings']['dir'] = $switch_recordings_dir . '/' . $_SESSION["domain_name"]; - } - } - } } public function upgrade() { @@ -272,16 +248,6 @@ $prep_statement->execute(); $result_default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED); - //get the default recordings directory - foreach($result_default_settings as $row) { - $name = $row['default_setting_name']; - $category = $row['default_setting_category']; - $subcategory = $row['default_setting_subcategory']; - if ($category == 'switch' && $subcategory == 'recordings' && $name == 'dir') { - $switch_recordings_dir = $row['default_setting_value']; - } - } - //loop through all domains $sql = "select * from v_domains "; $v_prep_statement = $db->prepare(check_sql($sql)); @@ -349,11 +315,6 @@ } } - //set the recordings directory - if (strlen($switch_recordings_dir) > 1 && count($_SESSION["domains"]) > 1) { - $_SESSION['switch']['recordings']['dir'] = $switch_recordings_dir."/".$domain_name; - } - //get the list of installed apps from the core and mod directories and execute the php code in app_defaults.php $default_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_defaults.php"); foreach ($default_list as &$default_path) { From 37d4f52dc8e71fad200941b56d3d171aba957420 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 12:43:18 -0700 Subject: [PATCH 08/15] Convert localhost to 127.0.0.1 before determining the host_type. --- core/install/resources/classes/install_switch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/install/resources/classes/install_switch.php b/core/install/resources/classes/install_switch.php index 5b5e953c80..0e7fbf5803 100644 --- a/core/install/resources/classes/install_switch.php +++ b/core/install/resources/classes/install_switch.php @@ -381,13 +381,13 @@ include "root.php"; } elseif ($this->global_settings->db_type() == "pgsql") { $db_host = $this->global_settings->db_host(); + if($db_host == 'localhost') { $db_host = '127.0.0.1'; } // lua cannot resolve localhost if (filter_var($db_host, FILTER_VALIDATE_IP)) { $host_type = "hostaddr"; } else { $host_type = "host"; } - if($db_host == 'localhost') { $db_host = '127.0.0.1'; } // lua cannot resolve localhost $tmp .= " database[\"system\"] = \"pgsql://".$host_type."=".$db_host." port=".$this->global_settings->db_port()." dbname=".$this->global_settings->db_name()." user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='".$this->global_settings->db_name()."'\";\n"; $tmp .= " database[\"switch\"] = \"pgsql://".$host_type."=".$db_host." port=".$this->global_settings->db_port()." dbname=freeswitch user=".$this->global_settings->db_username()." password=".$this->global_settings->db_password()." options='' application_name='freeswitch'\";\n"; } From ff8b838b5e8d5e6edfaf819929ac83981f1fe2f2 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 13:37:35 -0700 Subject: [PATCH 09/15] After removing domain name from the default recordings dir path need to add the domain name every where the recordings directory is currently used. --- app/call_broadcast/call_broadcast_send.php | 12 +++---- app/call_centers/call_center_queue_edit.php | 2 +- app/calls_active/calls_active.php | 2 +- app/calls_active/calls_active_inc.php | 2 +- app/calls_active/calls_exec.php | 6 ++-- app/click_to_call/click_to_call.php | 2 +- .../conference_center_edit.php | 12 +++---- .../conference_session_details.php | 2 +- .../conference_sessions.php | 2 +- app/conferences_active/conference_exec.php | 4 +-- .../conference_interactive_inc.php | 2 +- app/ivr_menus/ivr_menu_edit.php | 32 +++++++++---------- .../classes/switch_music_on_hold.php | 2 +- app/operator_panel/index.php | 2 +- app/phrases/app_defaults.php | 6 ++-- app/phrases/phrase_edit.php | 4 +-- app/recordings/app_defaults.php | 8 ++--- app/recordings/recording_delete.php | 4 +-- app/recordings/recording_edit.php | 2 +- app/recordings/recordings.php | 24 +++++++------- app/xml_cdr/v_xml_cdr_import.php | 2 +- app/xml_cdr/xml_cdr.php | 2 +- app/xml_cdr/xml_cdr_delete.php | 4 +-- app/xml_cdr/xml_cdr_details.php | 10 +++--- core/domain_settings/domain_delete.php | 2 +- core/domain_settings/domain_edit.php | 4 +-- .../scripts/app/conference_center/index.lua | 11 ++++--- .../resources/scripts/start_recording.lua | 6 ++-- .../install/scripts/app/dialplan/index.lua | 1 - resources/install/scripts/fifo_member.lua | 1 - resources/install/scripts/ivr_menu.lua | 6 ++-- resources/install/scripts/recordings.lua | 16 ++-------- 32 files changed, 92 insertions(+), 105 deletions(-) diff --git a/app/call_broadcast/call_broadcast_send.php b/app/call_broadcast/call_broadcast_send.php index 1ccf411c42..3041391e16 100644 --- a/app/call_broadcast/call_broadcast_send.php +++ b/app/call_broadcast/call_broadcast_send.php @@ -260,10 +260,10 @@ require_once "resources/header.php"; $phone_1 = preg_replace('{\D}', '', $tmp_value_array[0]); if ($gateway == "loopback") { - $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_1."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; + $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_1."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; } else { - $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone_1." ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; + $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone_1." ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; } echo $cmd."
\n"; cmd_async($cmd); @@ -335,20 +335,20 @@ require_once "resources/header.php"; //make the call if (strlen($phone_1)> 0) { if ($gateway == "loopback") { - $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_1."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; + $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_1."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; } else { - $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone_1." ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; + $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone_1." ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; } //echo $cmd."
\n"; cmd_async($cmd); } if (strlen($phone_2)> 0) { if ($gateway == "loopback") { - $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_2."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; + $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_2."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; } else { - $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone_2." ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; + $cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone_2." ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";"; } //echo $cmd."
\n"; cmd_async($cmd); diff --git a/app/call_centers/call_center_queue_edit.php b/app/call_centers/call_center_queue_edit.php index 6f9a00809d..81ce4acbfb 100644 --- a/app/call_centers/call_center_queue_edit.php +++ b/app/call_centers/call_center_queue_edit.php @@ -739,7 +739,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; $record_ext=($_SESSION['record_ext']=='mp3'?'mp3':'wav'); - $record_template = $_SESSION['switch']['recordings']['dir']."/archive/\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}/\${uuid}.".$record_ext; + $record_template = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}/\${uuid}.".$record_ext; echo " \n"; echo " \n"; //recordings - if($dh = opendir($_SESSION['switch']['recordings']['dir']."/")) { + if($dh = opendir($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/")) { $tmp_selected = false; $files = Array(); echo "\n"; while ($file = readdir($dh)) { if ($file != "." && $file != ".." && $file[0] != '.') { - if (!is_dir($_SESSION['switch']['recordings']['dir']."/".$file)) { - $selected = ($conference_center_greeting == $_SESSION['switch']['recordings']['dir']."/".$file && strlen($conference_center_greeting) > 0) ? true : false; - echo " \n"; + if (!is_dir($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$file)) { + $selected = ($conference_center_greeting == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$file && strlen($conference_center_greeting) > 0) ? true : false; + echo " \n"; if ($selected) { $tmp_selected = true; } } } @@ -393,8 +393,8 @@ else { if (permission_exists('conference_center_add') || permission_exists('conference_center_edit')) { if (!$tmp_selected) { echo "\n"; - if (file_exists($_SESSION['switch']['recordings']['dir']."/".$conference_center_greeting)) { - echo " \n"; + if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$conference_center_greeting)) { + echo " \n"; } else if (substr($conference_center_greeting, -3) == "wav" || substr($conference_center_greeting, -3) == "mp3") { echo " \n"; diff --git a/app/conference_centers/conference_session_details.php b/app/conference_centers/conference_session_details.php index eeea9296c1..1ed402ab62 100644 --- a/app/conference_centers/conference_session_details.php +++ b/app/conference_centers/conference_session_details.php @@ -77,7 +77,7 @@ else { echo " \n"; echo " ".$text['title-conference_session_details']."\n"; echo " \n"; - $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; + $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; $tmp_name = ''; if (file_exists($tmp_dir.'/'.$row['conference_session_uuid'].'.mp3')) { $tmp_name = $row['conference_session_uuid'].".mp3"; diff --git a/app/conference_centers/conference_sessions.php b/app/conference_centers/conference_sessions.php index eecd71e4fb..4c669ac46a 100644 --- a/app/conference_centers/conference_sessions.php +++ b/app/conference_centers/conference_sessions.php @@ -146,7 +146,7 @@ else { echo " ".$start_date." \n"; echo " ".$end_date." \n"; echo " ".$row['profile']." \n"; - $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; + $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; $tmp_name = ''; if (file_exists($tmp_dir.'/'.$row['conference_session_uuid'].'.mp3')) { $tmp_name = $row['conference_session_uuid'].".mp3"; diff --git a/app/conferences_active/conference_exec.php b/app/conferences_active/conference_exec.php index f21af3adbb..2b5419aa3d 100644 --- a/app/conferences_active/conference_exec.php +++ b/app/conferences_active/conference_exec.php @@ -141,7 +141,7 @@ else { $switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value); } elseif ($data == "record") { - $recording_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.date("Y").'/'.date("M").'/'.date("d"); + $recording_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.date("Y").'/'.date("M").'/'.date("d"); $switch_cmd .= $recording_dir."/".$uuid.".wav"; if (!file_exists($recording_dir."/".$uuid.".wav")) { $switch_result = event_socket_request($fp, "api ".$switch_cmd); @@ -149,7 +149,7 @@ else { } elseif ($data == "norecord") { //stop recording and rename the file - $recording_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.date("Y").'/'.date("M").'/'.date("d"); + $recording_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.date("Y").'/'.date("M").'/'.date("d"); $switch_cmd .= $recording_dir."/".$uuid.".wav"; $switch_result = event_socket_request($fp, 'api '.$switch_cmd); } diff --git a/app/conferences_active/conference_interactive_inc.php b/app/conferences_active/conference_interactive_inc.php index 2c3a989593..0b9fbcf0ad 100644 --- a/app/conferences_active/conference_interactive_inc.php +++ b/app/conferences_active/conference_interactive_inc.php @@ -104,7 +104,7 @@ else { echo " \n"; echo "\n"; - $recording_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.date("Y").'/'.date("M").'/'.date("d"); + $recording_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.date("Y").'/'.date("M").'/'.date("d"); $recording_name = ''; if (file_exists($recording_dir.'/'.$row['uuid'].'.wav')) { $recording_name = $session_uuid.".wav"; diff --git a/app/ivr_menus/ivr_menu_edit.php b/app/ivr_menus/ivr_menu_edit.php index eb85e04752..40a40e3d24 100644 --- a/app/ivr_menus/ivr_menu_edit.php +++ b/app/ivr_menus/ivr_menu_edit.php @@ -440,9 +440,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { foreach ($recordings as &$row) { $recording_name = $row["recording_name"]; $recording_filename = $row["recording_filename"]; - if ($ivr_menu_greet_long == $_SESSION['switch']['recordings']['dir']."/".$recording_filename && strlen($ivr_menu_greet_long) > 0) { + if ($ivr_menu_greet_long == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && strlen($ivr_menu_greet_long) > 0) { $tmp_selected = true; - echo " \n"; + echo " \n"; } else if ($ivr_menu_greet_long == $recording_filename && strlen($ivr_menu_greet_long) > 0) { $tmp_selected = true; @@ -500,8 +500,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (if_group("superadmin")) { if (!$tmp_selected) { echo "\n"; - if (file_exists($_SESSION['switch']['recordings']['dir']."/".$ivr_menu_greet_long)) { - echo " \n"; + if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_greet_long)) { + echo " \n"; } else if (substr($ivr_menu_greet_long, -3) == "wav" || substr($ivr_menu_greet_long, -3) == "mp3") { echo " \n"; @@ -538,9 +538,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { foreach ($recordings as &$row) { $recording_name = $row["recording_name"]; $recording_filename = $row["recording_filename"]; - if ($ivr_menu_greet_short == $_SESSION['switch']['recordings']['dir']."/".$recording_filename && strlen($ivr_menu_greet_short) > 0) { + if ($ivr_menu_greet_short == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && strlen($ivr_menu_greet_short) > 0) { $tmp_selected = true; - echo " \n"; + echo " \n"; } else if ($ivr_menu_greet_short == $recording_filename && strlen($ivr_menu_greet_short) > 0) { $tmp_selected = true; @@ -599,8 +599,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (if_group("superadmin")) { if (!$tmp_selected && strlen($ivr_menu_greet_short) > 0) { echo "\n"; - if (file_exists($_SESSION['switch']['recordings']['dir']."/".$ivr_menu_greet_short)) { - echo " \n"; + if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_greet_short)) { + echo " \n"; } else if (substr($ivr_menu_greet_short, -3) == "wav" || substr($ivr_menu_greet_short, -3) == "mp3") { echo " \n"; @@ -877,9 +877,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { foreach ($recordings as &$row) { $recording_name = $row["recording_name"]; $recording_filename = $row["recording_filename"]; - if ($ivr_menu_invalid_sound == $_SESSION['switch']['recordings']['dir']."/".$recording_filename && strlen($ivr_menu_invalid_sound) > 0) { + if ($ivr_menu_invalid_sound == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && strlen($ivr_menu_invalid_sound) > 0) { $tmp_selected = true; - echo " \n"; + echo " \n"; } else if ($ivr_menu_invalid_sound == $recording_filename && strlen($ivr_menu_invalid_sound) > 0) { $tmp_selected = true; @@ -935,8 +935,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (if_group("superadmin")) { if (!$tmp_selected) { echo "\n"; - if (file_exists($_SESSION['switch']['recordings']['dir']."/".$ivr_menu_invalid_sound)) { - echo " \n"; + if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_invalid_sound)) { + echo " \n"; } else if (substr($ivr_menu_invalid_sound, -3) == "wav" || substr($ivr_menu_invalid_sound, -3) == "mp3") { echo " \n"; @@ -973,9 +973,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { foreach ($recordings as &$row) { $recording_name = $row["recording_name"]; $recording_filename = $row["recording_filename"]; - if ($ivr_menu_exit_sound == $_SESSION['switch']['recordings']['dir']."/".$recording_filename && strlen($ivr_menu_exit_sound) > 0) { + if ($ivr_menu_exit_sound == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && strlen($ivr_menu_exit_sound) > 0) { $tmp_selected = true; - echo " \n"; + echo " \n"; } else if ($ivr_menu_exit_sound == $recording_filename && strlen($ivr_menu_exit_sound) > 0) { $tmp_selected = true; @@ -1031,8 +1031,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (if_group("superadmin")) { if (!$tmp_selected) { echo "\n"; - if (file_exists($_SESSION['switch']['recordings']['dir']."/".$ivr_menu_exit_sound)) { - echo " \n"; + if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$ivr_menu_exit_sound)) { + echo " \n"; } else if (substr($ivr_menu_exit_sound, -3) == "wav" || substr($ivr_menu_exit_sound, -3) == "mp3") { echo " \n"; diff --git a/app/music_on_hold/resources/classes/switch_music_on_hold.php b/app/music_on_hold/resources/classes/switch_music_on_hold.php index 3e3aaf1e01..40bc2ba8e4 100644 --- a/app/music_on_hold/resources/classes/switch_music_on_hold.php +++ b/app/music_on_hold/resources/classes/switch_music_on_hold.php @@ -90,7 +90,7 @@ include "root.php"; } } //recordings - if($dh = opendir($_SESSION['switch']['recordings']['dir']."/")) { + if($dh = opendir($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/")) { $tmp_selected = false; $files = Array(); //$select .= "\n"; diff --git a/app/operator_panel/index.php b/app/operator_panel/index.php index daa77ee8bd..481696d0ba 100644 --- a/app/operator_panel/index.php +++ b/app/operator_panel/index.php @@ -357,7 +357,7 @@ require_once "resources/header.php"; } function get_record_cmd(uuid) { - cmd = "uuid_record " + uuid + " start /archive////" + uuid + ".wav"; + cmd = "uuid_record " + uuid + " start /archive////" + uuid + ".wav"; return cmd; } diff --git a/app/phrases/app_defaults.php b/app/phrases/app_defaults.php index 43f23c3b08..1d707c96b6 100644 --- a/app/phrases/app_defaults.php +++ b/app/phrases/app_defaults.php @@ -109,8 +109,8 @@ if ($domains_processed == 1) { foreach ($result as &$row) { $phrase_detail_uuid = $row['phrase_detail_uuid']; $phrase_detail_data = $row['phrase_detail_data']; - if (substr_count($phrase_detail_data, $_SESSION['switch']['recordings']['dir']) > 0) { - $phrase_detail_data = str_replace($_SESSION['switch']['recordings']['dir'].'/', '', $phrase_detail_data); + if (substr_count($phrase_detail_data, $_SESSION['switch']['recordings']['dir'].'/'.$domain_name) > 0) { + $phrase_detail_data = str_replace($_SESSION['switch']['recordings']['dir'].'/'.$domain_name.'/', '', $phrase_detail_data); } //update function and data to be base64 compatible $phrase_detail_data = "lua(streamfile.lua ".$phrase_detail_data.")"; @@ -141,7 +141,7 @@ if ($domains_processed == 1) { $phrase_detail_data = str_replace('lua(streamfile.lua ', '', $phrase_detail_data); $phrase_detail_data = str_replace(')', '', $phrase_detail_data); if (substr_count($phrase_detail_data, '/') === 0) { - $phrase_detail_data = $_SESSION['switch']['recordings']['dir'].'/'.$phrase_detail_data; + $phrase_detail_data = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name.'/'.$phrase_detail_data; } $sql = "update v_phrase_details set "; $sql .= "phrase_detail_function = 'play-file', "; diff --git a/app/phrases/phrase_edit.php b/app/phrases/phrase_edit.php index 387255a9bb..512bdef71a 100644 --- a/app/phrases/phrase_edit.php +++ b/app/phrases/phrase_edit.php @@ -305,7 +305,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo "opt_group.appendChild(new Option(\"".$row["recording_name"]."\", \"lua(streamfile.lua ".$row["recording_filename"].")\"));\n"; } else { - echo "opt_group.appendChild(new Option(\"".$row["recording_name"]."\", \"".$_SESSION['switch']['recordings']['dir'].'/'.$row["recording_filename"]."\"));\n"; + echo "opt_group.appendChild(new Option(\"".$row["recording_name"]."\", \"".$_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$row["recording_filename"]."\"));\n"; } } echo "obj_action.appendChild(opt_group);\n"; @@ -470,7 +470,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } if ($field['phrase_detail_function'] == 'play-file') { $phrase_detail_function = $text['label-play']; - $phrase_detail_data = str_replace($_SESSION['switch']['recordings']['dir'].'/', '', $field['phrase_detail_data']); + $phrase_detail_data = str_replace($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/', '', $field['phrase_detail_data']); } echo "\n"; echo " ".$phrase_detail_function." \n"; diff --git a/app/recordings/app_defaults.php b/app/recordings/app_defaults.php index 1d2552b251..7e22c12191 100644 --- a/app/recordings/app_defaults.php +++ b/app/recordings/app_defaults.php @@ -25,8 +25,8 @@ */ //if the recordings directory doesn't exist then create it - if (strlen($_SESSION['switch']['recordings']['dir']) > 0) { - if (!is_readable($_SESSION['switch']['recordings']['dir'])) { mkdir($_SESSION['switch']['recordings']['dir'],0777,true); } + if (strlen($_SESSION['switch']['recordings']['dir']."/".$domain_name) > 0) { + if (!is_readable($_SESSION['switch']['recordings']['dir']."/".$domain_name)) { mkdir($_SESSION['switch']['recordings']['dir']."/".$domain_name,0777,true); } } if ($domains_processed == 1) { @@ -45,7 +45,7 @@ if ($domains_processed == 1) { $recording_domain_uuid = $row['domain_uuid']; $recording_filename = $row['recording_filename']; //set recording directory - $recording_directory = $_SESSION['switch']['recordings']['dir']; + $recording_directory = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name; //encode recording file (if exists) if (file_exists($recording_directory.'/'.$recording_filename)) { $recording_base64 = base64_encode(file_get_contents($recording_directory.'/'.$recording_filename)); @@ -78,7 +78,7 @@ if ($domains_processed == 1) { $recording_filename = $row['recording_filename']; $recording_base64 = $row['recording_base64']; //set recording directory - $recording_directory = $_SESSION['switch']['recordings']['dir']; + $recording_directory = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name; //remove local file, if any if (file_exists($recording_directory.'/'.$recording_filename)) { @unlink($recording_directory.'/'.$recording_filename); diff --git a/app/recordings/recording_delete.php b/app/recordings/recording_delete.php index b460300109..9738b8756a 100644 --- a/app/recordings/recording_delete.php +++ b/app/recordings/recording_delete.php @@ -66,8 +66,8 @@ if (strlen($id)>0) { unset($sql); //delete the recording - if (file_exists($_SESSION['switch']['recordings']['dir']."/".$filename)) { - @unlink($_SESSION['switch']['recordings']['dir']."/".$filename); + if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$filename)) { + @unlink($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$filename); } } diff --git a/app/recordings/recording_edit.php b/app/recordings/recording_edit.php index e5d29ce62b..e4b6bc6187 100644 --- a/app/recordings/recording_edit.php +++ b/app/recordings/recording_edit.php @@ -83,7 +83,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (permission_exists('recording_edit')) { //if file name is not the same then rename the file if ($recording_filename != $recording_filename_original) { - rename($_SESSION['switch']['recordings']['dir'].'/'.$recording_filename_original, $_SESSION['switch']['recordings']['dir'].'/'.$recording_filename); + rename($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename_original, $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename); } //update the database with the new data diff --git a/app/recordings/recordings.php b/app/recordings/recordings.php index 97843d156d..c12e09d01e 100644 --- a/app/recordings/recordings.php +++ b/app/recordings/recordings.php @@ -49,7 +49,7 @@ require_once "resources/check_auth.php"; if ($_GET['a'] == "download" && (permission_exists('recording_play') || permission_exists('recording_download'))) { session_cache_limiter('public'); if ($_GET['type'] = "rec") { - $path = $_SESSION['switch']['recordings']['dir']; + $path = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']; //if from recordings, get recording details from db $recording_uuid = check_str($_GET['id']); //recordings @@ -115,7 +115,7 @@ require_once "resources/check_auth.php"; if ($_POST['submit'] == $text['button-upload'] && $_POST['type'] == 'rec' && is_uploaded_file($_FILES['ulfile']['tmp_name'])) { $recording_filename = str_replace(" ", "_", $_FILES['ulfile']['name']); $recording_filename = str_replace("'", "", $recording_filename); - move_uploaded_file($_FILES['ulfile']['tmp_name'], $_SESSION['switch']['recordings']['dir'].'/'.$recording_filename); + move_uploaded_file($_FILES['ulfile']['tmp_name'], $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename); $_SESSION['message'] = $text['message-uploaded'].": ".htmlentities($recording_filename); @@ -146,9 +146,9 @@ require_once "resources/check_auth.php"; $array_base64_exists[$row['recording_uuid']] = ($row['recording_base64'] != '') ? true : false; //if not base64, convert back to local files and remove base64 from db if ($_SESSION['recordings']['storage_type']['text'] != 'base64' && $row['recording_base64'] != '') { - if (!file_exists($_SESSION['switch']['recordings']['dir'].'/'.$row['recording_filename'])) { + if (!file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$row['recording_filename'])) { $recording_decoded = base64_decode($row['recording_base64']); - file_put_contents($_SESSION['switch']['recordings']['dir'].'/'.$row['recording_filename'], $recording_decoded); + file_put_contents($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$row['recording_filename'], $recording_decoded); $sql = "update v_recordings set recording_base64 = null where domain_uuid = '".$domain_uuid."' and recording_uuid = '".$row['recording_uuid']."' "; $db->exec(check_sql($sql)); unset($sql); @@ -158,10 +158,10 @@ require_once "resources/check_auth.php"; unset ($prep_statement); //add recordings to the database - if (is_dir($_SESSION['switch']['recordings']['dir'].'/')) { - if ($dh = opendir($_SESSION['switch']['recordings']['dir'].'/')) { + if (is_dir($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/')) { + if ($dh = opendir($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/')) { while (($recording_filename = readdir($dh)) !== false) { - if (filetype($_SESSION['switch']['recordings']['dir']."/".$recording_filename) == "file") { + if (filetype($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename) == "file") { if (!in_array($recording_filename, $array_recordings)) { //file not found in db, add it @@ -187,7 +187,7 @@ require_once "resources/check_auth.php"; $sql .= "'".$recording_name."', "; $sql .= "'".$recording_description."' "; if ($_SESSION['recordings']['storage_type']['text'] == 'base64') { - $recording_base64 = base64_encode(file_get_contents($_SESSION['switch']['recordings']['dir'].'/'.$recording_filename)); + $recording_base64 = base64_encode(file_get_contents($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename)); $sql .= ", '".$recording_base64."' "; } $sql .= ")"; @@ -199,7 +199,7 @@ require_once "resources/check_auth.php"; if ($_SESSION['recordings']['storage_type']['text'] == 'base64') { $found_recording_uuid = array_search($recording_filename, $array_recordings); if (!$array_base64_exists[$found_recording_uuid]) { - $recording_base64 = base64_encode(file_get_contents($_SESSION['switch']['recordings']['dir'].'/'.$recording_filename)); + $recording_base64 = base64_encode(file_get_contents($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename)); $sql = "update v_recordings set "; $sql .= "recording_base64 = '".$recording_base64."' "; $sql .= "where domain_uuid = '".$domain_uuid."' "; @@ -211,8 +211,8 @@ require_once "resources/check_auth.php"; } //if base64, remove local file - if ($_SESSION['recordings']['storage_type']['text'] == 'base64' && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$recording_filename)) { - @unlink($_SESSION['switch']['recordings']['dir'].'/'.$recording_filename); + if ($_SESSION['recordings']['storage_type']['text'] == 'base64' && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename)) { + @unlink($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename); } } @@ -307,7 +307,7 @@ require_once "resources/check_auth.php"; echo " ".$row['recording_name']."\n"; if ($_SESSION['recordings']['storage_type']['text'] != 'base64') { echo " ".$row['recording_filename']."\n"; - $tmp_filesize = filesize($_SESSION['switch']['recordings']['dir'].'/'.$row['recording_filename']); + $tmp_filesize = filesize($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$row['recording_filename']); $tmp_filesize = byte_convert($tmp_filesize); echo " ".$tmp_filesize."\n"; } diff --git a/app/xml_cdr/v_xml_cdr_import.php b/app/xml_cdr/v_xml_cdr_import.php index 4dfce90452..291389ff27 100644 --- a/app/xml_cdr/v_xml_cdr_import.php +++ b/app/xml_cdr/v_xml_cdr_import.php @@ -219,7 +219,7 @@ $database->fields['domain_name'] = $domain_name; //check whether a recording exists - $recording_relative_path = '/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; + $recording_relative_path = '/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; if (file_exists($_SESSION['switch']['recordings']['dir'].$recording_relative_path.'/'.$uuid.'.wav')) { $recording_file = $recording_relative_path.'/'.$uuid.'.wav'; } diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php index a667148085..e3e076edf9 100644 --- a/app/xml_cdr/xml_cdr.php +++ b/app/xml_cdr/xml_cdr.php @@ -396,7 +396,7 @@ else { //handle recordings if (permission_exists('recording_play') || permission_exists('recording_download')) { - $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$path_mod.'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; + $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$path_mod.'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; $tmp_name = ''; if(!empty($row['recording_file']) && file_exists($row['recording_file'])){ $tmp_name=$row['recording_file']; diff --git a/app/xml_cdr/xml_cdr_delete.php b/app/xml_cdr/xml_cdr_delete.php index 16f8614357..be3de7ac6e 100644 --- a/app/xml_cdr/xml_cdr_delete.php +++ b/app/xml_cdr/xml_cdr_delete.php @@ -54,8 +54,8 @@ if (sizeof($_REQUEST) > 0) { $prep_statement->execute(); unset($sql, $prep_statement); //delete recording, if any - if ($recording_file_path[$index] != '' && file_exists($_SESSION['switch']['recordings']['dir'].base64_decode($recording_file_path[$index]))) { - @unlink($_SESSION['switch']['recordings']['dir'].base64_decode($recording_file_path[$index])); + if ($recording_file_path[$index] != '' && file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].base64_decode($recording_file_path[$index]))) { + @unlink($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].base64_decode($recording_file_path[$index])); } } } diff --git a/app/xml_cdr/xml_cdr_details.php b/app/xml_cdr/xml_cdr_details.php index aca8978688..af95603150 100644 --- a/app/xml_cdr/xml_cdr_details.php +++ b/app/xml_cdr/xml_cdr_details.php @@ -194,7 +194,7 @@ else { //echo " ".$language."\n"; //echo " ".$context."\n"; echo " "; - if (file_exists($_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$uuid.'.wav')) { + if (file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$uuid.'.wav')) { //echo " \n"; //echo " "; @@ -208,7 +208,7 @@ else { } echo " \n"; echo " "; - if (file_exists($_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$uuid.'.wav')) { + if (file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$uuid.'.wav')) { echo " \n"; echo $caller_id_number.' '; echo " "; @@ -276,7 +276,7 @@ else { if ($key == "bridge_uuid" || $key == "signal_bond") { echo " \n"; echo " ".$value." \n"; - $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; + $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; $tmp_name = ''; if (file_exists($tmp_dir.'/'.$value.'.wav')) { $tmp_name = $value.".wav"; @@ -290,12 +290,12 @@ else { elseif (file_exists($tmp_dir.'/'.$value.'_1.mp3')) { $tmp_name = $value."_1.mp3"; } - if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) { + if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) { echo " \n"; echo " play"; echo "  "; } - if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) { + if (strlen($tmp_name) > 0 && file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)) { echo " \n"; echo " download"; echo " "; diff --git a/core/domain_settings/domain_delete.php b/core/domain_settings/domain_delete.php index e65af3bb40..7e544a963a 100644 --- a/core/domain_settings/domain_delete.php +++ b/core/domain_settings/domain_delete.php @@ -176,7 +176,7 @@ if (strlen($id) > 0) { //delete the recordings if (strlen($_SESSION['switch'][recordings]['dir']) > 0) { - system('rm -rf '.$_SESSION['switch']['recordings']['dir'].'/'.$domain_name); + system('rm -rf '.$_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$domain_name); } //delete voicemail diff --git a/core/domain_settings/domain_edit.php b/core/domain_settings/domain_edit.php index a31abb390b..099c563458 100644 --- a/core/domain_settings/domain_edit.php +++ b/core/domain_settings/domain_edit.php @@ -234,8 +234,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } // rename switch/recordings/[domain] (folder) - if ( isset($_SESSION['switch']['recordings']['dir']) ) { - $switch_recordings_dir = str_replace("/".$_SESSION["domain_name"], "", $_SESSION['switch']['recordings']['dir']); + if ( isset($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']) ) { + $switch_recordings_dir = str_replace("/".$_SESSION["domain_name"], "", $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']); if ( file_exists($switch_recordings_dir."/".$original_domain_name) ) { @rename($switch_recordings_dir."/".$original_domain_name, $switch_recordings_dir."/".$domain_name); // folder } diff --git a/resources/install/scripts/app/conference_center/index.lua b/resources/install/scripts/app/conference_center/index.lua index 395db64a75..e9adc15b7e 100644 --- a/resources/install/scripts/app/conference_center/index.lua +++ b/resources/install/scripts/app/conference_center/index.lua @@ -148,6 +148,10 @@ default_language = session:getVariable("default_language"); default_dialect = session:getVariable("default_dialect"); --recording = session:getVariable("recording"); + domain_name = session:getVariable("domain_name"); + + --add the domain name to the recordings directory + recordings_dir = recordings_dir .. "/"..domain_name; --set the end epoch end_epoch = os.time(); @@ -339,6 +343,9 @@ --freeswitch.consoleLog("notice", "[conference center] destination_number: " .. destination_number .. "\n"); --freeswitch.consoleLog("notice", "[conference center] caller_id_number: " .. caller_id_number .. "\n"); + --add the domain name to the recordings directory + recordings_dir = recordings_dir .. "/"..domain_name; + --set the sounds path for the language, dialect and voice default_language = session:getVariable("default_language"); default_dialect = session:getVariable("default_dialect"); @@ -411,10 +418,6 @@ --add the domain to the recording directory freeswitch.consoleLog("notice", "[conference center] domain_count: " .. domain_count .. "\n"); - if (domain_count > 1) then - recordings_dir = recordings_dir.."/"..domain_name; - freeswitch.consoleLog("notice", "[conference center] recordings_dir: " .. recordings_dir .. "\n"); - end --sounds enter_sound = "tone_stream://v=-20;%(100,1000,100);v=-20;%(90,60,440);%(90,60,620)"; diff --git a/resources/install/scripts/app/conference_center/resources/scripts/start_recording.lua b/resources/install/scripts/app/conference_center/resources/scripts/start_recording.lua index b30412451d..047619cadb 100644 --- a/resources/install/scripts/app/conference_center/resources/scripts/start_recording.lua +++ b/resources/install/scripts/app/conference_center/resources/scripts/start_recording.lua @@ -36,10 +36,8 @@ --get the current time start_epoch = os.time(); - --set the recording variable - if (domain_count > 1) then - recordings_dir = recordings_dir.."/"..domain_name; - end + --add the domain name to the recordings directory + recordings_dir = recordings_dir .. "/"..domain_name; recordings_dir = recordings_dir.."/archive/"..os.date("%Y", start_epoch).."/"..os.date("%b", start_epoch).."/"..os.date("%d", start_epoch); mkdir(recordings_dir); recording = recordings_dir.."/"..conference_session_uuid; diff --git a/resources/install/scripts/app/dialplan/index.lua b/resources/install/scripts/app/dialplan/index.lua index fbd3892031..b173b2ca57 100644 --- a/resources/install/scripts/app/dialplan/index.lua +++ b/resources/install/scripts/app/dialplan/index.lua @@ -36,7 +36,6 @@ destination_number = session:getVariable("destination_number"); call_direction = session:getVariable("call_direction"); domain_name = session:getVariable("domain_name"); - recordings_dir = session:getVariable("recordings_dir"); --determine the call direction if (call_direction == nil) then diff --git a/resources/install/scripts/fifo_member.lua b/resources/install/scripts/fifo_member.lua index 54b364db10..c7874b4d2e 100644 --- a/resources/install/scripts/fifo_member.lua +++ b/resources/install/scripts/fifo_member.lua @@ -23,7 +23,6 @@ -- Mark J Crane sounds_dir = ""; -recordings_dir = ""; pin_number = ""; max_tries = "3"; digit_timeout = "3000"; diff --git a/resources/install/scripts/ivr_menu.lua b/resources/install/scripts/ivr_menu.lua index 47b35679ed..24418d531e 100644 --- a/resources/install/scripts/ivr_menu.lua +++ b/resources/install/scripts/ivr_menu.lua @@ -76,10 +76,8 @@ end end ---set the recordings directory - if (domain_count > 1) then - recordings_dir = recordings_dir .. "/"..domain_name; - end +--add the domain name to the recordings directory + recordings_dir = recordings_dir .. "/"..domain_name; --set default variable(s) tries = 0; diff --git a/resources/install/scripts/recordings.lua b/resources/install/scripts/recordings.lua index f03fd0a0d4..540258adfd 100644 --- a/resources/install/scripts/recordings.lua +++ b/resources/install/scripts/recordings.lua @@ -100,6 +100,7 @@ recording_slots = session:getVariable("recording_slots"); recording_prefix = session:getVariable("recording_prefix"); recording_name = session:getVariable("recording_name"); + domain_name = session:getVariable("domain_name"); --select the recording number if (recording_slots) then @@ -256,20 +257,9 @@ if ( session:ready() ) then domain_name = session:getVariable("domain_name"); domain_uuid = session:getVariable("domain_uuid"); - --set the base recordings dir - base_recordings_dir = recordings_dir; + --add the domain name to the recordings directory + recordings_dir = recordings_dir .. "/"..domain_name; - --use the recording_dir when the variable is set - if (session:getVariable("recordings_dir")) then - if (base_recordings_dir ~= session:getVariable("recordings_dir")) then - recordings_dir = session:getVariable("recordings_dir"); - end - end - - --get the recordings from the config.lua and append the domain_name if the system is multi-tenant - if (domain_count > 1) then - recordings_dir = recordings_dir .. "/" .. domain_name; - end --set the sounds path for the language, dialect and voice default_language = session:getVariable("default_language"); default_dialect = session:getVariable("default_dialect"); From dac555f0f7c9b9e166b6301e81719230cbcb9b77 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 13:51:19 -0700 Subject: [PATCH 10/15] Get rid of the abbreviation its recommended to use the full name in the variable unless it makes it really long in order to make the code easier to read and more intuitive. --- app/system/system.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/app/system/system.php b/app/system/system.php index 4c72da3862..78d4facc36 100644 --- a/app/system/system.php +++ b/app/system/system.php @@ -338,37 +338,37 @@ $document['title'] = $text['title-sys-status']; echo " ".$text['title-memcache']."\n"; echo " \n"; - $mc_fail = false; + $memcache_fail = false; $mod = new modules; if ($mod -> active("mod_memcache")) { $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); if ($fp) { $switch_cmd = "memcache status verbose"; $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - $mc_lines = preg_split('/\n/', $switch_result); - foreach($mc_lines as $mc_line) { - if (strlen(trim($mc_line)) > 0 && substr_count($mc_line, ': ') > 0) { - $mc_temp = explode(': ', $mc_line); - $mc_status[$mc_temp[0]] = $mc_temp[1]; + $memcache_lines = preg_split('/\n/', $switch_result); + foreach($memcache_lines as $memcache_line) { + if (strlen(trim($memcache_line)) > 0 && substr_count($memcache_line, ': ') > 0) { + $memcache_temp = explode(': ', $memcache_line); + $memcache_status[$memcache_temp[0]] = $memcache_temp[1]; } } - if (is_array($mc_status) && sizeof($mc_status) > 0) { - foreach($mc_status as $mc_field => $mc_value) { + if (is_array($memcache_status) && sizeof($memcache_status) > 0) { + foreach($memcache_status as $memcache_field => $memcache_value) { echo "\n"; - echo " ".$mc_field."\n"; - echo " ".$mc_value."\n"; + echo " ".$memcache_field."\n"; + echo " ".$memcache_value."\n"; echo "\n"; } } - else { $mc_fail = true; } + else { $memcache_fail = true; } } - else { $mc_fail = true; } + else { $memcache_fail = true; } } - else { $mc_fail = true; } + else { $memcache_fail = true; } - if ($mc_fail) { + if ($memcache_fail) { echo "\n"; echo " ".$text['label-memcache_status']."\n"; echo " ".$text['message-unavailable']."\n"; From 261c5d50cb3f0aa7a1684b4aa2887098aba757a7 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 13:57:56 -0700 Subject: [PATCH 11/15] Add missing translation labels and remove the quotes arounds the GIT values. --- app/system/app_languages.php | 48 +++++++++++++++++++++++++++++------- app/system/system.php | 8 +++--- 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/app/system/app_languages.php b/app/system/app_languages.php index e367817dea..495304b133 100644 --- a/app/system/app_languages.php +++ b/app/system/app_languages.php @@ -80,15 +80,45 @@ $text['label-os']['sv-se'] = "Operativsystem"; $text['label-os']['uk'] = "Операційна система "; $text['label-os']['de-at'] = "Betriebssystem"; -$text['label-git-info']['en-us'] = "Git Information"; -$text['label-git-info']['es-cl'] = ""; -$text['label-git-info']['pt-pt'] = ""; -$text['label-git-info']['fr-fr'] = ""; -$text['label-git-info']['pt-br'] = ""; -$text['label-git-info']['pl'] = ""; -$text['label-git-info']['sv-se'] = ""; -$text['label-git-info']['uk'] = ""; -$text['label-git-info']['de-at'] = ""; +$text['label-git_info']['en-us'] = "Git Information"; +$text['label-git_info']['es-cl'] = ""; +$text['label-git_info']['pt-pt'] = ""; +$text['label-git_info']['fr-fr'] = ""; +$text['label-git_info']['pt-br'] = ""; +$text['label-git_info']['pl'] = ""; +$text['label-git_info']['sv-se'] = ""; +$text['label-git_info']['uk'] = ""; +$text['label-git_info']['de-at'] = ""; + +$text['label-git_branch']['en-us'] = "Branch"; +$text['label-git_branch']['es-cl'] = ""; +$text['label-git_branch']['pt-pt'] = ""; +$text['label-git_branch']['fr-fr'] = ""; +$text['label-git_branch']['pt-br'] = ""; +$text['label-git_branch']['pl'] = ""; +$text['label-git_branch']['sv-se'] = ""; +$text['label-git_branch']['uk'] = ""; +$text['label-git_branch']['de-at'] = ""; + +$text['label-git_commit']['en-us'] = "Commit"; +$text['label-git_commit']['es-cl'] = ""; +$text['label-git_commit']['pt-pt'] = ""; +$text['label-git_commit']['fr-fr'] = ""; +$text['label-git_commit']['pt-br'] = ""; +$text['label-git_commit']['pl'] = ""; +$text['label-git_commit']['sv-se'] = ""; +$text['label-git_commit']['uk'] = ""; +$text['label-git_commit']['de-at'] = ""; + +$text['label-git_origin']['en-us'] = "Origin"; +$text['label-git_origin']['es-cl'] = ""; +$text['label-git_origin']['pt-pt'] = ""; +$text['label-git_origin']['fr-fr'] = ""; +$text['label-git_origin']['pt-br'] = ""; +$text['label-git_origin']['pl'] = ""; +$text['label-git_origin']['sv-se'] = ""; +$text['label-git_origin']['uk'] = ""; +$text['label-git_origin']['de-at'] = ""; $text['label-memcache_status']['en-us'] = "Memcache Status"; $text['label-memcache_status']['es-cl'] = "Estado de Memcache"; diff --git a/app/system/system.php b/app/system/system.php index 78d4facc36..59a42528b7 100644 --- a/app/system/system.php +++ b/app/system/system.php @@ -94,12 +94,12 @@ $document['title'] = $text['title-sys-status']; rtrim($git_commit); echo "\n"; echo " \n"; - echo " ".$text['label-git-info']."\n"; + echo " ".$text['label-git_info']."\n"; echo " \n"; echo " \n"; - echo " Branch: '$git_branch'
\n"; - echo " Commit: '$git_commit'
\n"; - echo " Origin: '$git_origin'
\n"; + echo " ".$text['label-git_branch']." ".$git_branch."
\n"; + echo " ".$text['label-git_commit']." ".$git_commit."
\n"; + echo " ".$text['label-git_origin']." ".$git_origin."
\n"; echo " \n"; echo "\n"; From 60e821ba3ab16bcb633636c1adb1abcc0e8ba252 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 14:01:05 -0700 Subject: [PATCH 12/15] Add the semi colon to the GIT labels. --- app/system/app_languages.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/system/app_languages.php b/app/system/app_languages.php index 495304b133..f7a67d4e6c 100644 --- a/app/system/app_languages.php +++ b/app/system/app_languages.php @@ -90,7 +90,7 @@ $text['label-git_info']['sv-se'] = ""; $text['label-git_info']['uk'] = ""; $text['label-git_info']['de-at'] = ""; -$text['label-git_branch']['en-us'] = "Branch"; +$text['label-git_branch']['en-us'] = "Branch:"; $text['label-git_branch']['es-cl'] = ""; $text['label-git_branch']['pt-pt'] = ""; $text['label-git_branch']['fr-fr'] = ""; @@ -100,7 +100,7 @@ $text['label-git_branch']['sv-se'] = ""; $text['label-git_branch']['uk'] = ""; $text['label-git_branch']['de-at'] = ""; -$text['label-git_commit']['en-us'] = "Commit"; +$text['label-git_commit']['en-us'] = "Commit:"; $text['label-git_commit']['es-cl'] = ""; $text['label-git_commit']['pt-pt'] = ""; $text['label-git_commit']['fr-fr'] = ""; @@ -110,7 +110,7 @@ $text['label-git_commit']['sv-se'] = ""; $text['label-git_commit']['uk'] = ""; $text['label-git_commit']['de-at'] = ""; -$text['label-git_origin']['en-us'] = "Origin"; +$text['label-git_origin']['en-us'] = "Origin:"; $text['label-git_origin']['es-cl'] = ""; $text['label-git_origin']['pt-pt'] = ""; $text['label-git_origin']['fr-fr'] = ""; From bc9d6bc8382b345050a5802e3738f1836b26fe17 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 14:19:18 -0700 Subject: [PATCH 13/15] Commenting Advanced -> Install menu until its reason developer that added the menu explains its purpose. --- core/install/app_config.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/install/app_config.php b/core/install/app_config.php index a65a67c8bc..aa400f46cb 100644 --- a/core/install/app_config.php +++ b/core/install/app_config.php @@ -19,10 +19,10 @@ $apps[$x]['description']['pt-br'] = ""; //permission details - $y = 0; - $apps[$x]['permissions'][$y]['name'] = "install"; - $apps[$x]['permissions'][$y]['menu']['uuid'] = "75507e6e-891e-11e5-af63-feff819cdc9f"; - $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; - $y++; + //$y = 0; + //$apps[$x]['permissions'][$y]['name'] = "install"; + //$apps[$x]['permissions'][$y]['menu']['uuid'] = "75507e6e-891e-11e5-af63-feff819cdc9f"; + //$apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + //$y++; ?> \ No newline at end of file From 0d20cb3ffcd77086e4b825495654a8b40de0b95b Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 14:21:36 -0700 Subject: [PATCH 14/15] Last commit commented out the permission this comments out the menu. --- core/install/app_menu.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/install/app_menu.php b/core/install/app_menu.php index e76450bd70..78831564c0 100644 --- a/core/install/app_menu.php +++ b/core/install/app_menu.php @@ -1,10 +1,10 @@ \ No newline at end of file From 48e76a726cfcd7d93121989f3ac02e31f3a43a0b Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sun, 6 Dec 2015 14:53:20 -0700 Subject: [PATCH 15/15] Correct the provision time zone variables used in the t48g template. --- resources/templates/provision/yealink/t48g/{$mac}.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/templates/provision/yealink/t48g/{$mac}.cfg b/resources/templates/provision/yealink/t48g/{$mac}.cfg index c9387f2da9..101b2090f6 100644 --- a/resources/templates/provision/yealink/t48g/{$mac}.cfg +++ b/resources/templates/provision/yealink/t48g/{$mac}.cfg @@ -924,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = ${time_zone} -local_time.time_zone_name = ${time_zone_name} +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} #######################################################################################