New setting save_call_detail_record

If blocked by call block option to save the call detail record true or false.
This commit is contained in:
FusionPBX
2024-04-30 18:21:42 -06:00
committed by GitHub
parent 6176ea2376
commit d11308b844
2 changed files with 31 additions and 3 deletions

View File

@@ -39,6 +39,14 @@
$apps[$x]['default_settings'][$y]['default_setting_value'] = "50";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Number of recent calls to show.";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "47914bd9-e1c0-4e3d-87e0-41f95d58ce98";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "call_block";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "save_call_detail_record";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "boolean";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "false";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Choose whether to save the call detail record when the call is blocked.";
//permission details
$y=0;
@@ -194,4 +202,4 @@
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
?>
?>

View File

@@ -330,10 +330,27 @@ if (!class_exists('xml_cdr')) {
return false;
}
//skip call detail records for calls blocked by call block
if (isset($xml->variables->call_block) && !empty($this->setting->get('call_block', 'save_call_detail_record'))) {
if ($xml->variables->call_block == 'true' && $this->setting->get('call_block', 'save_call_detail_record') == 'false') {
//delete the xml cdr file
if (!empty($this->setting->get('switch', 'log'))) {
$xml_cdr_dir = $this->setting->get('switch', 'log').'/xml_cdr';
if (file_exists($xml_cdr_dir.'/'.$this->file)) {
unlink($xml_cdr_dir.'/'.$this->file);
}
}
//return without saving
return false;
}
}
//check for duplicate call uuid's
$duplicate_uuid = false;
$uuid = urldecode($xml->variables->uuid);
if ($uuid != null && is_uuid($uuid)) {
//check for duplicates
$sql = "select count(xml_cdr_uuid) ";
$sql .= "from v_xml_cdr ";
$sql .= "where xml_cdr_uuid = :xml_cdr_uuid ";
@@ -350,6 +367,9 @@ if (!class_exists('xml_cdr')) {
unlink($xml_cdr_dir.'/'.$this->file);
}
}
//return without saving
return false;
}
unset($sql, $parameters);
}
@@ -364,7 +384,7 @@ if (!class_exists('xml_cdr')) {
$accountcode = urldecode($xml->variables->accountcode);
}
//process data if the call detail record is not a duplicate
//process call detail record data
if ($duplicate_uuid == false && is_uuid($uuid)) {
//get the caller ID from call flow caller profile
@@ -2046,4 +2066,4 @@ if (!class_exists('xml_cdr')) {
} //class
}
?>
?>