add call duration to the active calls page (#7191)

* add call duration to the active calls page

* add duration label for active calls
This commit is contained in:
chansizzle
2024-12-04 15:13:25 -07:00
committed by GitHub
parent f0837e173b
commit 014adb461b
2 changed files with 46 additions and 0 deletions
+19
View File
@@ -170,6 +170,7 @@
}
echo " <th>".$text['label-profile']."</th>\n";
echo " <th>".$text['label-created']."</th>\n";
echo " <th>".$text['label-duration']."</th>\n";
if ($show == 'all') {
echo " <th>".$text['label-domain']."</th>\n";
}
@@ -229,6 +230,24 @@
}
echo " <td>".escape($sip_profile)."&nbsp;</td>\n";
echo " <td>".escape($created)."&nbsp;</td>\n";
// Convert $created to a UNIX timestamp
$created_timestamp = strtotime($created);
// Get the current timestamp
$now = time();
// Calculate elapsed seconds
$elapsed_seconds = $now - $created_timestamp;
// Convert seconds to hours, minutes, and seconds
$hours = floor($elapsed_seconds / 3600);
$minutes = floor(($elapsed_seconds % 3600) / 60);
$seconds = $elapsed_seconds % 60;
// Format the elapsed time as HH:MM:SS
$elapsed_time = sprintf('%02d:%02d:%02d', $hours, $minutes, $seconds);
echo " <td>".escape($elapsed_time)."</td>\n";
if ($show == 'all') {
echo " <td>".escape($domain_name)."&nbsp;</td>\n";
}