Move the find_app method to the xml_cdr class
This commit is contained in:
parent
b2e05fb0f6
commit
1e06e3aa1c
|
|
@ -39,6 +39,7 @@ if (!class_exists('xml_cdr')) {
|
|||
public $array;
|
||||
public $fields;
|
||||
public $setting;
|
||||
public $domain_uuid;
|
||||
public $call_details;
|
||||
public $call_direction;
|
||||
public $billsec;
|
||||
|
|
@ -49,7 +50,7 @@ if (!class_exists('xml_cdr')) {
|
|||
/**
|
||||
* user summary
|
||||
*/
|
||||
public $domain_uuid;
|
||||
|
||||
public $quick_select;
|
||||
public $start_stamp_begin;
|
||||
public $start_stamp_end;
|
||||
|
|
@ -1068,7 +1069,7 @@ if (!class_exists('xml_cdr')) {
|
|||
|
||||
//get the application array
|
||||
if (!empty($destination_array) && !empty($row["caller_profile"]["destination_number"])) {
|
||||
$app = find_app($destination_array, urldecode($row["caller_profile"]["destination_number"]));
|
||||
$app = $this->find_app($destination_array, urldecode($row["caller_profile"]["destination_number"]));
|
||||
}
|
||||
|
||||
//call centers
|
||||
|
|
@ -1182,7 +1183,7 @@ if (!class_exists('xml_cdr')) {
|
|||
|
||||
//add the application and destination details
|
||||
$language2 = new text;
|
||||
$text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$app['application']);
|
||||
$text2 = $language2->get($this->setting->get('domain', 'language'), 'app/'.$app['application']);
|
||||
$call_flow_summary[$x]["application_name"] = $app['application'];
|
||||
$call_flow_summary[$x]["application_label"] = trim($text2['title-'.$app['application']]);
|
||||
$call_flow_summary[$x]["application_url"] = $application_url;
|
||||
|
|
@ -1217,6 +1218,74 @@ if (!class_exists('xml_cdr')) {
|
|||
return $call_flow_summary;
|
||||
}
|
||||
|
||||
//add a function to return the find_app
|
||||
public function find_app($destination_array, $detail_action) {
|
||||
|
||||
//add the destinations to the destination array
|
||||
$sql = "select * from v_destinations ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$database = new database;
|
||||
$destinations = $database->select($sql, $parameters, 'all');
|
||||
if (!empty($destinations)) {
|
||||
foreach($destinations as $row) {
|
||||
$destination_array['destinations'][$id]['application'] = 'destinations';
|
||||
$destination_array['destinations'][$id]['destination_uuid'] = $row["destination_uuid"];
|
||||
$destination_array['destinations'][$id]['uuid'] = $row["destination_uuid"];
|
||||
$destination_array['destinations'][$id]['dialplan_uuid'] = $row["dialplan_uuid"];
|
||||
$destination_array['destinations'][$id]['destination_type'] = $row["destination_type"];
|
||||
$destination_array['destinations'][$id]['destination_prefix'] = $row["destination_prefix"];
|
||||
$destination_array['destinations'][$id]['destination_number'] = $row["destination_number"];
|
||||
$destination_array['destinations'][$id]['extension'] = $row["destination_prefix"] . $row["destination_number"];
|
||||
$destination_array['destinations'][$id]['destination_trunk_prefix'] = $row["destination_trunk_prefix"];
|
||||
$destination_array['destinations'][$id]['destination_area_code'] = $row["destination_area_code"];
|
||||
$destination_array['destinations'][$id]['context'] = $row["destination_context"];
|
||||
$destination_array['destinations'][$id]['label'] = $row["destination_description"];
|
||||
$destination_array['destinations'][$id]['destination_enabled'] = $row["destination_enabled"];
|
||||
$destination_array['destinations'][$id]['name'] = $row["destination_description"];
|
||||
$destination_array['destinations'][$id]['description'] = $row["destination_description"];
|
||||
//$destination_array[$id]['destination_caller_id_name'] = $row["destination_caller_id_name"];
|
||||
//$destination_array[$id]['destination_caller_id_number'] = $row["destination_caller_id_number"];
|
||||
$id++;
|
||||
}
|
||||
}
|
||||
unset($sql, $parameters, $row);
|
||||
|
||||
$result = '';
|
||||
if (!empty($destination_array)) {
|
||||
foreach($destination_array as $application => $row) {
|
||||
if (!empty($row)) {
|
||||
foreach ($row as $key => $value) {
|
||||
//find matching destinations
|
||||
if ($application == 'destinations') {
|
||||
if ('+'.$value['destination_prefix'].$value['destination_number'] == $detail_action
|
||||
or $value['destination_prefix'].$value['destination_number'] == $detail_action
|
||||
or $value['destination_number'] == $detail_action
|
||||
or $value['destination_trunk_prefix'].$value['destination_number'] == $detail_action
|
||||
or '+'.$value['destination_prefix'].$value['destination_area_code'].$value['destination_number'] == $detail_action
|
||||
or $value['destination_prefix'].$value['destination_area_code'].$value['destination_number'] == $detail_action
|
||||
or $value['destination_area_code'].$value['destination_number'] == $detail_action) {
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$application."/app_languages.php")) {
|
||||
$value['application'] = $application;
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//find all other matching actions
|
||||
if ($value['extension'] == $detail_action or preg_match('/^'.$value['extension'].'$/', $detail_action)) {
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$application."/app_languages.php")) {
|
||||
$value['application'] = $application;
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get xml from the filesystem and save it to the database
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -46,73 +46,6 @@
|
|||
$uuid = $_REQUEST["id"];
|
||||
}
|
||||
|
||||
//add a function to return the find_app
|
||||
function find_app($destination_array, $detail_action) {
|
||||
|
||||
//add the destinations to the destination array
|
||||
$sql = "select * from v_destinations ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$destinations = $database->select($sql, $parameters, 'all');
|
||||
if (!empty($destinations)) {
|
||||
foreach($destinations as $row) {
|
||||
$destination_array['destinations'][$id]['application'] = 'destinations';
|
||||
$destination_array['destinations'][$id]['destination_uuid'] = $row["destination_uuid"];
|
||||
$destination_array['destinations'][$id]['uuid'] = $row["destination_uuid"];
|
||||
$destination_array['destinations'][$id]['dialplan_uuid'] = $row["dialplan_uuid"];
|
||||
$destination_array['destinations'][$id]['destination_type'] = $row["destination_type"];
|
||||
$destination_array['destinations'][$id]['destination_prefix'] = $row["destination_prefix"];
|
||||
$destination_array['destinations'][$id]['destination_number'] = $row["destination_number"];
|
||||
$destination_array['destinations'][$id]['extension'] = $row["destination_prefix"] . $row["destination_number"];
|
||||
$destination_array['destinations'][$id]['destination_trunk_prefix'] = $row["destination_trunk_prefix"];
|
||||
$destination_array['destinations'][$id]['destination_area_code'] = $row["destination_area_code"];
|
||||
$destination_array['destinations'][$id]['context'] = $row["destination_context"];
|
||||
$destination_array['destinations'][$id]['label'] = $row["destination_description"];
|
||||
$destination_array['destinations'][$id]['destination_enabled'] = $row["destination_enabled"];
|
||||
$destination_array['destinations'][$id]['name'] = $row["destination_description"];
|
||||
$destination_array['destinations'][$id]['description'] = $row["destination_description"];
|
||||
//$destination_array[$id]['destination_caller_id_name'] = $row["destination_caller_id_name"];
|
||||
//$destination_array[$id]['destination_caller_id_number'] = $row["destination_caller_id_number"];
|
||||
$id++;
|
||||
}
|
||||
}
|
||||
unset($sql, $parameters, $row);
|
||||
|
||||
$result = '';
|
||||
if (!empty($destination_array)) {
|
||||
foreach($destination_array as $application => $row) {
|
||||
if (!empty($row)) {
|
||||
foreach ($row as $key => $value) {
|
||||
//find matching destinations
|
||||
if ($application == 'destinations') {
|
||||
if ('+'.$value['destination_prefix'].$value['destination_number'] == $detail_action
|
||||
or $value['destination_prefix'].$value['destination_number'] == $detail_action
|
||||
or $value['destination_number'] == $detail_action
|
||||
or $value['destination_trunk_prefix'].$value['destination_number'] == $detail_action
|
||||
or '+'.$value['destination_prefix'].$value['destination_area_code'].$value['destination_number'] == $detail_action
|
||||
or $value['destination_prefix'].$value['destination_area_code'].$value['destination_number'] == $detail_action
|
||||
or $value['destination_area_code'].$value['destination_number'] == $detail_action) {
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$application."/app_languages.php")) {
|
||||
$value['application'] = $application;
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//find all other matching actions
|
||||
if ($value['extension'] == $detail_action or preg_match('/^'.$value['extension'].'$/', $detail_action)) {
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$application."/app_languages.php")) {
|
||||
$value['application'] = $application;
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//get the cdr string from the database
|
||||
$sql = "select * from v_xml_cdr ";
|
||||
if (permission_exists('xml_cdr_all')) {
|
||||
|
|
@ -218,6 +151,7 @@
|
|||
|
||||
//build the call flow summary array
|
||||
$xml_cdr = new xml_cdr;
|
||||
$xml_cdr->domain_uuid = $_SESSION['domain_uuid'];
|
||||
$xml_cdr->call_direction = $call_direction;
|
||||
$xml_cdr->billsec = $billsec;
|
||||
if (empty($call_flow)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue