Change $setting to $settings (#7318)

* Change $setting to $settings

* Update app_defaults.php

* Update fax_queue.php

* Update xml_cdr.php

* Update email_queue.php

* Update transcribe.php

* Update send.php

* Update fax_queue.php

* Update fax_send.php

* Update app_defaults.php

* Update email_queue.php

* Update app_defaults.php

* Update app_defaults.php

* Update app_defaults.php

* Update app_defaults.php

* Update app_defaults.php

* Update app_defaults.php

* Update app_defaults.php

* Update app_defaults.php

* Update app_defaults.php

* Update app_defaults.php

* Update app_defaults.php
This commit is contained in:
Alex 2025-03-14 15:19:49 -07:00 committed by GitHub
parent 7639f0755c
commit 1e96df6e95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 117 additions and 139 deletions

View File

@ -33,7 +33,7 @@
if ($num_rows == 0) { if ($num_rows == 0) {
//set the directory //set the directory
$xml_dir = $setting->get('switch','conf').'/autoload_configs'; $xml_dir = $settings->get('switch','conf').'/autoload_configs';
$xml_file = $xml_dir."/acl.conf.xml"; $xml_file = $xml_dir."/acl.conf.xml";
$xml_file_alt = $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/app/switch/resources/conf/autoload_configs/acl.conf'; $xml_file_alt = $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/app/switch/resources/conf/autoload_configs/acl.conf';

View File

@ -93,8 +93,8 @@ if ($domains_processed == 1) {
//add the recording path if needed //add the recording path if needed
if ($row['queue_greeting'] != '') { if ($row['queue_greeting'] != '') {
if (file_exists($setting->get('switch','recordings').'/'.$row['domain_name'].'/'.$row['queue_greeting'])) { if (file_exists($settings->get('switch','recordings').'/'.$row['domain_name'].'/'.$row['queue_greeting'])) {
$queue_greeting_path = $setting->get('switch','recordings').'/'.$row['domain_name'].'/'.$row['queue_greeting']; $queue_greeting_path = $settings->get('switch','recordings').'/'.$row['domain_name'].'/'.$row['queue_greeting'];
} }
else { else {
$queue_greeting_path = trim($row['queue_greeting']); $queue_greeting_path = trim($row['queue_greeting']);

View File

@ -32,7 +32,7 @@
if ($num_rows == 0) { if ($num_rows == 0) {
//set the directory //set the directory
$xml_dir = $setting->get('switch','conf').'/autoload_configs'; $xml_dir = $settings->get('switch','conf').'/autoload_configs';
$xml_file = $xml_dir."/conference.conf"; $xml_file = $xml_dir."/conference.conf";
$xml_file_alt = $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/app/switch/resources/conf/autoload_configs/conference.conf'; $xml_file_alt = $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/app/switch/resources/conf/autoload_configs/conference.conf';

View File

@ -32,7 +32,7 @@
if ($num_rows == 0) { if ($num_rows == 0) {
//set the directory //set the directory
$xml_dir = $setting->get('switch','conf').'/autoload_configs'; $xml_dir = $settings->get('switch','conf').'/autoload_configs';
$xml_file = $xml_dir."/conference.conf"; $xml_file = $xml_dir."/conference.conf";
$xml_file_alt = $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/app/switch/resources/conf/autoload_configs/conference.conf'; $xml_file_alt = $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/app/switch/resources/conf/autoload_configs/conference.conf';

View File

@ -143,7 +143,7 @@
//add not found dialplan to inbound routes //add not found dialplan to inbound routes
/* /*
if ($domains_processed == 1) { if ($domains_processed == 1) {
if (is_readable($setting->get('switch','dialplan'))) { if (is_readable($settings->get('switch','dialplan'))) {
$sql = "select count(*) from v_dialplans "; $sql = "select count(*) from v_dialplans ";
$sql .= "where dialplan_uuid = 'ea5339de-1982-46ca-9695-c35176165314' "; $sql .= "where dialplan_uuid = 'ea5339de-1982-46ca-9695-c35176165314' ";
$num_rows = $database->select($sql, null, 'column'); $num_rows = $database->select($sql, null, 'column');

View File

@ -153,10 +153,9 @@
unset($parameters); unset($parameters);
//get the email queue settings //get the email queue settings
$setting = new settings(["domain_uuid" => $domain_uuid]); $smtp_from = $settings->get('email', 'smtp_from');
$smtp_from = $setting->get('email', 'smtp_from'); $smtp_from_name = $settings->get('email', 'smtp_from_name', $smtp_from);
$smtp_from_name = $setting->get('email', 'smtp_from_name', $smtp_from); $save_response = $settings->get('email_queue', 'save_response');
$save_response = $setting->get('email_queue', 'save_response');
//debug information //debug information
if (!empty($debug) && $debug == 'true') { if (!empty($debug) && $debug == 'true') {

View File

@ -9,16 +9,16 @@ if (!function_exists('transcribe')) {
} }
//get the email queue settings //get the email queue settings
$setting = new settings(['category' => 'voicemail']); $settings = new settings(['category' => 'voicemail']);
//transcription variables //transcription variables
$transcribe_provider = $setting->get('voicemail', 'transcribe_provider'); $transcribe_provider = $settings->get('voicemail', 'transcribe_provider');
$transcribe_language = $setting->get('voicemail', 'transcribe_language'); $transcribe_language = $settings->get('voicemail', 'transcribe_language');
//transcribe - watson //transcribe - watson
if ($transcribe_provider == 'watson') { if ($transcribe_provider == 'watson') {
$api_key = $setting->get('voicemail', 'watson_key'); $api_key = $settings->get('voicemail', 'watson_key');
$api_url = $setting->get('voicemail', 'watson_url'); $api_url = $settings->get('voicemail', 'watson_url');
if ($file_extension == "mp3") { if ($file_extension == "mp3") {
$content_type = 'audio/mp3'; $content_type = 'audio/mp3';
@ -29,7 +29,7 @@ if (!function_exists('transcribe')) {
if (isset($api_key) && $api_key != '') { if (isset($api_key) && $api_key != '') {
//start output buffer //start output buffer
ob_start(); ob_start();
$out = fopen('php://output', 'w'); $out = fopen('php://output', 'w');
//create the curl resource //create the curl resource
@ -118,11 +118,11 @@ if (!function_exists('transcribe')) {
//transcribe - google //transcribe - google
if ($transcribe_provider == 'google') { if ($transcribe_provider == 'google') {
$api_key = $setting->get('voicemail', 'google_key'); $api_key = $settings->get('voicemail', 'google_key');
$api_url = $setting->get('voicemail', 'google_url'); $api_url = $settings->get('voicemail', 'google_url');
$application_credentials = $setting->get('voicemail', 'google_application_credentials'); $application_credentials = $settings->get('voicemail', 'google_application_credentials');
$transcribe_language = $setting->get('voicemail', 'transcribe_language'); $transcribe_language = $settings->get('voicemail', 'transcribe_language');
$transcribe_alternate_language = $setting->get('voicemail', 'transcribe_alternate_language'); $transcribe_alternate_language = $settings->get('voicemail', 'transcribe_alternate_language');
if (!isset($transcribe_language) && empty($transcribe_language)) { if (!isset($transcribe_language) && empty($transcribe_language)) {
$transcribe_language = 'en-US'; $transcribe_language = 'en-US';
@ -136,7 +136,7 @@ if (!function_exists('transcribe')) {
if ($file_extension == "wav") { if ($file_extension == "wav") {
$content_type = 'audio/wav'; $content_type = 'audio/wav';
} }
//version 1 //version 1
if (substr($api_url, 0, 32) == 'https://speech.googleapis.com/v1') { if (substr($api_url, 0, 32) == 'https://speech.googleapis.com/v1') {
if (isset($api_key) && $api_key != '') { if (isset($api_key) && $api_key != '') {
@ -195,8 +195,8 @@ if (!function_exists('transcribe')) {
//transcribe - azure //transcribe - azure
if ($transcribe_provider == 'azure') { if ($transcribe_provider == 'azure') {
$api_key = $setting->get('voicemail', 'azure_key'); $api_key = $settings->get('voicemail', 'azure_key');
$api_url = $setting->get('voicemail', 'azure_server_region'); $api_url = $settings->get('voicemail', 'azure_server_region');
if (empty($transcribe_language)) { if (empty($transcribe_language)) {
$transcribe_language = 'en-US'; $transcribe_language = 'en-US';
@ -241,8 +241,8 @@ if (!function_exists('transcribe')) {
// transcribe - custom // transcribe - custom
// Works with self-hostable transcription service at https://github.com/AccelerateNetworks/an-transcriptions // Works with self-hostable transcription service at https://github.com/AccelerateNetworks/an-transcriptions
if ($transcribe_provider == 'custom') { if ($transcribe_provider == 'custom') {
$api_key = $setting->get('voicemail', 'api_key'); $api_key = $settings->get('voicemail', 'api_key');
$api_url = $setting->get('voicemail', 'transcription_server'); $api_url = $settings->get('voicemail', 'transcription_server');
if (empty($transcribe_language)) { if (empty($transcribe_language)) {
$transcribe_language = 'en-US'; $transcribe_language = 'en-US';
@ -322,9 +322,9 @@ if (!function_exists('transcribe')) {
// openai_url // openai_url
// openai_model // openai_model
if ($transcribe_provider == 'openai') { if ($transcribe_provider == 'openai') {
$api_key = $setting->get('voicemail', 'openai_key'); $api_key = $settings->get('voicemail', 'openai_key');
$api_url = $setting->get('voicemail', 'openai_url'); $api_url = $settings->get('voicemail', 'openai_url');
$api_voice_model = $setting->get('voicemail', 'openai_model'); $api_voice_model = $settings->get('voicemail', 'openai_model');
if (empty($api_url)) { if (empty($api_url)) {
$api_url = "https://api.openai.com/v1/audio/transcriptions"; $api_url = "https://api.openai.com/v1/audio/transcriptions";
@ -339,7 +339,7 @@ if (!function_exists('transcribe')) {
$full_file_name = $file_path.'/'.$file_name ; $full_file_name = $file_path.'/'.$file_name ;
//start output buffer //start output buffer
ob_start(); ob_start();
$out = fopen('php://output', 'w'); $out = fopen('php://output', 'w');
//create the curl resource //create the curl resource
@ -366,7 +366,7 @@ if (!function_exists('transcribe')) {
//execute the curl with the options //execute the curl with the options
$http_content = curl_exec($ch); $http_content = curl_exec($ch);
//return the error //return the error
if (curl_errno($ch)) { if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch); echo 'Error:' . curl_error($ch);
@ -380,9 +380,9 @@ if (!function_exists('transcribe')) {
$debug = ob_get_clean(); $debug = ob_get_clean();
echo $debug; echo $debug;
$ob = json_decode($http_content, true); $ob = json_decode($http_content, true);
$message = $ob['text']; $message = $ob['text'];
return array( return array(
'provider' => $transcribe_provider, 'provider' => $transcribe_provider,
@ -396,5 +396,5 @@ if (!function_exists('transcribe')) {
} }
} }
?> ?>

View File

@ -69,11 +69,8 @@
exit; exit;
} }
//get the email queue settings
$setting = new settings(["category" => "email_queue"]);
//email queue enabled //email queue enabled
if ($setting->get('email_queue', 'enabled') != 'true') { if ($settings->get('email_queue', 'enabled') != 'true') {
echo "Email Queue is disabled in Default Settings\n"; echo "Email Queue is disabled in Default Settings\n";
exit; exit;
} }
@ -102,20 +99,20 @@
} }
//get the call center settings //get the call center settings
$interval = $setting->get('email_queue', 'interval'); $interval = $settings->get('email_queue', 'interval');
//set the defaults //set the defaults
if (!is_numeric($interval)) { $interval = 30; } if (!is_numeric($interval)) { $interval = 30; }
//set the email queue limit //set the email queue limit
if (!empty($setting->get('email_queue', 'limit'))) { if (!empty($settings->get('email_queue', 'limit'))) {
$email_queue_limit = $setting->get('email_queue', 'limit'); $email_queue_limit = $settings->get('email_queue', 'limit');
} }
else { else {
$email_queue_limit = '30'; $email_queue_limit = '30';
} }
if (!empty($setting->get('email_queue', 'debug'))) { if (!empty($settings->get('email_queue', 'debug'))) {
$debug = $setting->get('email_queue', 'debug'); $debug = $settings->get('email_queue', 'debug');
} }
//get the messages waiting in the email queue //get the messages waiting in the email queue

View File

@ -82,11 +82,8 @@
exit; exit;
} }
//get the email queue settings
$setting = new settings(["category" => "email_queue"]);
//email queue enabled //email queue enabled
if ($setting->get('email_queue', 'enabled') != 'true') { if ($settings->get('email_queue', 'enabled') != 'true') {
echo "Email Queue is disabled in Default Settings\n"; echo "Email Queue is disabled in Default Settings\n";
exit; exit;
} }
@ -115,20 +112,20 @@
} }
//get the call center settings //get the call center settings
$interval = $setting->get('email_queue', 'interval'); $interval = $settings->get('email_queue', 'interval');
//set the defaults //set the defaults
if (!is_numeric($interval)) { $interval = 30; } if (!is_numeric($interval)) { $interval = 30; }
//set the email queue limit //set the email queue limit
if (!empty($setting->get('email_queue', 'limit'))) { if (!empty($settings->get('email_queue', 'limit'))) {
$email_queue_limit = $setting->get('email_queue', 'limit'); $email_queue_limit = $settings->get('email_queue', 'limit');
} }
else { else {
$email_queue_limit = '30'; $email_queue_limit = '30';
} }
if (!empty($setting->get('email_queue', 'debug'))) { if (!empty($settings->get('email_queue', 'debug'))) {
$debug = $setting->get('email_queue', 'debug'); $debug = $settings->get('email_queue', 'debug');
} }
//get the messages waiting in the email queue //get the messages waiting in the email queue

View File

@ -28,9 +28,9 @@
if ($domains_processed == 1) { if ($domains_processed == 1) {
//create the directory //create the directory
if (!empty($setting->get('switch','extensions'))) { if (!empty($settings->get('switch','extensions'))) {
if (!is_dir($setting->get('switch','extensions'))) { if (!is_dir($settings->get('switch','extensions'))) {
mkdir($setting->get('switch','extensions'), 0770, false); mkdir($settings->get('switch','extensions'), 0770, false);
} }
} }
@ -106,4 +106,4 @@
} }
?> ?>

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2015-2024 Portions created by the Initial Developer are Copyright (C) 2015-2025
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -78,37 +78,34 @@ if (!empty($result) && @sizeof($result) != 0) {
$fax_accountcode = $row["accountcode"]; $fax_accountcode = $row["accountcode"];
$fax_toll_allow = $row["fax_toll_allow"]; $fax_toll_allow = $row["fax_toll_allow"];
//get event socket connection parameters
$setting = new settings(["database" => $database, "domain_uuid" => $domain_uuid]);
//send the domain name to the command line output //send the domain name to the command line output
if (!empty($fax_email_connection_host) && !empty($fax_email_connection_username)) { if (!empty($fax_email_connection_host) && !empty($fax_email_connection_username)) {
echo "Domain Name: ".$domain_name."\n"; echo "Domain Name: ".$domain_name."\n";
} }
//get the cover font //get the cover font
$fax_cover_font_default =$setting->get('fax','cover_font'); $fax_cover_font_default =$settings->get('fax','cover_font');
$fax_cover_font = $setting->get('fax','cover_font'); $fax_cover_font = $settings->get('fax','cover_font');
if(empty($fax_cover_font)) { if(empty($fax_cover_font)) {
$fax_cover_font = $fax_cover_font_default; $fax_cover_font = $fax_cover_font_default;
} }
//get the allowed file extensions //get the allowed file extensions
$fax_allowed_extension_default = arr_to_map($setting->get('fax','allowed_extension')); $fax_allowed_extension_default = arr_to_map($settings->get('fax','allowed_extension'));
if($fax_allowed_extension_default == false){ if($fax_allowed_extension_default == false){
$tmp = array('.pdf', '.tiff', '.tif'); $tmp = array('.pdf', '.tiff', '.tif');
$fax_allowed_extension_default = arr_to_map($tmp); $fax_allowed_extension_default = arr_to_map($tmp);
} }
$fax_allowed_extension = arr_to_map($setting->get('fax','allowed_extension')); $fax_allowed_extension = arr_to_map($settings->get('fax','allowed_extension'));
if($fax_allowed_extension == false) { if($fax_allowed_extension == false) {
$fax_allowed_extension = $fax_allowed_extension_default; $fax_allowed_extension = $fax_allowed_extension_default;
} }
//set needed variables //set needed variables
$fax_page_size = $setting->get('fax','page_size'); $fax_page_size = $settings->get('fax','page_size');
$fax_resolution = $setting->get('fax','resolution'); $fax_resolution = $settings->get('fax','resolution');
$fax_header = $setting->get('fax','cover_header'); $fax_header = $settings->get('fax','cover_header');
$fax_footer = $setting->get('fax','cover_footer'); $fax_footer = $settings->get('fax','cover_footer');
$fax_sender = $fax_caller_id_name; $fax_sender = $fax_caller_id_name;
//open account connection //open account connection
@ -221,7 +218,7 @@ if (!empty($result) && @sizeof($result) != 0) {
} }
// set fax directory (used for pdf creation - cover and/or attachments) // set fax directory (used for pdf creation - cover and/or attachments)
$fax_dir = $setting->get('switch','storage').'/fax'.(($domain_name != '') ? '/'.$domain_name : null); $fax_dir = $settings->get('switch','storage').'/fax'.(($domain_name != '') ? '/'.$domain_name : null);
//handle attachments (if any) //handle attachments (if any)
$emailed_files = Array(); $emailed_files = Array();

View File

@ -56,31 +56,28 @@
return $exists; return $exists;
} }
//get the email queue settings
$setting = new settings(["category" => "fax_queue"]);
//set the fax queue interval //set the fax queue interval
if (!empty($setting->get('fax_queue', 'interval'))) { if (!empty($settings->get('fax_queue', 'interval'))) {
$fax_queue_interval = $setting->get('fax_queue', 'interval'); $fax_queue_interval = $settings->get('fax_queue', 'interval');
} }
else { else {
$fax_queue_interval = '30'; $fax_queue_interval = '30';
} }
//set the fax queue limit //set the fax queue limit
if (!empty($setting->get('fax_queue', 'limit'))) { if (!empty($settings->get('fax_queue', 'limit'))) {
$fax_queue_limit = $setting->get('fax_queue', 'limit'); $fax_queue_limit = $settings->get('fax_queue', 'limit');
} }
else { else {
$fax_queue_limit = '30'; $fax_queue_limit = '30';
} }
if (!empty($setting->get('fax_queue', 'debug'))) { if (!empty($settings->get('fax_queue', 'debug'))) {
$debug = $setting->get('fax_queue', 'debug'); $debug = $settings->get('fax_queue', 'debug');
} }
//set the fax queue retry interval //set the fax queue retry interval
if (!empty($setting->get('fax_queue', 'retry_interval'))) { if (!empty($settings->get('fax_queue', 'retry_interval'))) {
$fax_retry_interval = $setting->get('fax_queue', 'retry_interval'); $fax_retry_interval = $settings->get('fax_queue', 'retry_interval');
} }
else { else {
$fax_retry_interval = '180'; $fax_retry_interval = '180';

View File

@ -184,22 +184,19 @@
} }
unset($parameters); unset($parameters);
//get the email queue settings
$setting = new settings(["domain_uuid" => $domain_uuid]);
//prepare the smtp from and from name variables //prepare the smtp from and from name variables
$email_from = $setting->get('fax','smtp_from'); $email_from = $settings->get('fax','smtp_from');
$email_from_name = $setting->get('fax','smtp_from_name'); $email_from_name = $settings->get('fax','smtp_from_name');
if (empty($email_from)) { if (empty($email_from)) {
$email_from = $setting->get('email','smtp_from'); $email_from = $settings->get('email','smtp_from');
} }
if (empty($email_from_name)) { if (empty($email_from_name)) {
$email_from_name = $setting->get('email','smtp_from_name'); $email_from_name = $settings->get('email','smtp_from_name');
} }
//prepare the variables to send the fax //prepare the variables to send the fax
$email_from_address = $email_from; $email_from_address = $email_from;
$retry_limit = $setting->get('fax_queue','retry_limit'); $retry_limit = $settings->get('fax_queue','retry_limit');
//prepare the fax retry count //prepare the fax retry count
if (!isset($fax_retry_count)) { if (!isset($fax_retry_count)) {
@ -252,7 +249,7 @@
if ($fax_retry_count == 0) { if ($fax_retry_count == 0) {
//use default settings or domain settings (defaults to t38) //use default settings or domain settings (defaults to t38)
$fax_options = ''; $fax_options = '';
foreach($setting->get('fax','variable') as $variable) { foreach($settings->get('fax','variable') as $variable) {
$fax_options .= $variable.","; $fax_options .= $variable.",";
} }
} }
@ -283,7 +280,7 @@
else { else {
//try the user definable method again //try the user definable method again
$fax_options = ''; $fax_options = '';
foreach($setting->get('fax','variable') as $variable) { foreach($settings->get('fax','variable') as $variable) {
$fax_options .= $variable.","; $fax_options .= $variable.",";
} }
} }
@ -298,7 +295,7 @@
//check to see if the destination number is local //check to see if the destination number is local
$local_destination = false; $local_destination = false;
if ($setting->get('fax_queue','prefer_local', false)) { if ($settings->get('fax_queue','prefer_local', false)) {
$sql = "select count(destination_uuid) "; $sql = "select count(destination_uuid) ";
$sql .= "from v_destinations "; $sql .= "from v_destinations ";
$sql .= "where ("; $sql .= "where (";
@ -463,7 +460,7 @@
//send the email //send the email
if (!empty($fax_email_address) && file_exists($fax_file)) { if (!empty($fax_email_address) && file_exists($fax_file)) {
//get the language code //get the language code
$language_code = $setting->get('domain','language'); $language_code = $settings->get('domain','language');
//get the template subcategory //get the template subcategory
if (isset($fax_relay) && $fax_relay == 'true') { if (isset($fax_relay) && $fax_relay == 'true') {

View File

@ -103,31 +103,28 @@
file_put_contents($pid_file, getmypid()); file_put_contents($pid_file, getmypid());
} }
//get the fax queue settings
$setting = new settings(["category" => "fax_queue"]);
//set the fax queue interval //set the fax queue interval
if (!empty($setting->get('fax_queue', 'interval'))) { if (!empty($settings->get('fax_queue', 'interval'))) {
$fax_queue_interval = $setting->get('fax_queue', 'interval'); $fax_queue_interval = $settings->get('fax_queue', 'interval');
} }
else { else {
$fax_queue_interval = '30'; $fax_queue_interval = '30';
} }
//set the fax queue limit //set the fax queue limit
if (!empty($setting->get('fax_queue', 'limit'))) { if (!empty($settings->get('fax_queue', 'limit'))) {
$fax_queue_limit = $setting->get('fax_queue', 'limit'); $fax_queue_limit = $settings->get('fax_queue', 'limit');
} }
else { else {
$fax_queue_limit = '30'; $fax_queue_limit = '30';
} }
if (!empty($setting->get('fax_queue', 'debug'))) { if (!empty($settings->get('fax_queue', 'debug'))) {
$debug = $setting->get('fax_queue', 'debug'); $debug = $settings->get('fax_queue', 'debug');
} }
//set the fax queue retry interval //set the fax queue retry interval
if (!empty($setting->get('fax_queue', 'retry_interval'))) { if (!empty($settings->get('fax_queue', 'retry_interval'))) {
$fax_retry_interval = $setting->get('fax_queue', 'retry_interval'); $fax_retry_interval = $settings->get('fax_queue', 'retry_interval');
} }
else { else {
$fax_retry_interval = '180'; $fax_retry_interval = '180';

View File

@ -57,8 +57,8 @@
unset($sql, $modules, $index, $row); unset($sql, $modules, $index, $row);
//use the module class to get the list of modules from the db and add any missing modules //use the module class to get the list of modules from the db and add any missing modules
if (!empty($setting->get('switch','mod'))) { if (!empty($settings->get('switch','mod'))) {
$module->dir = $setting->get('switch','mod'); $module->dir = $settings->get('switch','mod');
$module->get_modules(); $module->get_modules();
$module->synch(); $module->synch();
$module->xml(); $module->xml();

View File

@ -27,13 +27,13 @@
if ($domains_processed == 1) { if ($domains_processed == 1) {
//set the directory //set the directory
if (!empty($setting->get('switch','conf'))) { if (!empty($settings->get('switch','conf'))) {
$xml_dir = $setting->get('switch','conf').'/autoload_configs'; $xml_dir = $settings->get('switch','conf').'/autoload_configs';
$xml_file = $xml_dir."/local_stream.conf"; $xml_file = $xml_dir."/local_stream.conf";
} }
//rename the file //rename the file
if (!empty($setting->get('switch','conf'))) { if (!empty($settings->get('switch','conf'))) {
if (file_exists($xml_dir.'/local_stream.conf.xml')) { if (file_exists($xml_dir.'/local_stream.conf.xml')) {
rename($xml_dir.'/local_stream.conf', $xml_dir.'/'.$xml_file); rename($xml_dir.'/local_stream.conf', $xml_dir.'/'.$xml_file);
} }
@ -43,7 +43,7 @@ if ($domains_processed == 1) {
} }
//add the music_on_hold list to the database //add the music_on_hold list to the database
if (!empty($setting->get('switch','conf'))) { if (!empty($settings->get('switch','conf'))) {
$sql = "select count(music_on_hold_uuid) from v_music_on_hold; "; $sql = "select count(music_on_hold_uuid) from v_music_on_hold; ";
$num_rows = $database->select($sql, null, 'column'); $num_rows = $database->select($sql, null, 'column');
unset($sql); unset($sql);

View File

@ -45,9 +45,9 @@
} }
//check for existing configuration //check for existing configuration
if (!empty($setting->get('switch','conf')) && file_exists($setting->get('switch','conf')."/autoload_configs/translate.conf.xml")) { if (!empty($settings->get('switch','conf')) && file_exists($settings->get('switch','conf')."/autoload_configs/translate.conf.xml")) {
//import existing data //import existing data
$xml = file_get_contents($setting->get('switch','conf')."/autoload_configs/translate.conf.xml"); $xml = file_get_contents($settings->get('switch','conf')."/autoload_configs/translate.conf.xml");
//convert the xml string to an xml object //convert the xml string to an xml object
$xml = simplexml_load_string($xml); $xml = simplexml_load_string($xml);

View File

@ -28,9 +28,9 @@ if ($domains_processed == 1) {
//create phrases folder and add include line in xml for each language found //create phrases folder and add include line in xml for each language found
/* /*
if (!empty($setting->get('switch','languages'))) { if (!empty($settings->get('switch','languages'))) {
if (is_readable($setting->get('switch','languages'))) { if (is_readable($settings->get('switch','languages'))) {
$conf_lang_folders = glob($setting->get('switch','languages')."/*"); $conf_lang_folders = glob($settings->get('switch','languages')."/*");
foreach ($conf_lang_folders as $conf_lang_folder) { foreach ($conf_lang_folders as $conf_lang_folder) {
//create phrases folder, if necessary //create phrases folder, if necessary
if (!file_exists($conf_lang_folder."/phrases/")) { if (!file_exists($conf_lang_folder."/phrases/")) {
@ -65,7 +65,7 @@ if ($domains_processed == 1) {
*/ */
//if base64, convert existing incompatible phrases //if base64, convert existing incompatible phrases
if (!empty($setting->get('recordings','storage_type')) && $setting->get('recordings','storage_type') == 'base64') { if (!empty($settings->get('recordings','storage_type')) && $settings->get('recordings','storage_type') == 'base64') {
$sql = "select phrase_detail_uuid, phrase_detail_data "; $sql = "select phrase_detail_uuid, phrase_detail_data ";
$sql .= "from v_phrase_details where phrase_detail_function = 'play-file' "; $sql .= "from v_phrase_details where phrase_detail_function = 'play-file' ";
$result = $database->select($sql, null, 'all'); $result = $database->select($sql, null, 'all');
@ -73,8 +73,8 @@ if ($domains_processed == 1) {
foreach ($result as $index => $row) { foreach ($result as $index => $row) {
$phrase_detail_uuid = $row['phrase_detail_uuid']; $phrase_detail_uuid = $row['phrase_detail_uuid'];
$phrase_detail_data = $row['phrase_detail_data']; $phrase_detail_data = $row['phrase_detail_data'];
if (substr_count($phrase_detail_data, $setting->get('switch','recordings').'/'.$domain_name) > 0) { if (substr_count($phrase_detail_data, $settings->get('switch','recordings').'/'.$domain_name) > 0) {
$phrase_detail_data = str_replace($setting->get('switch','recordings').'/'.$domain_name.'/', '', $phrase_detail_data); $phrase_detail_data = str_replace($settings->get('switch','recordings').'/'.$domain_name.'/', '', $phrase_detail_data);
} }
//update function and data to be base64 compatible //update function and data to be base64 compatible
$phrase_detail_data = "lua(streamfile.lua ".$phrase_detail_data.")"; $phrase_detail_data = "lua(streamfile.lua ".$phrase_detail_data.")";
@ -98,7 +98,7 @@ if ($domains_processed == 1) {
} }
//if not base64, revert base64 phrases to standard method //if not base64, revert base64 phrases to standard method
else if (!empty($setting->get('recordings','storage_type')) && $setting->get('recordings','storage_type') != 'base64') { else if (!empty($settings->get('recordings','storage_type')) && $settings->get('recordings','storage_type') != 'base64') {
$sql = "select phrase_detail_uuid, phrase_detail_data "; $sql = "select phrase_detail_uuid, phrase_detail_data ";
$sql .= "from v_phrase_details where "; $sql .= "from v_phrase_details where ";
$sql .= "phrase_detail_function = 'execute' "; $sql .= "phrase_detail_function = 'execute' ";
@ -112,7 +112,7 @@ if ($domains_processed == 1) {
$phrase_detail_data = str_replace('lua(streamfile.lua ', '', $phrase_detail_data); $phrase_detail_data = str_replace('lua(streamfile.lua ', '', $phrase_detail_data);
$phrase_detail_data = str_replace(')', '', $phrase_detail_data); $phrase_detail_data = str_replace(')', '', $phrase_detail_data);
if (substr_count($phrase_detail_data, '/') === 0) { if (substr_count($phrase_detail_data, '/') === 0) {
$phrase_detail_data = $setting->get('switch','recordings').'/'.$domain_name.'/'.$phrase_detail_data; $phrase_detail_data = $settings->get('switch','recordings').'/'.$domain_name.'/'.$phrase_detail_data;
} }
$array['phrase_details'][$index]['phrase_detail_uuid'] = $phrase_detail_uuid; $array['phrase_details'][$index]['phrase_detail_uuid'] = $phrase_detail_uuid;
$array['phrase_details'][$index]['phrase_detail_function'] = 'play-file'; $array['phrase_details'][$index]['phrase_detail_function'] = 'play-file';

View File

@ -25,9 +25,9 @@
*/ */
//if the recordings directory doesn't exist then create it //if the recordings directory doesn't exist then create it
if (!empty($setting->get('switch','recordings')) && !empty($domain_name)) { if (!empty($settings->get('switch','recordings')) && !empty($domain_name)) {
if (!is_readable($setting->get('switch','recordings')."/".$domain_name)) { if (!is_readable($settings->get('switch','recordings')."/".$domain_name)) {
mkdir($setting->get('switch','recordings')."/".$domain_name."/archive", 0770, true); mkdir($settings->get('switch','recordings')."/".$domain_name."/archive", 0770, true);
} }
} }
@ -35,7 +35,7 @@
if ($domains_processed == 1) { if ($domains_processed == 1) {
//if base64, populate from existing recording files, then remove //if base64, populate from existing recording files, then remove
if (!empty($setting->get('recordings','storage_type')) && $setting->get('recordings','storage_type') == 'base64') { if (!empty($settings->get('recordings','storage_type')) && $settings->get('recordings','storage_type') == 'base64') {
//get recordings without base64 in db //get recordings without base64 in db
$sql = "select recording_uuid, domain_uuid, recording_filename "; $sql = "select recording_uuid, domain_uuid, recording_filename ";
$sql .= "from v_recordings "; $sql .= "from v_recordings ";
@ -50,7 +50,7 @@
$recording_filename = $row['recording_filename']; $recording_filename = $row['recording_filename'];
//set recording directory //set recording directory
$recording_directory = $setting->get('switch','recordings').'/'.$domain_name; $recording_directory = $settings->get('switch','recordings').'/'.$domain_name;
//encode recording file (if exists) //encode recording file (if exists)
if (file_exists($recording_directory.'/'.$recording_filename)) { if (file_exists($recording_directory.'/'.$recording_filename)) {
@ -77,7 +77,7 @@
unset($sql, $result, $row); unset($sql, $result, $row);
} }
//if not base64, decode to local files, remove base64 data from db //if not base64, decode to local files, remove base64 data from db
else if (!empty($setting->get('recordings','storage_type')) && $setting->get('recordings','storage_type') != 'base64') { else if (!empty($settings->get('recordings','storage_type')) && $settings->get('recordings','storage_type') != 'base64') {
//get recordings with base64 in db //get recordings with base64 in db
$sql = "select recording_uuid, domain_uuid, recording_filename, recording_base64 "; $sql = "select recording_uuid, domain_uuid, recording_filename, recording_base64 ";
$sql .= "from v_recordings "; $sql .= "from v_recordings ";
@ -92,7 +92,7 @@
$recording_base64 = $row['recording_base64']; $recording_base64 = $row['recording_base64'];
//set recording directory //set recording directory
$recording_directory = $setting->get('switch','recordings').'/'.$domain_name; $recording_directory = $settings->get('switch','recordings').'/'.$domain_name;
//remove local file, if any //remove local file, if any
if (file_exists($recording_directory.'/'.$recording_filename)) { if (file_exists($recording_directory.'/'.$recording_filename)) {

View File

@ -68,8 +68,8 @@ if ($domains_processed == 1) {
unset($sql, $result, $row); unset($sql, $result, $row);
//get settings //get settings
$voicemail_storage_type = $setting->get('voicemail','storage_type'); $voicemail_storage_type = $settings->get('voicemail','storage_type');
$switch_storage = $setting->get('switch','storage'); $switch_storage = $settings->get('switch','storage');
//if base64, populate from existing greeting files, then remove //if base64, populate from existing greeting files, then remove
if (!empty($voicemail_storage_type) && $voicemail_storage_type == 'base64') { if (!empty($voicemail_storage_type) && $voicemail_storage_type == 'base64') {

View File

@ -36,18 +36,18 @@ if ($domains_processed == 1) {
unset($sql, $parameters); unset($sql, $parameters);
if (!empty($voicemails) && is_array($voicemails)) { if (!empty($voicemails) && is_array($voicemails)) {
foreach($voicemails as $row) { foreach($voicemails as $row) {
if (!empty($setting->get('switch','voicemail')) && !empty($row['voicemail_id']) && is_numeric($row['voicemail_id'])) { if (!empty($settings->get('switch','voicemail')) && !empty($row['voicemail_id']) && is_numeric($row['voicemail_id'])) {
if (!file_exists($setting->get('switch','voicemail')."/default/".$row['domain_name']."/".$row['voicemail_id'])) { if (!file_exists($settings->get('switch','voicemail')."/default/".$row['domain_name']."/".$row['voicemail_id'])) {
mkdir($setting->get('switch','voicemail')."/default/".$row['domain_name']."/".$row['voicemail_id'], 0770, true); mkdir($settings->get('switch','voicemail')."/default/".$row['domain_name']."/".$row['voicemail_id'], 0770, true);
} }
} }
} }
} }
//define initial, get current, define correct languages folder paths //define initial, get current, define correct languages folder paths
$switch_configuration_dir = !empty($setting->get('switch','conf')) ? $setting->get('switch','conf') : '/etc/freeswitch'; $switch_configuration_dir = !empty($settings->get('switch','conf')) ? $settings->get('switch','conf') : '/etc/freeswitch';
$switch_languages_dir_initial = $switch_configuration_dir.'/lang'; $switch_languages_dir_initial = $switch_configuration_dir.'/lang';
$switch_languages_dir_current = $setting->get('switch','languages') ?? ''; $switch_languages_dir_current = $settings->get('switch','languages') ?? '';
$switch_languages_dir_correct = $switch_configuration_dir.'/languages'; $switch_languages_dir_correct = $switch_configuration_dir.'/languages';
//ensure switch using languages (not lang) folder //ensure switch using languages (not lang) folder
@ -124,4 +124,4 @@ if ($domains_processed == 1) {
} }
?> ?>

View File

@ -80,11 +80,8 @@
exit; exit;
} }
//get the settings
$setting = new settings();
//get cdr settings //get cdr settings
//$interval = $setting->get('xml_cdr', '$interval'); //$interval = $settings->get('xml_cdr', '$interval');
//make sure the /var/run/fusionpbx directory exists //make sure the /var/run/fusionpbx directory exists
if (!file_exists('/var/run/fusionpbx')) { if (!file_exists('/var/run/fusionpbx')) {
@ -119,7 +116,7 @@
$cdr = new xml_cdr; $cdr = new xml_cdr;
//get the cdr record //get the cdr record
$xml_cdr_dir = $setting->get('switch', 'log').'/xml_cdr'; $xml_cdr_dir = $settings->get('switch', 'log').'/xml_cdr';
//loop through //loop through
while (true) { while (true) {