Add new class methods called call_flow and call_flow_summary

This commit is contained in:
FusionPBX 2023-10-17 16:21:17 -06:00 committed by GitHub
parent aee8664098
commit 7c98190bde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 301 additions and 307 deletions

View File

@ -5,7 +5,7 @@
$apps[$x]['uuid'] = "4a085c51-7635-ff03-f67b-86e834422848";
$apps[$x]['category'] = "Switch";
$apps[$x]['subcategory'] = "";
$apps[$x]['version'] = "1.0";
$apps[$x]['version'] = "1.1";
$apps[$x]['license'] = "Mozilla Public License 1.1";
$apps[$x]['url'] = "http://www.fusionpbx.com";
$apps[$x]['description']['en-us'] = "Call Detail Records with all information about the call.";
@ -778,6 +778,12 @@
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Save who hung up or cancelled the leg.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "call_flow";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "jsonb";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "xml";
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "xml_cdr";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";

View File

@ -39,8 +39,11 @@ if (!class_exists('xml_cdr')) {
public $array;
public $fields;
public $setting;
public $call_details;
public $call_direction;
private $username;
private $password;
private $json;
/**
* user summary
@ -137,6 +140,7 @@ if (!class_exists('xml_cdr')) {
$this->fields[] = "direction";
$this->fields[] = "default_language";
$this->fields[] = "context";
$this->fields[] = "call_flow";
$this->fields[] = "xml";
$this->fields[] = "json";
$this->fields[] = "missed_call";
@ -779,7 +783,7 @@ if (!class_exists('xml_cdr')) {
}
}
}
//check to see if file exists with the default file name and path
if (empty($record_name)) {
$path = $this->setting->get('switch', 'recordings').'/'.$domain_name.'/archive/'.$start_year.'/'.$start_month.'/'.$start_day;
@ -828,39 +832,8 @@ if (!class_exists('xml_cdr')) {
}
}
//add to the call recordings table
/*
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/call_recordings/app_config.php")) {
//build the array
$x = 0;
$array['call_recordings'][$x]['call_recording_uuid'] = $uuid;
$array['call_recordings'][$x]['domain_uuid'] = $domain_uuid;
$array['call_recordings'][$x]['call_recording_name'] = $record_name;
$array['call_recordings'][$x]['call_recording_path'] = $record_path;
$array['call_recordings'][$x]['call_recording_length'] = $record_length;
$array['call_recordings'][$x]['call_recording_date'] = date('c', $start_epoch);
$array['call_recordings'][$x]['call_direction'] = urldecode($call_direction);
//$array['call_recordings'][$x]['call_recording_description']= $row['zzz'];
//$array['call_recordings'][$x]['call_recording_base64']= $row['zzz'];
//add the temporary permission
$p = new permissions;
$p->add("call_recording_add", "temp");
$p->add("call_recording_edit", "temp");
$database = new database;
$database->app_name = 'call_recordings';
$database->app_uuid = '56165644-598d-4ed8-be01-d960bcb8ffed';
$database->domain_uuid = $domain_uuid;
$database->save($array, false);
//$message = $database->message;
//remove the temporary permission
$p->delete("call_recording_add", "temp");
$p->delete("call_recording_edit", "temp");
unset($array);
}
*/
//save the xml object to json
$this->json = json_encode($xml);
//save to the database in xml format
if ($this->setting->get('cdr', 'format') == "xml" && $this->setting->get('cdr', 'storage') == "db") {
@ -869,9 +842,15 @@ if (!class_exists('xml_cdr')) {
//save to the database in json format
if ($this->setting->get('cdr', 'format') == "json" && $this->setting->get('cdr', 'storage') == "db") {
$this->array[$key]['json'] = json_encode($xml);
$this->array[$key]['json'] = $this->json;
}
//build the call detail array with json decode
$this->call_details = json_decode($this->json, true);
//get the call flow json
$this->array[$key]['call_flow'] = json_encode($this->call_flow());
//get the extension_uuid and then add it to the database fields array
if (isset($xml->variables->extension_uuid)) {
$this->array[$key]['extension_uuid'] = urldecode($xml->variables->extension_uuid);
@ -945,6 +924,199 @@ if (!class_exists('xml_cdr')) {
} //if ($duplicate_uuid == false)
} //function xml_array
/**
* Build a call flow array based on call details.
*
* This method constructs an array that represents the call flow, utilizing the provided call_details array. Reverses the array to put the events in chronological order and adds profile end times.
*
* @return array The call flow array.
*/
public function call_flow() {
//save the call flow to the database
if (isset($this->call_details['callflow'])) {
//set the call flow array
$call_flow_array = $this->call_details['callflow'];
//normalize the array
if (!isset($call_flow_array[0])) {
$tmp = $call_flow_array;
unset($call_flow_array);
$call_flow_array[0] = $tmp;
}
//reverse the array to put events in chronological order
$call_flow_array = array_reverse($call_flow_array);
//add the profile end time to the call flow array
$i = 0;
foreach ($call_flow_array as $row) {
//set the profile end time
if (isset($call_flow_array[$i+1]["times"]["profile_created_time"])) {
$call_flow_array[$i]["times"]["profile_end_time"] = $call_flow_array[$i+1]["times"]["profile_created_time"];
}
else {
$call_flow_array[$i]["times"]["profile_end_time"] = urldecode($this->call_details['variables']['end_uepoch']);
}
$i++;
}
//format the times in the call flow array and add the profile duration
$i = 0;
foreach ($call_flow_array as $row) {
foreach ($row["times"] as $name => $value) {
if ($value > 0) {
$call_flow_array[$i]["times"]["profile_duration_seconds"] = round(((int) $call_flow_array[$i]["times"]["profile_end_time"])/1000000 - ((int) $call_flow_array[$i]["times"]["profile_created_time"])/1000000);
$call_flow_array[$i]["times"]["profile_duration_formatted"] = gmdate("G:i:s", (int) $call_flow_array[$i]["times"]["profile_duration_seconds"]);
//$call_flow_array[$i]["times"][$name.'stamp'] = date("Y-m-d H:i:s", (int) $value/1000000);
}
}
$i++;
}
//add the call_flow to the array
return $call_flow_array;
}
}
/**
* Build a call flow summary array based on call summary
*
* This method constructs an array that represents the call flow summary using the call flow array array. The call flow summary array contains a simplified view of the call flow.
*
* @return array The call flow summary array.
*/
public function call_flow_summary($call_flow_array) {
//set the time zone
if (!empty($this->setting->get('domain', 'time_zone'))) {
$time_zone = $this->setting->get('domain', 'time_zone');
}
else {
$time_zone = date_default_timezone_get();
}
//get the destination select list
$destination = new destinations;
$destination_array = $destination->get('dialplan');
//build the call flow summary
$x = 0;
if (!empty($call_flow_array)) {
foreach ($call_flow_array as $row) {
//get the application array
$app = find_app($destination_array, urldecode($row["caller_profile"]["destination_number"]));
//call centers
if ($app['application'] == 'call_centers') {
if (isset($row["caller_profile"]["transfer_source"])) {
$app['status'] = 'Answered'; //Out
}
else {
$app['status'] = 'Waited'; //In
}
}
//conferences
if ($app['application'] == 'conferences') {
$app['status'] = 'Answered';
}
//destinations
if ($app['application'] == 'destinations') {
$app['status'] = 'Routed';
}
//extensions
if ($app['application'] == 'extensions') {
if ($billsec == 0) {
$app['status'] = 'Missed';
}
else {
$app['status'] = 'Answered';
}
}
//outbound routes
if ($this->call_direction == 'outbound') {
$app['application'] = 'dialplans';
$app['uuid'] = '';
$app['status'] = '';
$app['name'] = 'Outbound';
$app['label'] = 'Outbound';
}
//ring groups
if ($app['application'] == 'ring_groups') {
$app['status'] = 'Waited';
}
//time conditions
if ($app['application'] == 'time_conditions') {
$app['status'] = 'Routed';
}
//valet park
if (substr($row["caller_profile"]["destination_number"], 0, 4) == 'park'
or (substr($row["caller_profile"]["destination_number"], 0, 3) == '*59'
&& strlen($row["caller_profile"]["destination_number"]) == 5)) {
$app['application'] = 'dialplans';
$app['uuid'] = '46ae6d82-bb83-46a3-901d-33d0724347dd';
$app['status'] = '---';
$app['name'] = 'Park';
$app['label'] = 'Park';
}
//voicemails
if ($app['application'] == 'voicemails') {
$app['status'] = 'Answered';
}
//build the application urls
$destination_url = "/app/".$app['application']."/".$destination->singular($app['application'])."_edit.php?id=".$app["uuid"];
$application_url = "/app/".$app['application']."/".$app['application'].".php";
if ($app['application'] == 'call_centers') {
$destination_url = "/app/".$app['application']."/".$destination->singular($app['application'])."_queue_edit.php?id=".$app['uuid'];
$application_url = "/app/".$app['application']."/".$destination->singular($app['application'])."_queues.php";
}
//add the application and destination details
$language2 = new text;
$text2 = $language2->get($_SESSION['domain']['language']['code'], '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;
$call_flow_summary[$x]["destination_uuid"] = $app['uuid'];
$call_flow_summary[$x]["destination_name"] = $app['name'];
$call_flow_summary[$x]["destination_url"] = $destination_url;
$call_flow_summary[$x]["destination_number"] = $row["caller_profile"]["destination_number"];
$call_flow_summary[$x]["destination_label"] = $app['label'];
$call_flow_summary[$x]["destination_status"] = $app['status'];
$call_flow_summary[$x]["destination_description"] = $app['description'];
//$call_flow_summary[$x]["application"] = $app;
//set the start and epoch
$profile_created_epoch = round($row['times']['profile_created_time'] / 1000000);
$profile_end_epoch = round($row['times']['profile_end_time'] / 1000000);
//add the call flow times
$call_flow_summary[$x]["start_epoch"] = $profile_created_epoch;
$call_flow_summary[$x]["end_epoch"] = $profile_end_epoch;
$call_flow_summary[$x]["start_stamp"] = date("Y-m-d H:i:s", $profile_created_epoch);
$call_flow_summary[$x]["end_stamp"] = date("Y-m-d H:i:s", $profile_end_epoch);
$call_flow_summary[$x]["duration_seconds"] = $row['times']['profile_duration_seconds'];
$call_flow_summary[$x]["duration_formatted"] = $row['times']['profile_duration_formatted'];
unset($app);
$x++;
}
}
unset($x);
//return the call flow summary array
return $call_flow_summary;
}
/**
* get xml from the filesystem and save it to the database
*/

View File

@ -46,50 +46,45 @@
$uuid = $_REQUEST["id"];
}
//get the destination select list
$destination = new destinations;
$destination_array = $destination->get('dialplan');
//get the next ordinal id for the array
$id = count($destination_array);
//get the destinations from the database
$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);
//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
@ -104,6 +99,8 @@
}
}
}
//find all other matching actions
if ($value['extension'] == $detail_action) {
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$application."/app_languages.php")) {
$value['application'] = $application;
@ -139,6 +136,7 @@
$start_stamp = trim($row["start_stamp"]);
$xml_string = trim($row["xml"] ?? '');
$json_string = trim($row["json"]);
$call_flow = trim($row["call_flow"]);
$direction = trim($row["direction"]);
$call_direction = trim($row["direction"]);
$status = trim($row["status"]);
@ -213,199 +211,36 @@
$outbound_caller_id_name = urldecode($array["variables"]["outbound_caller_id_name"]);
$outbound_caller_id_number = urldecode($array["variables"]["outbound_caller_id_number"]);
//normalize the array
if (!isset($array["callflow"][0])) {
$tmp = $array["callflow"];
unset($array["callflow"]);
$array["callflow"][0] = $tmp;
}
//set the time zone
if (isset($_SESSION['domain']['time_zone']['name'])) {
date_default_timezone_set($_SESSION['domain']['time_zone']['name']);
}
//reverse the array to put events in chronological order
$array["callflow"] = array_reverse($array["callflow"]);
//add the profile end time to the call flow array
$i = 0;
foreach ($array["callflow"] as $row) {
//set the profile end time
if (isset($array["callflow"][$i+1]["times"]["profile_created_time"])) {
$array["callflow"][$i]["times"]["profile_end_time"] = $array["callflow"][$i+1]["times"]["profile_created_time"];
}
else {
$array["callflow"][$i]["times"]["profile_end_time"] = $end_epoch * 1000000;
}
$i++;
//build the call flow summary array
$xml_cdr = new xml_cdr;
$xml_cdr->call_direction = $call_direction;
if (empty($call_flow)) {
$xml_cdr->call_details = $array;
$call_flow_array = $xml_cdr->call_flow();
}
//format the times in the call flow array and add the profile duration
$i = 0;
foreach ($array["callflow"] as $row) {
foreach ($row["times"] as $name => $value) {
if ($value > 0) {
$array["callflow"][$i]["times"]["profile_duration_seconds"] = round(((int) $array["callflow"][$i]["times"]["profile_end_time"])/1000000 - ((int) $array["callflow"][$i]["times"]["profile_created_time"])/1000000);
$array["callflow"][$i]["times"]["profile_duration_formatted"] = gmdate("G:i:s", (int) $array["callflow"][$i]["times"]["profile_duration_seconds"]);
$array["callflow"][$i]["times"][$name.'stamp'] = date("Y-m-d H:i:s", (int) $value/1000000);
}
}
$i++;
else {
$call_flow_array = json_decode($call_flow, true);
}
$call_flow_summary = $xml_cdr->call_flow_summary($call_flow_array);
//debug information
if (isset($_REQUEST['debug']) && $_REQUEST['debug'] == 'true') {
view_array($array["callflow"], false);
}
//count the callflow array
$callflow_count = 0;
if (!empty($array["callflow"])) {
$callflow_count = count($array["callflow"]);
}
//add the final call flow destination to the call flow array
//when call_direction is inbound
//when destination_number is not same as the last row
//when last destination is not voicemail *99ext
//count the array $i-1 finds the last record
//count the array $i is the next record
/*
if ($call_direction == 'inbound') {
//count the array
$i = $callflow_count;
//get the application array
if (!empty($array["callflow"][$i-1]["caller_profile"]["destination_number"])) {
$app = find_app($destination_array, $array["callflow"][$i-1]["caller_profile"]["destination_number"]);
}
//add last row to the array
if (!empty($array["callflow"])
&& $array["callflow"][$i-1]["destination_number"] != $destination_number
&& $app["application"] != 'conferences'
&& substr($array["callflow"][$i-1]["caller_profile"]["destination_number"], 0, 3) != '*99') {
$array["callflow"][$i]["caller_profile"]["destination_number"] = $destination_number;
$array["callflow"][$i]["caller_profile"]["network_addr"] = $network_address;
$array["callflow"][$i]["caller_profile"]["caller_id_name"] = $caller_id_name;
$array["callflow"][$i]["caller_profile"]["caller_id_number"] = $caller_id_number;
//$array["callflow"][$i]["times"]["profile_created_time"] = ($end_epoch - $duration) * 1000000;
$array["callflow"][$i]["times"]["end_stamp"] = $end_epoch * 1000000;
$array["callflow"][$i]["times"]["hangup_time"] = $end_epoch * 1000000;
$callflow_count++;
$i = 0;
foreach ($call_flow_array as $row) {
foreach ($row["times"] as $name => $value) {
if ($value > 0) {
$call_flow_array[$i]["times"][$name.'stamp'] = date("Y-m-d H:i:s", (int) $value/1000000);
}
}
$i++;
}
view_array($call_flow_array, false);
}
*/
//build the call summary array
$x = 0;
if (!empty($array["callflow"])) {
foreach ($array["callflow"] as $row) {
//get the application array
$app = find_app($destination_array, urldecode($row["caller_profile"]["destination_number"]));
//call centers
if ($app['application'] == 'call_centers') {
if (isset($row["caller_profile"]["transfer_source"])) {
$app['status'] = 'Answered'; //Out
}
else {
$app['status'] = 'Waited'; //In
}
}
//conferences
if ($app['application'] == 'conferences') {
$app['status'] = 'Answered';
}
//destinations
if ($app['application'] == 'destinations') {
$app['status'] = 'Routed';
}
//extensions
if ($app['application'] == 'extensions') {
if ($billsec == 0) {
$app['status'] = 'Missed';
}
else {
$app['status'] = 'Answered';
}
}
//outbound routes
if ($call_direction == 'outbound') {
$app['application'] = 'dialplans';
$app['uuid'] = '';
$app['status'] = '';
$app['name'] = 'Outbound';
$app['label'] = 'Outbound';
}
//ring groups
if ($app['application'] == 'ring_groups') {
$app['status'] = 'Waited';
}
//time conditions
if ($app['application'] == 'time_conditions') {
$app['status'] = 'Routed';
}
//valet park
if (substr($row["caller_profile"]["destination_number"], 0, 4) == 'park'
or (substr($row["caller_profile"]["destination_number"], 0, 3) == '*59'
&& strlen($row["caller_profile"]["destination_number"]) == 5)) {
$app['application'] = 'dialplans';
$app['uuid'] = '46ae6d82-bb83-46a3-901d-33d0724347dd';
$app['status'] = '---';
$app['name'] = 'Park';
$app['label'] = 'Park';
}
//voicemails
if ($app['application'] == 'voicemails') {
$app['status'] = 'Answered';
}
//build the application urls
$destination_url = "/app/".$app['application']."/".$destination->singular($app['application'])."_edit.php?id=".$app["uuid"];
$application_url = "/app/".$app['application']."/".$app['application'].".php";
if ($app['application'] == 'call_centers') {
$destination_url = "/app/".$app['application']."/".$destination->singular($app['application'])."_queue_edit.php?id=".$app['uuid'];
$application_url = "/app/".$app['application']."/".$destination->singular($app['application'])."_queues.php";
}
//add the application and destination details
$language2 = new text;
$text2 = $language2->get($_SESSION['domain']['language']['code'], '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;
$call_flow_summary[$x]["destination_uuid"] = $app['uuid'];
$call_flow_summary[$x]["destination_name"] = $app['name'];
$call_flow_summary[$x]["destination_url"] = $destination_url;
$call_flow_summary[$x]["destination_number"] = $row["caller_profile"]["destination_number"];
$call_flow_summary[$x]["destination_label"] = $app['label'];
$call_flow_summary[$x]["destination_status"] = $app['status'];
$call_flow_summary[$x]["destination_description"] = $app['description'];
//$call_flow_summary[$x]["application"] = $app;
//add the call flow times
$call_flow_summary[$x]["start_epoch"] = round($row['times']['profile_created_time'] / 1000000);
$call_flow_summary[$x]["end_epoch"] = round($row['times']['profile_end_time'] / 1000000);
$call_flow_summary[$x]["start_stamp"] = $row['times']['profile_created_timestamp'];
$call_flow_summary[$x]["end_stamp"] = $row['times']['profile_end_timestamp'];
$call_flow_summary[$x]["duration_seconds"] = $row['times']['profile_duration_seconds'];
$call_flow_summary[$x]["duration_formatted"] = $row['times']['profile_duration_formatted'];
unset($app);
$x++;
}
}
unset($x);
//set the year, month and date
$tmp_year = date("Y", strtotime($start_stamp));
@ -466,8 +301,7 @@
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br />\n";
echo "<br />\n";
echo "<br /><br />\n";
//show the content
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
@ -477,6 +311,7 @@
echo "</tr>\n";
echo "</table>\n";
//show the call summary - vertical
if ($_SESSION['cdr']['summary_style']['text'] == 'vertical') {
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
@ -496,6 +331,7 @@
echo "<br /><br />\n";
}
//show the call summary - horizontal
if ($_SESSION['cdr']['summary_style']['text'] == 'horizontal') {
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<th>".$text['label-direction']."</th>\n";
@ -510,7 +346,6 @@
echo "<th align='center'>".$text['label-status']."</th>\n";
echo "<th>".$text['label-hangup_cause']."</th>\n";
echo "</tr>\n";
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'><a href='xml_cdr_details.php?id=".urlencode($uuid)."'>".escape($direction)."</a></td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$language."</td>\n";
@ -549,27 +384,23 @@
echo "<br /><br />\n";
}
echo "</table>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left'><b>".$text['label-call_flow_summary']."</b>&nbsp;</td>\n";
echo "<td></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>".$text['label-application']."</th>\n";
echo "<th>".$text['label-destination']."</th>\n";
echo "<th>".$text['label-name']."</th>\n";
echo "<th>".$text['label-start']."</th>\n";
echo "<th>".$text['label-end']."</th>\n";
echo "<th>".$text['label-status']."</th>\n";
echo "<th>".$text['label-duration']."</th>\n";
echo "</tr>\n";
//show the call flow summary
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo " <td align='left'><b>".$text['label-call_flow_summary']."</b>&nbsp;</td>\n";
echo " <td></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo " <th>".$text['label-application']."</th>\n";
echo " <th>".$text['label-destination']."</th>\n";
echo " <th>".$text['label-name']."</th>\n";
echo " <th>".$text['label-start']."</th>\n";
echo " <th>".$text['label-end']."</th>\n";
echo " <th>".$text['label-status']."</th>\n";
echo " <th>".$text['label-duration']."</th>\n";
echo "</tr>\n";
$i = 1;
foreach ($call_flow_summary as $row) {
echo "<tr >\n";
@ -598,18 +429,17 @@
if (!empty($array["call-stats"]) && is_array($array["call-stats"])) {
if (!empty($array["call-stats"]['audio']) && is_array($array["call-stats"]['audio'])) {
foreach ($array["call-stats"]['audio'] as $audio_direction => $stat) {
echo " <table width='95%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td><b>".$text['label-call-stats'].": ".$audio_direction."</b>&nbsp;</td>\n";
echo " <td>&nbsp;</td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "<table width='95%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo " <td><b>".$text['label-call-stats'].": ".$audio_direction."</b>&nbsp;</td>\n";
echo " <td>&nbsp;</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <th width='30%'>".$text['label-name']."</th>\n";
echo " <th width='70%'>".$text['label-value']."</th>\n";
echo " </tr>\n";
echo "<tr>\n";
echo " <th width='30%'>".$text['label-name']."</th>\n";
echo " <th width='70%'>".$text['label-value']."</th>\n";
echo "</tr>\n";
foreach ($stat as $key => $value) {
if (!empty($value) && is_array($value)) {
echo "<tr >\n";
@ -644,15 +474,11 @@
}
$c = $c ? 0 : 1;
}
echo " <tr>\n";
echo " <td colspan='2'><br /><br /></td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br /><br />\n";
}
}
}
echo "</table>";
echo "<br /><br />\n";
//channel data loop
$c = 0;
@ -664,7 +490,6 @@
echo "<td></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th width='30%'>".$text['label-name']."</th>\n";
@ -695,7 +520,6 @@
echo "<td></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th width='30%'>".$text['label-name']."</th>\n";
@ -748,7 +572,7 @@
echo "</table>";
echo "<br /><br />\n";
//app_log
//application log
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
@ -773,6 +597,7 @@
$app_name = $row["app_name"];
$app_data = urldecode($row["app_data"]);
}
//multiple apps
else {
$app_name = $row["@attributes"]["app_name"];
@ -792,8 +617,8 @@
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
if (is_array($array["callflow"])) {
foreach ($array["callflow"] as $row) {
if (is_array($call_flow_array)) {
foreach ($call_flow_array as $row) {
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo " <td align='left'>\n";
@ -805,7 +630,6 @@
echo " <td>&nbsp;</td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <th width='30%'>".$text['label-name']."</th>\n";
@ -833,7 +657,6 @@
echo " <td>&nbsp;</td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <th width='30%'>".$text['label-name']."</th>\n";
@ -895,7 +718,6 @@
echo " <td>&nbsp;</td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <th width='30%'>".$text['label-name']."</th>\n";
@ -975,7 +797,6 @@
echo " <td><b>".$text['label-call-flow-5']."</b>&nbsp;</td>\n";
echo " <td></td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <th width='30%'>".$text['label-name']."</th>\n";
echo " <th width='70%'>".$text['label-value']."</th>\n";
@ -990,11 +811,6 @@
$c = $c ? 0 : 1;
}
}
echo " <tr>\n";
echo " <td colspan='2'><br /><br /></td>\n";
echo " </tr>\n";
echo " </table>";
echo " <br /><br />\n";