diff --git a/app/call_block/app_config.php b/app/call_block/app_config.php
index ba7e7d220c..d86ffd5cfc 100644
--- a/app/call_block/app_config.php
+++ b/app/call_block/app_config.php
@@ -25,22 +25,18 @@
$apps[$x]['permissions'][$y]['menu']['uuid'] = "29295c90-b1b9-440b-9c7E-c8363c6e8975";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
- $apps[$x]['permissions'][$y]['groups'][] = "user";
$y++;
$apps[$x]['permissions'][$y]['name'] = "call_block_add";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
- $apps[$x]['permissions'][$y]['groups'][] = "user";
$y++;
$apps[$x]['permissions'][$y]['name'] = "call_block_edit";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
- $apps[$x]['permissions'][$y]['groups'][] = "user";
$y++;
$apps[$x]['permissions'][$y]['name'] = "call_block_delete";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
- $apps[$x]['permissions'][$y]['groups'][] = "user";
$y++;
//schema details
diff --git a/app/call_block/app_menu.php b/app/call_block/app_menu.php
index fa19b6f530..59da295d0d 100644
--- a/app/call_block/app_menu.php
+++ b/app/call_block/app_menu.php
@@ -16,8 +16,7 @@ $apps[$x]['menu'][0]['uuid'] = "29295c90-b1b9-440b-9c7E-c8363c6e8975";
$apps[$x]['menu'][0]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5";
$apps[$x]['menu'][0]['category'] = "internal";
$apps[$x]['menu'][0]['path'] = "/app/call_block/call_block.php";
-$apps[$x]['menu'][0]['groups'][] = "user";
-$apps[$x]['menu'][0]['groups'][] = "admin";
$apps[$x]['menu'][0]['groups'][] = "superadmin";
+$apps[$x]['menu'][0]['groups'][] = "admin";
?>
\ No newline at end of file
diff --git a/app/call_centers/call_center_agent_delete.php b/app/call_centers/call_center_agent_delete.php
index ecbdd74ff6..d7703ec81f 100644
--- a/app/call_centers/call_center_agent_delete.php
+++ b/app/call_centers/call_center_agent_delete.php
@@ -86,6 +86,7 @@ if (count($_GET)>0) {
//synchronize configuration
save_call_center_xml();
+ remove_config_from_cache('configuration:callcenter.conf');
//redirect the browser
$_SESSION["message"] = $text['message-delete'];
diff --git a/app/call_centers/call_center_agent_edit.php b/app/call_centers/call_center_agent_edit.php
index 5ff7915723..e72dc42c19 100644
--- a/app/call_centers/call_center_agent_edit.php
+++ b/app/call_centers/call_center_agent_edit.php
@@ -264,6 +264,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//syncrhonize configuration
save_call_center_xml();
+ remove_config_from_cache('configuration:callcenter.conf');
$_SESSION["message"] = $text['message-add'];
header("Location: call_center_agents.php");
@@ -291,7 +292,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql);
//syncrhonize configuration
- save_call_center_xml();
+ save_call_center_xml();
+ remove_config_from_cache('configuration:callcenter.conf');
$_SESSION["message"] = $text['message-update'];
header("Location: call_center_agents.php");
diff --git a/app/call_centers/call_center_queue_delete.php b/app/call_centers/call_center_queue_delete.php
index bad7ad96cc..5abb84093f 100644
--- a/app/call_centers/call_center_queue_delete.php
+++ b/app/call_centers/call_center_queue_delete.php
@@ -87,9 +87,11 @@ if (strlen($id) > 0) {
//clear the cache
$cache = new cache;
$cache->delete("dialplan:".$_SESSION["context"]);
+ remove_config_from_cache('configuration:callcenter.conf');
//synchronize configuration
save_dialplan_xml();
+ save_call_center_xml();
//apply settings reminder
$_SESSION["reload_xml"] = true;
diff --git a/app/call_centers/call_center_queue_edit.php b/app/call_centers/call_center_queue_edit.php
index 05f82c1580..e37cf5f245 100644
--- a/app/call_centers/call_center_queue_edit.php
+++ b/app/call_centers/call_center_queue_edit.php
@@ -257,6 +257,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//syncrhonize the configuration
save_call_center_xml();
+ remove_config_from_cache('configuration:callcenter.conf');
//delete the dialplan context from memcache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
@@ -326,6 +327,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//synchronize the configuration
save_call_center_xml();
+ remove_config_from_cache('configuration:callcenter.conf');
//clear the cache
$cache = new cache;
@@ -393,6 +395,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//syncrhonize configuration
save_call_center_xml();
+ remove_config_from_cache('configuration:callcenter.conf');
}
//redirect
diff --git a/app/call_centers/call_center_tier_edit.php b/app/call_centers/call_center_tier_edit.php
index 5f25536092..a8c5d2d4ac 100644
--- a/app/call_centers/call_center_tier_edit.php
+++ b/app/call_centers/call_center_tier_edit.php
@@ -111,7 +111,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql);
//syncrhonize configuration
- save_call_center_xml();
+ save_call_center_xml();
+ remove_config_from_cache('configuration:callcenter.conf');
//look up queue uuid by queue name (ugh)
$sql = "select call_center_queue_uuid from v_call_center_queues where queue_name = '".$queue_name."'";
diff --git a/app/calls/app_languages.php b/app/calls/app_languages.php
index 981ca16dd8..d475fee621 100644
--- a/app/calls/app_languages.php
+++ b/app/calls/app_languages.php
@@ -101,17 +101,6 @@ $text['label-on-busy']['sv-se'] = "Vid Upptaget ";
$text['label-on-busy']['uk'] = "Якщо зайнято";
$text['label-on-busy']['de-at'] = "Bei Besetzt";
-$text['label-ignore-busy']['en-us'] = "Ignore Busy";
-$text['label-ignore-busy']['es-cl'] = "";
-$text['label-ignore-busy']['pt-pt'] = "";
-$text['label-ignore-busy']['fr-fr'] = "";
-$text['label-ignore-busy']['it-it'] = "";
-$text['label-ignore-busy']['pt-br'] = "";
-$text['label-ignore-busy']['pl'] = "";
-$text['label-ignore-busy']['sv-se'] = "";
-$text['label-ignore-busy']['uk'] = "";
-$text['label-ignore-busy']['de-at'] = "";
-
$text['label-number']['en-us'] = "Number";
$text['label-number']['es-cl'] = "Número";
$text['label-number']['pt-pt'] = "Número";
@@ -133,6 +122,17 @@ $text['label-no_answer']['sv-se'] = "Inget Svar ";
$text['label-no_answer']['uk'] = "Без відповіді";
$text['label-no_answer']['de-at'] = "Keine Antwort";
+$text['label-ignore-busy']['en-us'] = "Ignore Busy";
+$text['label-ignore-busy']['es-cl'] = "";
+$text['label-ignore-busy']['pt-pt'] = "";
+$text['label-ignore-busy']['fr-fr'] = "";
+$text['label-ignore-busy']['it-it'] = "";
+$text['label-ignore-busy']['pt-br'] = "";
+$text['label-ignore-busy']['pl'] = "";
+$text['label-ignore-busy']['sv-se'] = "";
+$text['label-ignore-busy']['uk'] = "";
+$text['label-ignore-busy']['de-at'] = "Ignorieren bei Besetzt";
+
$text['label-follow-me']['en-us'] = "Follow Me";
$text['label-follow-me']['es-cl'] = "Sígueme";
$text['label-follow-me']['pt-pt'] = "Segue-me";
@@ -141,7 +141,7 @@ $text['label-follow-me']['pt-br'] = "Siga-me";
$text['label-follow-me']['pl'] = "Podążaj za mną";
$text['label-follow-me']['sv-se'] = "Följ Mig ";
$text['label-follow-me']['uk'] = "";
-$text['label-follow-me']['de-at'] = "Follow Me";
+$text['label-follow-me']['de-at'] = "Anrufweiterschaltung";
$text['label-enabled']['en-us'] = "Enabled";
$text['label-enabled']['es-cl'] = "Activo";
@@ -311,7 +311,7 @@ $text['label-call-forward']['pt-br'] = "Encaminhamento de chamadas";
$text['label-call-forward']['pl'] = "Przekierowanie";
$text['label-call-forward']['sv-se'] = "Vidarekoppling ";
$text['label-call-forward']['uk'] = "Переадресація";
-$text['label-call-forward']['de-at'] = "Ruf Weiterleitung";
+$text['label-call-forward']['de-at'] = "Rufumleitung";
$text['description-on-busy']['en-us'] = "If enabled, it overrides the value of voicemail enabling in extension.";
$text['description-on-busy']['es-cl'] = "Si está habilitada, anula el valor del correo de voz que permite en la extensión.";
@@ -383,7 +383,7 @@ $text['description-2']['pt-br'] = "A informação contem a origem, destino, dura
$text['description-2']['pl'] = "Za pomocą poniższych linków można skonfigurować przekierowania, usługę „Podążaj z mną” lub „Nie przeszkadzać” (DnD).";
$text['description-2']['sv-se'] = "Använd länkarna för att konfigurera Vidarekoppling, Följ Mig och Stör Ej. ";
$text['description-2']['uk'] = "";
-$text['description-2']['de-at'] = "Benutzen Sie die Funktionen um Weiterleitung, Follow Me oder Bitte nicht stören zu konfigurieren.";
+$text['description-2']['de-at'] = "Benutzen Sie die Funktionen um Rufumleitung, Anrufweiterschaltung oder Nicht stören zu konfigurieren.";
$text['description']['en-us'] = "Directs incoming calls for extension:";
$text['description']['es-cl'] = "Dirige las llamadas entrantes hacia una extensión:";
diff --git a/app/calls/call_edit.php b/app/calls/call_edit.php
index 33934c39dd..2834914f0c 100644
--- a/app/calls/call_edit.php
+++ b/app/calls/call_edit.php
@@ -536,7 +536,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if (permission_exists('follow_me_cid_set')) {
echo " ";
- $sql_forward = "select destination_uuid, destination_number, destination_description from v_destinations where domain_uuid = '$domain_uuid' and destination_type = 'inbound' order by destination_number asc ";
+ $sql_forward = "select destination_uuid, destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = '$domain_uuid' and destination_type = 'inbound' order by destination_number asc ";
$prep_statement_forward = $db->prepare(check_sql($sql_forward));
$prep_statement_forward->execute();
$result_forward = $prep_statement_forward->fetchAll(PDO::FETCH_ASSOC);
@@ -546,7 +546,15 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " \n";
foreach ($result_forward as &$row_forward) {
$selected = $row_forward["destination_uuid"] == $forward_caller_id_uuid ? "selected='selected' " : '';
- echo "\n";
+ $caller_id_number = $row_forward['destination_caller_id_number'];
+ if(strlen($caller_id_number) == 0){
+ $caller_id_number = $row_forward['destination_number'];
+ }
+ $caller_id_name = $row_forward['destination_caller_id_name'];
+ if(strlen($caller_id_name) == 0){
+ $caller_id_name = $row_forward['destination_description'];
+ }
+ echo "\n";
}
echo "\n";
}
@@ -603,7 +611,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if (permission_exists('follow_me_cid_set')) {
echo " ";
- $sql_follow_me = "select destination_uuid, destination_number, destination_description from v_destinations where domain_uuid = '$domain_uuid' and destination_type = 'inbound' order by destination_number asc ";
+ $sql_follow_me = "select destination_uuid, destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = '$domain_uuid' and destination_type = 'inbound' order by destination_number asc ";
$prep_statement_follow_me = $db->prepare(check_sql($sql_follow_me));
$prep_statement_follow_me->execute();
$result_follow_me = $prep_statement_follow_me->fetchAll(PDO::FETCH_ASSOC);
@@ -613,7 +621,17 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " \n";
foreach ($result_follow_me as &$row_follow_me) {
$selected = $row_follow_me["destination_uuid"] == $follow_me_caller_id_uuid ? "selected='selected'" : '';
- echo "\n";
+
+ $caller_id_number = $row_follow_me['destination_caller_id_number'];
+ if(strlen($caller_id_number) == 0){
+ $caller_id_number = $row_follow_me['destination_number'];
+ }
+ $caller_id_name = $row_follow_me['destination_caller_id_name'];
+ if(strlen($caller_id_name) == 0){
+ $caller_id_name = $row_follow_me['destination_description'];
+ }
+
+ echo "\n";
}
echo "\n";
}
@@ -749,11 +767,11 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo $text['label-ignore-busy'];
echo " \n";
echo "
\n";
echo "| \n";
@@ -1968,4 +2004,4 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//include the footer
require_once "resources/footer.php";
-?>
\ No newline at end of file
+?>
diff --git a/app/extensions/resources/classes/extension.php b/app/extensions/resources/classes/extension.php
index 488236303a..78f09074ed 100644
--- a/app/extensions/resources/classes/extension.php
+++ b/app/extensions/resources/classes/extension.php
@@ -65,6 +65,7 @@
public $nibble_account;
public $mwi_account;
public $sip_bypass_media;
+ public $absolute_codec_string;
public $dial_string;
public $enabled;
public $description;
@@ -360,6 +361,9 @@
$xml .= " \n";
break;
}
+ if (strlen($row['absolute_codec_string']) > 0) {
+ $xml .= " \n";
+ }
if (strlen($row['forward_all_enabled']) > 0) {
$xml .= " \n";
}
@@ -494,4 +498,4 @@
}
}
-?>
\ No newline at end of file
+?>
diff --git a/app/provision/app_defaults.php b/app/provision/app_defaults.php
index 942c228efd..7e80fd2e59 100644
--- a/app/provision/app_defaults.php
+++ b/app/provision/app_defaults.php
@@ -103,6 +103,13 @@
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'provision';
+ $array[$x]['default_setting_subcategory'] = 'path';
+ $array[$x]['default_setting_name'] = 'text';
+ $array[$x]['default_setting_value'] = '';
+ $array[$x]['default_setting_enabled'] = 'false';
+ $array[$x]['default_setting_description'] = '';
+ $x++;
+ $array[$x]['default_setting_category'] = 'provision';
$array[$x]['default_setting_subcategory'] = 'voicemail_number';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = '*97';
diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php
index d2a4a6f562..66fa4645cb 100644
--- a/app/provision/resources/classes/provision.php
+++ b/app/provision/resources/classes/provision.php
@@ -822,8 +822,8 @@ include "root.php";
//$file_size = round(filesize($new_path)/1024, 2);
//echo $this->template_dir."/".$device_template."/".$file_name." $file_size\n";
//write the configuration to the directory
- if (strlen($_SESSION['switch']['provision']['dir']) > 0) {
- $dir_array = explode(";", $_SESSION['switch']['provision']['dir']);
+ if (strlen($provision["path"]) > 0) {
+ $dir_array = explode(";", $provision["path"]);
foreach($dir_array as $directory) {
if (file_exists($this->template_dir."/".$device_template."/".$file_name)) {
diff --git a/app/time_conditions/app_defaults.php b/app/time_conditions/app_defaults.php
index 249ed0f0f5..2fa4411a74 100644
--- a/app/time_conditions/app_defaults.php
+++ b/app/time_conditions/app_defaults.php
@@ -3,54 +3,68 @@
if ($domains_processed == 1) {
//define holiday presets
- $preset[] = json_encode(array("new_years_day" => array("mday" => "1", "mon" => "1")));
- $preset[] = json_encode(array("martin_luther_king_jr_day" => array("wday" => "2", "mon" => "1", "mweek" => "3")));
- $preset[] = json_encode(array("presidents_day" => array("wday" => "2", "mon" => "2", "mweek" => "3")));
- $preset[] = json_encode(array("memorial_day" => array("mday" => "25-31", "wday" => "2", "mon" => "5")));
- $preset[] = json_encode(array("independence_day" => array("mday" => "4", "mon" => "7")));
- $preset[] = json_encode(array("labor_day" => array("wday" => "2", "mon" => "9", "mweek" => "1")));
- $preset[] = json_encode(array("columbus_day" => array("wday" => "2", "mon" => "10", "mweek" => "2")));
- $preset[] = json_encode(array("veterans_day" => array("mday" => "11", "mon" => "11")));
- $preset[] = json_encode(array("thanksgiving_day" => array("wday" => "5-6", "mon" => "11", "mweek" => "4")));
- $preset[] = json_encode(array("christmas_day" => array("mday" => "25", "mon" => "12")));
+ $preset['usa'][] = json_encode(array("new_years_day" => array("mday" => "1", "mon" => "1")));
+ $preset['usa'][] = json_encode(array("martin_luther_king_jr_day" => array("wday" => "2", "mon" => "1", "mweek" => "3")));
+ $preset['usa'][] = json_encode(array("presidents_day" => array("wday" => "2", "mon" => "2", "mweek" => "3")));
+ $preset['usa'][] = json_encode(array("memorial_day" => array("mday" => "25-31", "wday" => "2", "mon" => "5")));
+ $preset['usa'][] = json_encode(array("independence_day" => array("mday" => "4", "mon" => "7")));
+ $preset['usa'][] = json_encode(array("labor_day" => array("wday" => "2", "mon" => "9", "mweek" => "1")));
+ $preset['usa'][] = json_encode(array("columbus_day" => array("wday" => "2", "mon" => "10", "mweek" => "2")));
+ $preset['usa'][] = json_encode(array("veterans_day" => array("mday" => "11", "mon" => "11")));
+ $preset['usa'][] = json_encode(array("thanksgiving_day" => array("wday" => "5-6", "mon" => "11", "mweek" => "4")));
+ $preset['usa'][] = json_encode(array("christmas_day" => array("mday" => "25", "mon" => "12")));
- //define array of settings
- $x = 0;
- foreach ($preset as $json) {
- $array[$x]['default_setting_category'] = 'time_conditions';
- $array[$x]['default_setting_subcategory'] = 'preset';
- $array[$x]['default_setting_name'] = 'array';
- $array[$x]['default_setting_value'] = $json;
- $array[$x]['default_setting_enabled'] = 'true';
- $array[$x]['default_setting_description'] = 'Holiday';
- $x++;
- }
+ $preset['england'][] = json_encode(array("new_years_day" => array("mday" => "1", "mon" => "1")));
+ $preset['england'][] = json_encode(array("christmas_day" => array("mday" => "25", "mon" => "12")));
+ $preset['england'][] = json_encode(array("boxing_day" => array("mday" => "26", "mon" => "12")));
+ $preset['england'][] = json_encode(array("may_day" => array("mon" => "5", "mweek" => "1", "wday" => "2")));
+ $preset['england'][] = json_encode(array("spring_bank_holiday" => array("mon" => "5", "mday" => "25-31", "wday" => "2")));
+ $preset['england'][] = json_encode(array("august_bank_holiday" => array("mon" => "8", "mday" => "25-31", "wday" => "2")));
- //get an array of the default settings
- $sql = "select * from v_default_settings ";
+ //iterate and migrate old presets first
+ $sql = "update v_default_settings ";
+ $sql .= "set default_setting_subcategory = 'preset_usa' ";
+ $sql .= ", default_setting_description = 'usa Holiday' ";
$sql .= "where default_setting_category = 'time_conditions' ";
$sql .= "and default_setting_subcategory = 'preset' ";
- $sql .= "and default_setting_name = 'array' ";
$prep_statement = $db->prepare($sql);
- $prep_statement->execute();
- $default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
- unset ($prep_statement, $sql);
-
- //find the missing default settings
- $x = 0;
- foreach ($array as $setting) {
- $found = false;
- $missing[$x] = $setting;
- foreach ($default_settings as $row) {
- if (trim($row['default_setting_value']) == trim($setting['default_setting_value'])) {
- $found = true;
- //remove items from the array that were found
- unset($missing[$x]);
- }
- }
- $x++;
+ if ($prep_statement) {
+ $prep_statement->execute();
+ unset ($prep_statement, $sql);
}
+ //iterate and add each, if necessary
+ $x = 0;
+ foreach ($preset as $region => $data) {
+ $sql = "select * from v_default_settings ";
+ $sql .= "where default_setting_category = 'time_conditions' ";
+ $sql .= "and default_setting_subcategory = 'preset_$region' ";
+ $sql .= "and default_setting_name = 'array' ";
+ $prep_statement = $db->prepare($sql);
+ if ($prep_statement) {
+ $prep_statement->execute();
+ $default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+ unset ($prep_statement, $sql);
+ foreach ($data as $json) {
+ $found = false;
+ $missing[$x]['default_setting_category'] = 'time_conditions';
+ $missing[$x]['default_setting_subcategory'] = "preset_$region";
+ $missing[$x]['default_setting_name'] = 'array';
+ $missing[$x]['default_setting_value'] = $json;
+ $missing[$x]['default_setting_enabled'] = 'true';
+ $missing[$x]['default_setting_description'] = "$region Holiday";
+ foreach ($default_settings as $row) {
+ if (trim($row['default_setting_value']) == trim($json)) {
+ $found = true;
+ //remove items from the array that were found
+ unset($missing[$x]);
+ }
+ }
+ $x++;
+ }
+ }
+ }
+
//add the missing default settings
foreach ($missing as $row) {
//add the default settings
@@ -63,6 +77,39 @@ if ($domains_processed == 1) {
}
unset($missing);
+ $array[$x]['default_setting_category'] = 'time_conditions';
+ $array[$x]['default_setting_subcategory'] = 'region';
+ $array[$x]['default_setting_name'] = 'text';
+ $array[$x]['default_setting_value'] = 'usa';
+ $array[$x]['default_setting_enabled'] = 'true';
+ $array[$x]['default_setting_description'] = 'What region to use by default when choosing Time Conditions';
+ $x++;
+
+ //iterate and add each, if necessary
+ foreach ($array as $index => $default_settings) {
+
+ //add the default setting
+ $sql = "select count(*) as num_rows from v_default_settings ";
+ $sql .= "where default_setting_category = '".$default_settings['default_setting_category']."' ";
+ $sql .= "and default_setting_subcategory = '".$default_settings['default_setting_subcategory']."' ";
+ $sql .= "and default_setting_name = '".$default_settings['default_setting_name']."' ";
+ $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) {
+ $orm = new orm;
+ $orm->name('default_settings');
+ $orm->save($array[$index]);
+ $message = $orm->message;
+ //print_r($message);
+ }
+ unset($row);
+ }
+
+ }
+
//unset the array variable
unset($array);
}
diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php
index 1be14bd414..f3e70b9f77 100644
--- a/app/time_conditions/time_condition_edit.php
+++ b/app/time_conditions/time_condition_edit.php
@@ -44,10 +44,12 @@ require_once "resources/header.php";
$destination = new destinations;
//load available presets
- foreach ($_SESSION['time_conditions']['preset'] as $json) {
+ $preset_region = "preset_".$_SESSION['time_conditions']['region']['text'];
+ foreach ($_SESSION['time_conditions'][$preset_region] as $json) {
$available_presets[] = json_decode($json, true);
}
-
+ unset($preset_region);
+
//set the action as an add or an update
if (isset($_REQUEST["id"])) {
$action = "update";
diff --git a/app/voicemails/app_defaults.php b/app/voicemails/app_defaults.php
index d81acb5140..0fab2304d7 100644
--- a/app/voicemails/app_defaults.php
+++ b/app/voicemails/app_defaults.php
@@ -48,6 +48,13 @@ if ($domains_processed == 1) {
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Define whether to keep voicemail files on the local system after sending attached via email.';
$x++;
+ $array[$x]['default_setting_category'] = 'voicemail';
+ $array[$x]['default_setting_subcategory'] = 'storage_type';
+ $array[$x]['default_setting_name'] = 'text';
+ $array[$x]['default_setting_value'] = 'base64';
+ $array[$x]['default_setting_enabled'] = 'false';
+ $array[$x]['default_setting_description'] = 'Define which storage type (base_64 stores in the database).';
+ $x++;
//iterate and add each, if necessary
foreach ($array as $index => $default_settings) {
diff --git a/app/voicemails/resources/classes/voicemail.php b/app/voicemails/resources/classes/voicemail.php
index ca5b55ba00..27f7e304af 100644
--- a/app/voicemails/resources/classes/voicemail.php
+++ b/app/voicemails/resources/classes/voicemail.php
@@ -161,7 +161,7 @@
if ($result_count > 0) {
foreach($result as &$row) {
//set the greeting directory
- $path = $_SESSION['switch']['storage']['dir'].'/voicemail/default/'.$_SESSION['domain_name'].'/'.$row['voicemail_id'];
+ $path = $_SESSION['switch']['voicemail']['dir'].'/default/'.$_SESSION['domain_name'].'/'.$row['voicemail_id'];
if (file_exists($path.'/msg_'.$row['voicemail_message_uuid'].'.wav')) {
$row['file_path'] = $path.'/msg_'.$row['voicemail_message_uuid'].'.wav';
}
@@ -239,7 +239,7 @@
}
//delete the recording
- $file_path = $_SESSION['switch']['storage']['dir']."/voicemail/default/".$_SESSION['domain_name']."/".$this->voicemail_id;
+ $file_path = $_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$this->voicemail_id;
foreach (glob($file_path."/msg_".$this->voicemail_message_uuid.".*") as $file_name) {
unlink($file_name);
}
@@ -278,7 +278,7 @@
session_cache_limiter('public');
//set source folder path
- $path = $_SESSION['switch']['storage']['dir'].'/voicemail/default/'.$_SESSION['domain_name'].'/'.$this->voicemail_id;
+ $path = $_SESSION['switch']['voicemail']['dir'].'/default/'.$_SESSION['domain_name'].'/'.$this->voicemail_id;
//prepare base64 content from db, if enabled
if ($_SESSION['voicemail']['storage_type']['text'] == 'base64') {
diff --git a/core/databases/app_defaults.php b/core/databases/app_defaults.php
index dbd68274fe..ea4d04d6c9 100644
--- a/core/databases/app_defaults.php
+++ b/core/databases/app_defaults.php
@@ -131,6 +131,9 @@ if ($domains_processed == 1) {
if (strlen($_SESSION['switch']['sounds']['dir']) > 0) {
$tmp .= correct_path(" sounds_dir = [[".$_SESSION['switch']['sounds']['dir']."]];\n");
}
+ if (strlen($_SESSION['switch']['phrases']['dir']) > 0) {
+ $tmp .= correct_path(" phrases_dir = [[".$_SESSION['switch']['phrases']['dir']."]];\n");
+ }
if (strlen($_SESSION['switch']['db']['dir']) > 0) {
$tmp .= correct_path(" database_dir = [[".$_SESSION['switch']['db']['dir']."]];\n");
}
diff --git a/core/user_settings/app_languages.php b/core/user_settings/app_languages.php
index 10c282542e..8eee3f3dc0 100644
--- a/core/user_settings/app_languages.php
+++ b/core/user_settings/app_languages.php
@@ -9,7 +9,7 @@ $text['title-user_dashboard']['pl'] = "Panel użytkowników";
$text['title-user_dashboard']['he'] = "ממשק משתמש";
$text['title-user_dashboard']['uk'] = "Панель користувача";
$text['title-user_dashboard']['sv-se'] = "Användarpanel";
-$text['title-user_dashboard']['de-at'] = "Benutzer-Übersichtsseite";
+$text['title-user_dashboard']['de-at'] = "Benutzerübersicht";
$text['title-user_dashboard']['ro'] = "Panou control utilizator";
$text['title-user_dashboard']['fa'] = "";
$text['title-user_dashboard']['ar-eg'] = "الصفحه الرئيسيه للمستخدم";
@@ -359,7 +359,7 @@ $text['label-followme']['pl'] = "Podążaj za mną";
$text['label-followme']['he'] = "עקוב אחרי";
$text['label-followme']['uk'] = "Follow Me";
$text['label-followme']['sv-se'] = "Följ Mig";
-$text['label-followme']['de-at'] = "Follow Me";
+$text['label-followme']['de-at'] = "Anrufweiterschaltung";
$text['label-followme']['ro'] = "Urmează-mă";
$text['label-followme']['fa'] = "";
$text['label-followme']['ar-eg'] = "خدمة اتبعني";
@@ -457,7 +457,7 @@ $text['label-callforward']['pl'] = "Przekierowanie rozmowy";
$text['label-callforward']['he'] = "עקוב אחרי";
$text['label-callforward']['uk'] = "Переадресація дзвінків";
$text['label-callforward']['sv-se'] = "Vidarekoppling";
-$text['label-callforward']['de-at'] = "Anrufweiterleitung";
+$text['label-callforward']['de-at'] = "Rufumleitung";
$text['label-callforward']['ro'] = "Redirecționare apel";
$text['label-callforward']['fa'] = "";
$text['label-callforward']['ar-eg'] = "تحويل المكالمات";
@@ -471,7 +471,7 @@ $text['header-user_dashboard']['pl'] = "Panel użytkowników";
$text['header-user_dashboard']['he'] = "ממשק משתמש";
$text['header-user_dashboard']['uk'] = "Панель користувача";
$text['header-user_dashboard']['sv-se'] = "Användarpanel";
-$text['header-user_dashboard']['de-at'] = "Benutzer-Übersichtsseite";
+$text['header-user_dashboard']['de-at'] = "Benutzerübersicht";
$text['header-user_dashboard']['ro'] = "Panou control utilizator";
$text['header-user_dashboard']['fa'] = "";
$text['header-user_dashboard']['ar-eg'] = "الصفحه الرئيسيه للمستخدم";
diff --git a/core/user_settings/app_menu.php b/core/user_settings/app_menu.php
index 900b3e5024..9f663d7579 100644
--- a/core/user_settings/app_menu.php
+++ b/core/user_settings/app_menu.php
@@ -29,7 +29,7 @@ $apps[$x]['menu'][1]['title']['pl'] = "Panel użytkowników";
$apps[$x]['menu'][1]['title']['he'] = "ממשק משתמש";
$apps[$x]['menu'][1]['title']['uk'] = "Панель користувача";
$apps[$x]['menu'][1]['title']['sv-se'] = "Användarpanel";
-$apps[$x]['menu'][1]['title']['de-at'] = "Benutzer-Übersichtsseite";
+$apps[$x]['menu'][1]['title']['de-at'] = "Benutzerübersicht";
$apps[$x]['menu'][1]['title']['ro'] = "Panou control utilizator";
$apps[$x]['menu'][1]['title']['ar-eg'] = "الصفحه الرئيسيه للمستخدم";
$apps[$x]['menu'][1]['uuid'] = "92c8ffdb-3c82-4f08-aec0-82421ec41bb5";
diff --git a/resources/install/scripts/app/ring_groups/index.lua b/resources/install/scripts/app/ring_groups/index.lua
index 553cb69ee1..25e07493f7 100644
--- a/resources/install/scripts/app/ring_groups/index.lua
+++ b/resources/install/scripts/app/ring_groups/index.lua
@@ -38,7 +38,7 @@ local log = require "resources.functions.log".ring_group
require "resources.functions.explode";
require "resources.functions.base64";
require "resources.functions.file_exists";
- require "resources.functions.explode";
+ require "resources.functions.channel_utils"
--get the variables
domain_name = session:getVariable("domain_name");
@@ -439,34 +439,10 @@ local log = require "resources.functions.log".ring_group
extension_uuid = trim(api:executeString(cmd));
--send to user
local dial_string_to_user = "[sip_invite_domain="..domain_name..","..group_confirm.."leg_timeout="..destination_timeout..","..delay_name.."="..destination_delay..",dialed_extension=" .. row.destination_number .. ",extension_uuid="..extension_uuid .. row.record_session .. "]user/" .. row.destination_number .. "@" .. domain_name;
- if (ring_group_skip_active ~= nil) then
- if (ring_group_skip_active == "true") then
- cmd = "show channels like "..destination_number;
- reply = trim(api:executeString(cmd));
- --freeswitch.consoleLog("notice", "[ring group] reply "..cmd.." " .. reply .. "\n");
- exploded_reply = {};
- exploded_reply = explode(",",reply);
-
- if (reply == "0 total.") then
- dial_string = dial_string_to_user
- else
- idle_extension=true;
-
- if (exploded_reply ~= nil) then
- for i,v in ipairs(exploded_reply) do
- if(v==destination_number.."@"..domain_name) then
- idle_extension=false;
- end
- end
- end
-
- if(idle_extension) then
- dial_string = dial_string_to_user;
- end
- end
- else
- --look inside the reply to check for the correct domain_name
- dial_string = dial_string_to_user;
+ if (ring_group_skip_active == "true") then
+ local channels = channels_by_number(destination_number, domain_name)
+ if (not channels) or #channels == 0 then
+ dial_string = dial_string_to_user
end
else
dial_string = dial_string_to_user;
diff --git a/resources/install/scripts/app/voicemail/resources/scripts/mwi.lua b/resources/install/scripts/app/voicemail/resources/scripts/mwi.lua
index 82d9d17973..33d48e8068 100644
--- a/resources/install/scripts/app/voicemail/resources/scripts/mwi.lua
+++ b/resources/install/scripts/app/voicemail/resources/scripts/mwi.lua
@@ -99,7 +99,7 @@
--send the message waiting event
local event = freeswitch.Event("message_waiting");
- if (row["message_count"] == "0") then
+ if (new_messages == "0") then
event:addHeader("MWI-Messages-Waiting", "no");
else
event:addHeader("MWI-Messages-Waiting", "yes");
diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua b/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua
index 5e653be5f6..325a2685e5 100644
--- a/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua
+++ b/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua
@@ -244,6 +244,7 @@
sip_force_expires = row.sip_force_expires;
nibble_account = row.nibble_account;
sip_bypass_media = row.sip_bypass_media;
+ absolute_codec_string = row.absolute_codec_string;
forward_all_enabled = row.forward_all_enabled;
forward_all_destination = row.forward_all_destination;
forward_busy_enabled = row.forward_busy_enabled;
@@ -445,9 +446,13 @@
if (string.len(nibble_account) > 0) then
table.insert(xml, [[ ]]);
end
+ if (string.len(absolute_codec_string) > 0) then
+ table.insert(xml, [[ ]]);
+ end
if (sip_bypass_media == "bypass-media") then
table.insert(xml, [[ ]]);
end
+
if (sip_bypass_media == "bypass-media-after-bridge") then
table.insert(xml, [[ ]]);
end
diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/languages/languages.lua b/resources/install/scripts/app/xml_handler/resources/scripts/languages/languages.lua
index 86047db948..6254bff9de 100644
--- a/resources/install/scripts/app/xml_handler/resources/scripts/languages/languages.lua
+++ b/resources/install/scripts/app/xml_handler/resources/scripts/languages/languages.lua
@@ -144,14 +144,14 @@
--read root xml language file, parse included xml files
local xml_file_paths = {}
- local file_handle = io.open("/usr/local/freeswitch/conf/lang/"..language.."/"..language..".xml", "r");
+ local file_handle = io.open(phrases_dir.."/"..language.."/"..language..".xml", "r");
if (file_handle ~= nil) then
for file_line in file_handle:lines() do
if (string.find(file_line, 'cmd="include" data="', 0, true) ~= nil) then
pos_beg = string.find(file_line, 'cmd="include" data="', 0, true) + 20;
pos_end = string.find(file_line, '"/>', 0, true) - 1;
xml_file_path = string.sub(file_line, pos_beg, pos_end);
- table.insert(xml_file_paths, "/usr/local/freeswitch/conf/lang/"..language.."/"..xml_file_path);
+ table.insert(xml_file_paths, lang_path.."/"..language.."/"..xml_file_path);
--freeswitch.consoleLog("notice", "file path = "..xml_file_path.."\n");
end
end
diff --git a/resources/install/scripts/call_flow.lua b/resources/install/scripts/call_flow.lua
index a8298a067c..2b51b6d33b 100644
--- a/resources/install/scripts/call_flow.lua
+++ b/resources/install/scripts/call_flow.lua
@@ -35,6 +35,10 @@
require "resources.functions.database_handle";
dbh = database_handle('system');
+ local log = require "resources.functions.log".call_flow
+
+ local presence_in = require "resources.functions.presence_in"
+
if (session:ready()) then
--get the variables
domain_name = session:getVariable("domain_name");
@@ -51,11 +55,9 @@ if (session:ready()) then
if (not default_voice) then default_voice = 'callie'; end
--get the extension list
- sql = [[SELECT * FROM v_call_flows
- where call_flow_uuid = ']]..call_flow_uuid..[[']]
- --and call_flow_enabled = 'true'
- --freeswitch.consoleLog("notice", "SQL:" .. sql .. "\n");
- app_data = "";
+ sql = "SELECT * FROM v_call_flows where call_flow_uuid = '"..call_flow_uuid.."'"
+ -- .. "and call_flow_enabled = 'true'"
+ --log.notice("SQL: %s", sql);
x = 0;
dbh:query(sql, function(row)
@@ -68,17 +70,15 @@ if (session:ready()) then
call_flow_label = row.call_flow_label;
call_flow_anti_label = row.call_flow_anti_label;
- if (string.len(call_flow_status) == 0) then
+ if #call_flow_status == 0 then
+ call_flow_status = "true";
+ end
+ if (call_flow_status == "true") then
app = row.call_flow_app;
data = row.call_flow_data
else
- if (call_flow_status == "true") then
- app = row.call_flow_app;
- data = row.call_flow_data
- else
- app = row.call_flow_anti_app;
- data = row.call_flow_anti_data
- end
+ app = row.call_flow_anti_app;
+ data = row.call_flow_anti_data
end
end);
@@ -99,70 +99,34 @@ if (session:ready()) then
end
--feature code - toggle the status
- if (string.len(call_flow_status) == 0) then
- toggle = "false";
- else
- if (call_flow_status == "true") then
- toggle = "false";
- else
- toggle = "true";
- end
- end
- if (toggle == "true") then
- --set the presence to terminated - turn the lamp off:
- event = freeswitch.Event("PRESENCE_IN");
- event:addHeader("proto", "sip");
- event:addHeader("event_type", "presence");
- event:addHeader("alt_event_type", "dialog");
- event:addHeader("Presence-Call-Direction", "outbound");
- event:addHeader("state", "Active (1 waiting)");
- event:addHeader("from", call_flow_feature_code.."@"..domain_name);
- event:addHeader("login", call_flow_feature_code.."@"..domain_name);
- event:addHeader("unique-id", call_flow_uuid);
- event:addHeader("answer-state", "terminated");
- event:fire();
- --answer and play a tone
- session:answer();
- if (string.len(call_flow_label) > 0) then
- api = freeswitch.API();
- reply = api:executeString("uuid_display "..session:get_uuid().." "..call_flow_label);
- end
- session:execute("sleep", "2000");
- session:execute("playback", "tone_stream://%(200,0,500,600,700)");
- --show in the console
- freeswitch.consoleLog("notice", "Call Flow: label="..call_flow_label..",status=true,uuid="..call_flow_uuid.."\n");
- else
- --set presence in - turn lamp on
- event = freeswitch.Event("PRESENCE_IN");
- event:addHeader("proto", "sip");
- event:addHeader("login", call_flow_feature_code.."@"..domain_name);
- event:addHeader("from", call_flow_feature_code.."@"..domain_name);
- event:addHeader("status", "Active (1 waiting)");
- event:addHeader("rpid", "unknown");
- event:addHeader("event_type", "presence");
- event:addHeader("alt_event_type", "dialog");
- event:addHeader("event_count", "1");
- event:addHeader("unique-id", call_flow_uuid);
- event:addHeader("Presence-Call-Direction", "outbound")
- event:addHeader("answer-state", "confirmed");
- event:fire();
- --answer and play a tone
- session:answer();
- if (string.len(call_flow_anti_label) > 0) then
- api = freeswitch.API();
- reply = api:executeString("uuid_display "..session:get_uuid().." "..call_flow_anti_label);
- end
- session:execute("sleep", "2000");
- session:execute("playback", "tone_stream://%(500,0,300,200,100,50,25)");
- --show in the console
- freeswitch.consoleLog("notice", "Call Flow: label="..call_flow_anti_label..",status=false,uuid="..call_flow_uuid.."\n");
+ toggle = (call_flow_status == "true") and "false" or "true"
+
+ -- turn the lamp
+ presence_in.turn_lamp( toggle == "false",
+ call_flow_feature_code.."@"..domain_name,
+ call_flow_uuid
+ );
+
+ local active_flow_label = (toggle == "true") and call_flow_label or call_flow_anti_label
+ --answer and play a tone
+ session:answer();
+ if #active_flow_label > 0 then
+ api = freeswitch.API();
+ reply = api:executeString("uuid_display "..session:get_uuid().." "..active_flow_label);
end
+ session:execute("sleep", "2000");
+ session:execute("playback", "tone_stream://%(200,0,500,600,700)");
+
+ --show in the console
+ log.noticef("label=%s,status=%s,uuid=%s", active_flow_label, toggle, call_flow_uuid);
+
+ --store in database
dbh:query("UPDATE v_call_flows SET call_flow_status = '"..toggle.."' WHERE call_flow_uuid = '"..call_flow_uuid.."'");
+
--hangup the call
session:hangup();
else
- --app_data
- freeswitch.consoleLog("notice", "Call Flow: " .. app .. " " .. data .. "\n");
+ log.notice("execute " .. app .. " " .. data);
--exucute the application
session:execute(app, data);
diff --git a/resources/install/scripts/call_flow_monitor.lua b/resources/install/scripts/call_flow_monitor.lua
index 5db7d4f3d0..b3ddebb1dc 100644
--- a/resources/install/scripts/call_flow_monitor.lua
+++ b/resources/install/scripts/call_flow_monitor.lua
@@ -38,9 +38,11 @@
require "resources.functions.file_exists";
require "resources.functions.mkdir";
---connect to the database
require "resources.functions.database_handle";
- dbh = database_handle('system');
+
+ local log = require "resources.functions.log".call_flow_monitor
+
+ local presence_in = require "resources.functions.presence_in"
--make sure the scripts/run dir exists
mkdir(scripts_dir .. "/run");
@@ -61,69 +63,52 @@
--used to stop the lua service
local file = assert(io.open(run_file, "w"));
file:write("remove this file to stop the script");
+ file:close()
+ log.notice("Start")
--monitor the call flows status
- x = 0
+ local sql = "select d.domain_name, f.call_flow_uuid, f.call_flow_extension, f.call_flow_feature_code," ..
+ "f.call_flow_status, f.call_flow_label, f.call_flow_anti_label "..
+ "from v_call_flows as f, v_domains as d " ..
+ "where f.domain_uuid = d.domain_uuid " -- and call_flow_enabled = 'true'
while true do
- --get the extension list
- sql = [[select d.domain_name, f.call_flow_uuid, f.call_flow_extension, f.call_flow_feature_code, f.call_flow_status, f.call_flow_label, f.call_flow_anti_label
- from v_call_flows as f, v_domains as d
- where f.domain_uuid = d.domain_uuid]]
- --and call_flow_enabled = 'true'
+ -- debug print
if (debug["sql"]) then
- freeswitch.consoleLog("notice", "SQL:" .. sql .. "\n");
+ log.notice("SQL:" .. sql);
end
- x = 0;
- dbh:query(sql, function(row)
- domain_name = row.domain_name;
- call_flow_uuid = row.call_flow_uuid;
- --call_flow_name = row.call_flow_name;
- call_flow_extension = row.call_flow_extension;
- call_flow_feature_code = row.call_flow_feature_code;
- --call_flow_context = row.call_flow_context;
- call_flow_status = row.call_flow_status;
- --pin_number = row.call_flow_pin_number;
- call_flow_label = row.call_flow_label;
- call_flow_anti_label = row.call_flow_anti_label;
- if (call_flow_status == "true") then
- --set the presence to terminated - turn the lamp off:
- event = freeswitch.Event("PRESENCE_IN");
- event:addHeader("proto", "sip");
- event:addHeader("event_type", "presence");
- event:addHeader("alt_event_type", "dialog");
- event:addHeader("Presence-Call-Direction", "outbound");
- event:addHeader("state", "Active (1 waiting)");
- event:addHeader("from", call_flow_feature_code.."@"..domain_name);
- event:addHeader("login", call_flow_feature_code.."@"..domain_name);
- event:addHeader("unique-id", call_flow_uuid);
- event:addHeader("answer-state", "terminated");
- event:fire();
- --show in the console
- if (debug["log"]) then
- freeswitch.consoleLog("notice", "Call Flow: label="..call_flow_label..",status=true,uuid="..call_flow_uuid.."\n");
- end
- else
- --set presence in - turn lamp on
- event = freeswitch.Event("PRESENCE_IN");
- event:addHeader("proto", "sip");
- event:addHeader("login", call_flow_feature_code.."@"..domain_name);
- event:addHeader("from", call_flow_feature_code.."@"..domain_name);
- event:addHeader("status", "Active (1 waiting)");
- event:addHeader("rpid", "unknown");
- event:addHeader("event_type", "presence");
- event:addHeader("alt_event_type", "dialog");
- event:addHeader("event_count", "1");
- event:addHeader("unique-id", call_flow_uuid);
- event:addHeader("Presence-Call-Direction", "outbound");
- event:addHeader("answer-state", "confirmed");
- event:fire();
- --show in the console
- if (debug["log"]) then
- freeswitch.consoleLog("notice", "Call Flow: label="..call_flow_anti_label..",status=false,uuid="..call_flow_uuid.."\n");
- end
- end
- end);
+ --connect to the database
+ local dbh = database_handle('system');
+
+ --get the extension list
+ if dbh:connected() then
+ dbh:query(sql, function(row)
+ local domain_name = row.domain_name;
+ local call_flow_uuid = row.call_flow_uuid;
+ --local call_flow_name = row.call_flow_name;
+ --local call_flow_extension = row.call_flow_extension;
+ local call_flow_feature_code = row.call_flow_feature_code;
+ --local call_flow_context = row.call_flow_context;
+ local call_flow_status = row.call_flow_status;
+ --local pin_number = row.call_flow_pin_number;
+ local call_flow_label = row.call_flow_label;
+ local call_flow_anti_label = row.call_flow_anti_label;
+
+ -- turn the lamp
+ presence_in.turn_lamp( call_flow_status == "false",
+ call_flow_feature_code.."@"..domain_name,
+ call_flow_uuid
+ );
+
+ if (debug["log"]) then
+ local label = (call_flow_status == "true") and call_flow_label or call_flow_anti_label
+ log.noticef("label=%s,status=%s,uuid=%s", label, call_flow_status, call_flow_uuid);
+ end
+ end);
+ end
+
+ -- release dbh
+ dbh:release()
--exit the loop when the file does not exist
if (not file_exists(run_file)) then
@@ -132,4 +117,6 @@
--sleep a moment to prevent using unecessary resources
freeswitch.msleep(sleep*1000);
- end
\ No newline at end of file
+ end
+
+ log.notice("Stop")
diff --git a/resources/install/scripts/ivr_menu.lua b/resources/install/scripts/ivr_menu.lua
index 02131a283d..554bcdc2f7 100644
--- a/resources/install/scripts/ivr_menu.lua
+++ b/resources/install/scripts/ivr_menu.lua
@@ -358,8 +358,7 @@
pos = string.find(ivr_menu_greet_long, ":", 0, true);
if (pos ~= nil and string.sub(ivr_menu_greet_long, 0, pos-1) == 'phrase') then
freeswitch.consoleLog("notice", "[ivr_menu] phrase detected\n");
- session:playAndGetDigits(min_digits, ivr_menu_digit_len, 1, ivr_menu_timeout, ivr_menu_confirm_key, ivr_menu_greet_long, "", ".*");
- dtmf_digits = session:getVariable("dtmf_digits");
+ dtmf_digits = session:playAndGetDigits(min_digits, ivr_menu_digit_len, 1, ivr_menu_timeout, ivr_menu_confirm_key, ivr_menu_greet_long, "", ".*");
session:setVariable("slept", "false");
else
dtmf_digits = session:playAndGetDigits(min_digits, ivr_menu_digit_len, 1, ivr_menu_timeout, ivr_menu_confirm_key, ivr_menu_greet_long, "", ".*");
diff --git a/resources/install/scripts/resources/functions/cache.lua b/resources/install/scripts/resources/functions/cache.lua
index 974e327dd9..06548af1cd 100644
--- a/resources/install/scripts/resources/functions/cache.lua
+++ b/resources/install/scripts/resources/functions/cache.lua
@@ -10,6 +10,13 @@ require "resources.functions.trim";
local api = api or freeswitch.API();
+local function send_event(action, key)
+ local event = freeswitch.Event("MEMCACHE", action);
+ event:addHeader("API-Command", "memcache");
+ event:addHeader("API-Command-Argument", action .. " " .. key);
+ event:fire()
+end
+
local Cache = {}
local function check_error(result)
@@ -57,6 +64,7 @@ function Cache.set(key, value, expire)
end
function Cache.del(key)
+ send_event('delete', key)
local result, err = check_error(api:execute("memcache", "delete " .. key))
if not result then
if err == 'NOT FOUND' then
diff --git a/resources/install/scripts/resources/functions/channel_utils.lua b/resources/install/scripts/resources/functions/channel_utils.lua
index a078939d2e..a94ceffe62 100644
--- a/resources/install/scripts/resources/functions/channel_utils.lua
+++ b/resources/install/scripts/resources/functions/channel_utils.lua
@@ -1,3 +1,7 @@
+require 'resources.functions.config'
+require 'resources.functions.trim'
+
+local Database = require 'resources.functions.database'
local api = api or freeswitch.API()
@@ -18,3 +22,38 @@ function channel_evalute(uuid, cmd)
return result
end
+
+local _switchname
+local function switchname()
+ if _switchname then return _switchname end
+
+ local result = api:executeString("switchname")
+
+ if result:sub(1, 4) == '-ERR' then return nil, result end
+ if result == '_undef_' then return false end
+
+ _switchname = result
+ return result
+end
+
+function channels_by_number(number, domain)
+ local hostname = assert(switchname())
+ local dbh = Database.new('switch')
+
+ local full_number = number .. '@' .. (domain or '%')
+
+ local sql = ([[select * from channels where hostname='%s' and (
+ (context = '%s' and (cid_name = '%s' or cid_num = '%s'))
+ or name like '%s' or presence_id like '%s' or presence_data like '%s'
+ )
+ order by created_epoch
+ ]]):format(hostname,
+ domain, number, number,
+ full_number, full_number, full_number
+ )
+
+ local rows = assert(dbh:fetch_all(sql))
+
+ dbh:release()
+ return rows
+end
diff --git a/resources/install/scripts/resources/functions/database.lua b/resources/install/scripts/resources/functions/database.lua
index 55d04f06b6..89b5456193 100644
--- a/resources/install/scripts/resources/functions/database.lua
+++ b/resources/install/scripts/resources/functions/database.lua
@@ -1,4 +1,4 @@
-require 'resources.config'
+require 'resources.functions.config'
require 'resources.functions.file_exists'
require 'resources.functions.database_handle'
diff --git a/resources/install/scripts/resources/functions/presence_in.lua b/resources/install/scripts/resources/functions/presence_in.lua
new file mode 100644
index 0000000000..b8369f9b17
--- /dev/null
+++ b/resources/install/scripts/resources/functions/presence_in.lua
@@ -0,0 +1,23 @@
+local function turn_lamp(on, user, uuid)
+ local event = freeswitch.Event("PRESENCE_IN");
+ event:addHeader("proto", "sip");
+ event:addHeader("event_type", "presence");
+ event:addHeader("alt_event_type", "dialog");
+ event:addHeader("Presence-Call-Direction", "outbound");
+ event:addHeader("from", user);
+ event:addHeader("login", user);
+ event:addHeader("unique-id", uuid);
+ event:addHeader("status", "Active (1 waiting)");
+ if on then
+ event:addHeader("answer-state", "confirmed");
+ event:addHeader("rpid", "unknown");
+ event:addHeader("event_count", "1");
+ else
+ event:addHeader("answer-state", "terminated");
+ end
+ event:fire();
+end
+
+return {
+ turn_lamp = turn_lamp;
+}
\ No newline at end of file
diff --git a/resources/switch.php b/resources/switch.php
index a37727a9d6..e4eb04c532 100644
--- a/resources/switch.php
+++ b/resources/switch.php
@@ -158,6 +158,15 @@ function byte_convert($bytes, $decimals = 2) {
return $formattedbytes;
}
+function remove_config_from_cache($name) {
+ $cache = new cache;
+ $cache->delete($name);
+ $hostname = trim(event_socket_request_cmd('api switchname'));
+ if($hostname){
+ $cache->delete($name . ':' . $hostname);
+ }
+}
+
function ListFiles($dir) {
if($dh = opendir($dir)) {
$files = Array();
diff --git a/resources/templates/conf/autoload_configs/lua.conf.xml b/resources/templates/conf/autoload_configs/lua.conf.xml
index 0758bb6762..534505dc3b 100644
--- a/resources/templates/conf/autoload_configs/lua.conf.xml
+++ b/resources/templates/conf/autoload_configs/lua.conf.xml
@@ -13,7 +13,7 @@
These entries will be pre-pended to the LUA_PATH environment variable
-->
-
+
diff --git a/resources/templates/provision/cisco/7940/SIPDefault.cnf b/resources/templates/provision/cisco/7940/SIPDefault.cnf
index 4cb86fc777..489f5c97ea 100644
--- a/resources/templates/provision/cisco/7940/SIPDefault.cnf
+++ b/resources/templates/provision/cisco/7940/SIPDefault.cnf
@@ -121,7 +121,7 @@ time_format_24hr: "0"
#services_url: "http://{$domain_name}/app/provision/?file=services.php"
# URL for external Directory location
-#directory_url: "http://{$domain_name}/app/provision/?file=directory.php"
+directory_url: "http://{$domain_name}/app/provision/?file=directory.php"
# URL for branding logo
#logo_url: "http://{$domain_name}/app/provision/logo.bmp"
diff --git a/resources/templates/provision/cisco/7940/directory-enterprise.xml b/resources/templates/provision/cisco/7940/directory-enterprise.xml
index 6a538e519d..7b84648f36 100644
--- a/resources/templates/provision/cisco/7940/directory-enterprise.xml
+++ b/resources/templates/provision/cisco/7940/directory-enterprise.xml
@@ -1,19 +1,28 @@
- Speed Dials
+ Enterprise
Please choose...
Dial
SoftKey:Select
1
-
-
+ {assign var=x value=1}
+ {foreach $contacts as $row}
+ {if $row.contact_category == "enterprise"}
+
+ {/if}
+ {/foreach}
Exit
SoftKey:Exit
diff --git a/resources/templates/provision/cisco/7940/directory-personal.xml b/resources/templates/provision/cisco/7940/directory-personal.xml
index 6a538e519d..9d774ab56a 100644
--- a/resources/templates/provision/cisco/7940/directory-personal.xml
+++ b/resources/templates/provision/cisco/7940/directory-personal.xml
@@ -1,19 +1,28 @@
- Speed Dials
+ Personal
Please choose...
Dial
SoftKey:Select
1
-
-
+ {assign var=x value=1}
+ {foreach $contacts as $row}
+ {if $row.contact_category == "personal"}
+
+ {/if}
+ {/foreach}
Exit
SoftKey:Exit
diff --git a/resources/templates/provision/cisco/7940/directory-speed_dial.xml b/resources/templates/provision/cisco/7940/directory-speed_dial.xml
index 6a538e519d..f100c38cd6 100644
--- a/resources/templates/provision/cisco/7940/directory-speed_dial.xml
+++ b/resources/templates/provision/cisco/7940/directory-speed_dial.xml
@@ -1,19 +1,29 @@
- Speed Dials
+ Speed Dial
Please choose...
Dial
SoftKey:Select
1
-
-
+ {assign var=x value=1}
+ {foreach $contacts as $row}
+ {if $row.contact_category == "speed dial"}
+
+ {/if}
+ {assign var=x value=$x+1}
+ {/foreach}
Exit
SoftKey:Exit
diff --git a/resources/templates/provision/cisco/7940/directory.xml b/resources/templates/provision/cisco/7940/directory.xml
index b61f067416..9c90716c7c 100644
--- a/resources/templates/provision/cisco/7940/directory.xml
+++ b/resources/templates/provision/cisco/7940/directory.xml
@@ -1,16 +1,18 @@
Contacts
Please choose...
+
diff --git a/resources/templates/provision/polycom/4.x/{$mac}.cfg b/resources/templates/provision/polycom/4.x/{$mac}.cfg
index 0326802b6e..b5d9431b66 100644
--- a/resources/templates/provision/polycom/4.x/{$mac}.cfg
+++ b/resources/templates/provision/polycom/4.x/{$mac}.cfg
@@ -4,8 +4,10 @@
{foreach $lines as $row}reg.{$row.line_number}.displayName="{$row.user_id}"
reg.{$row.line_number}.address="{$row.user_id}"
reg.{$row.line_number}.label="{$row.user_id}"
+ reg.{$row.line_number}.type="private"
reg.{$row.line_number}.auth.userId="{$row.user_id}"
reg.{$row.line_number}.auth.password="{$row.password}"
+ reg.{$row.line_number}.lineKeys="{$line_key_value_{$row.line_number}}"
{if isset($row.outbound_proxy)}reg.{$row.line_number}.outboundProxy.address = "{$row.outbound_proxy}"{/if}
{if isset($row.sip_port)}reg.{$row.line_number}.outboundProxy.port="{$row.sip_port}"{else}reg.{$row.line_number}.server.1.port="5060"{/if}
diff --git a/resources/templates/provision/polycom/5.x/{$mac}.cfg b/resources/templates/provision/polycom/5.x/{$mac}.cfg
index 0326802b6e..b5d9431b66 100755
--- a/resources/templates/provision/polycom/5.x/{$mac}.cfg
+++ b/resources/templates/provision/polycom/5.x/{$mac}.cfg
@@ -4,8 +4,10 @@
{foreach $lines as $row}reg.{$row.line_number}.displayName="{$row.user_id}"
reg.{$row.line_number}.address="{$row.user_id}"
reg.{$row.line_number}.label="{$row.user_id}"
+ reg.{$row.line_number}.type="private"
reg.{$row.line_number}.auth.userId="{$row.user_id}"
reg.{$row.line_number}.auth.password="{$row.password}"
+ reg.{$row.line_number}.lineKeys="{$line_key_value_{$row.line_number}}"
{if isset($row.outbound_proxy)}reg.{$row.line_number}.outboundProxy.address = "{$row.outbound_proxy}"{/if}
{if isset($row.sip_port)}reg.{$row.line_number}.outboundProxy.port="{$row.sip_port}"{else}reg.{$row.line_number}.server.1.port="5060"{/if}
diff --git a/resources/templates/provision/yealink/t22p/{$mac}.cfg b/resources/templates/provision/yealink/t22p/{$mac}.cfg
index 7fef6e9bfc..ce904e36e6 100644
--- a/resources/templates/provision/yealink/t22p/{$mac}.cfg
+++ b/resources/templates/provision/yealink/t22p/{$mac}.cfg
@@ -223,8 +223,8 @@ account.1.nat.stun_server =
#Configure the STUN server port, the default value is 3478.
account.1.nat.stun_port =
-#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default);
-account.1.nat.udp_update_enable =
+#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
+account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time =
diff --git a/resources/templates/provision/yealink/t23g/{$mac}.cfg b/resources/templates/provision/yealink/t23g/{$mac}.cfg
index e09d088c44..8641aa3259 100644
--- a/resources/templates/provision/yealink/t23g/{$mac}.cfg
+++ b/resources/templates/provision/yealink/t23g/{$mac}.cfg
@@ -126,7 +126,7 @@ account.1.nat.stun_server =
account.1.nat.stun_port = 3478
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
-account.1.nat.udp_update_enable = 1
+account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time = 30
diff --git a/resources/templates/provision/yealink/t23p/{$mac}.cfg b/resources/templates/provision/yealink/t23p/{$mac}.cfg
index e09d088c44..8641aa3259 100644
--- a/resources/templates/provision/yealink/t23p/{$mac}.cfg
+++ b/resources/templates/provision/yealink/t23p/{$mac}.cfg
@@ -126,7 +126,7 @@ account.1.nat.stun_server =
account.1.nat.stun_port = 3478
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
-account.1.nat.udp_update_enable = 1
+account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time = 30
diff --git a/resources/templates/provision/yealink/t26p/{$mac}.cfg b/resources/templates/provision/yealink/t26p/{$mac}.cfg
index ecc4c4997b..2761774eaa 100644
--- a/resources/templates/provision/yealink/t26p/{$mac}.cfg
+++ b/resources/templates/provision/yealink/t26p/{$mac}.cfg
@@ -223,8 +223,8 @@ account.1.nat.stun_server =
#Configure the STUN server port, the default value is 3478.
account.1.nat.stun_port =
-#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default);
-account.1.nat.udp_update_enable =
+#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
+account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time =
diff --git a/resources/templates/provision/yealink/t27p/{$mac}.cfg b/resources/templates/provision/yealink/t27p/{$mac}.cfg
index e09d088c44..8641aa3259 100644
--- a/resources/templates/provision/yealink/t27p/{$mac}.cfg
+++ b/resources/templates/provision/yealink/t27p/{$mac}.cfg
@@ -126,7 +126,7 @@ account.1.nat.stun_server =
account.1.nat.stun_port = 3478
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
-account.1.nat.udp_update_enable = 1
+account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time = 30
diff --git a/resources/templates/provision/yealink/t28p/{$mac}.cfg b/resources/templates/provision/yealink/t28p/{$mac}.cfg
index ecc4c4997b..2761774eaa 100644
--- a/resources/templates/provision/yealink/t28p/{$mac}.cfg
+++ b/resources/templates/provision/yealink/t28p/{$mac}.cfg
@@ -223,8 +223,8 @@ account.1.nat.stun_server =
#Configure the STUN server port, the default value is 3478.
account.1.nat.stun_port =
-#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default);
-account.1.nat.udp_update_enable =
+#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
+account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time =
diff --git a/resources/templates/provision/yealink/t29g/{$mac}.cfg b/resources/templates/provision/yealink/t29g/{$mac}.cfg
index e09d088c44..8641aa3259 100644
--- a/resources/templates/provision/yealink/t29g/{$mac}.cfg
+++ b/resources/templates/provision/yealink/t29g/{$mac}.cfg
@@ -126,7 +126,7 @@ account.1.nat.stun_server =
account.1.nat.stun_port = 3478
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
-account.1.nat.udp_update_enable = 1
+account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time = 30
diff --git a/resources/templates/provision/yealink/t32g/{$mac}.cfg b/resources/templates/provision/yealink/t32g/{$mac}.cfg
index b7de551e22..a7f7534e5e 100644
--- a/resources/templates/provision/yealink/t32g/{$mac}.cfg
+++ b/resources/templates/provision/yealink/t32g/{$mac}.cfg
@@ -223,8 +223,8 @@ account.1.nat.stun_server =
#Configure the STUN server port, the default value is 3478.
account.1.nat.stun_port =
-#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default);
-account.1.nat.udp_update_enable =
+#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
+account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time =
diff --git a/resources/templates/provision/yealink/t38g/{$mac}.cfg b/resources/templates/provision/yealink/t38g/{$mac}.cfg
index e2f464c29b..cffa4df9dc 100644
--- a/resources/templates/provision/yealink/t38g/{$mac}.cfg
+++ b/resources/templates/provision/yealink/t38g/{$mac}.cfg
@@ -223,8 +223,8 @@ account.1.nat.stun_server =
#Configure the STUN server port, the default value is 3478.
account.1.nat.stun_port =
-#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default);
-account.1.nat.udp_update_enable =
+#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
+account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time =
diff --git a/resources/templates/provision/yealink/t41p/{$mac}.cfg b/resources/templates/provision/yealink/t41p/{$mac}.cfg
index e09d088c44..8641aa3259 100644
--- a/resources/templates/provision/yealink/t41p/{$mac}.cfg
+++ b/resources/templates/provision/yealink/t41p/{$mac}.cfg
@@ -126,7 +126,7 @@ account.1.nat.stun_server =
account.1.nat.stun_port = 3478
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
-account.1.nat.udp_update_enable = 1
+account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time = 30
diff --git a/resources/templates/provision/yealink/t42g/{$mac}.cfg b/resources/templates/provision/yealink/t42g/{$mac}.cfg
index 94d6cc28a1..70c98e9022 100644
--- a/resources/templates/provision/yealink/t42g/{$mac}.cfg
+++ b/resources/templates/provision/yealink/t42g/{$mac}.cfg
@@ -126,7 +126,7 @@ account.1.nat.stun_server =
account.1.nat.stun_port = 3478
#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
-account.1.nat.udp_update_enable = 1
+account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time = 30
diff --git a/resources/templates/provision/yealink/vp530/{$mac}.cfg b/resources/templates/provision/yealink/vp530/{$mac}.cfg
index a380a3f81d..b35405d03e 100644
--- a/resources/templates/provision/yealink/vp530/{$mac}.cfg
+++ b/resources/templates/provision/yealink/vp530/{$mac}.cfg
@@ -253,8 +253,8 @@ account.1.nat.stun_server =
#Configure the STUN server port, the default value is 3478.
account.1.nat.stun_port =
-#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default);
-account.1.nat.udp_update_enable =
+#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
+account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time =
diff --git a/resources/templates/provision/yealink/w52p/{$mac}.cfg b/resources/templates/provision/yealink/w52p/{$mac}.cfg
index a6bc0d586a..2509a41fbf 100644
--- a/resources/templates/provision/yealink/w52p/{$mac}.cfg
+++ b/resources/templates/provision/yealink/w52p/{$mac}.cfg
@@ -147,8 +147,8 @@ account.1.nat.stun_server =
#Configure the STUN server port, the default value is 3478.
account.1.nat.stun_port =
-#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default);
-account.1.nat.udp_update_enable =
+#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify;
+account.1.nat.udp_update_enable = 3
#Specify the keep-alive interval (in seconds), the default value is 30.
account.1.nat.udp_update_time =
|