fix voicemail message length and size display (#7185)
This commit is contained in:
parent
cd8d5302ac
commit
58cfa404b7
|
|
@ -313,8 +313,7 @@
|
|||
|
||||
//update the array with additional information
|
||||
if (is_array($result)) {
|
||||
$i = 0;
|
||||
foreach ($result as $row) {
|
||||
foreach ($result as $i => $row) {
|
||||
//set the greeting directory
|
||||
$path = $this->settings->get('switch', 'voicemail', '/var/lib/freeswitch/storage').'/default/'.$_SESSION['domain_name'].'/'.$row['voicemail_id'];
|
||||
if (file_exists($path.'/msg_'.$row['voicemail_message_uuid'].'.wav')) {
|
||||
|
|
@ -323,17 +322,16 @@
|
|||
if (file_exists($path.'/msg_'.$row['voicemail_message_uuid'].'.mp3')) {
|
||||
$result[$i]['file_path'] = $path.'/msg_'.$row['voicemail_message_uuid'].'.mp3';
|
||||
}
|
||||
$result[$i]['file_size'] = filesize($row['file_path'] ?? '');
|
||||
$result[$i]['file_size_label'] = byte_convert($row['file_size'] ?? 0);
|
||||
$result[$i]['file_ext'] = substr($row['file_path'] ?? '', -3);
|
||||
$result[$i]['file_size'] = filesize($result[$i]['file_path'] ?? '');
|
||||
$result[$i]['file_size_label'] = byte_convert($result[$i]['file_size'] ?? 0);
|
||||
$result[$i]['file_ext'] = substr($result[$i]['file_path'] ?? '', -3);
|
||||
|
||||
$message_minutes = floor($row['message_length'] / 60);
|
||||
$message_seconds = $row['message_length'] % 60;
|
||||
|
||||
//use International System of Units (SI) - Source: https://en.wikipedia.org/wiki/International_System_of_Units
|
||||
$result[$i]['message_length_label'] = ($message_minutes > 0 ? $message_minutes.' min' : null).($message_seconds > 0 ? ' '.$message_seconds.' s' : null);
|
||||
$result[$i]['message_length_label'] = ($message_minutes > 0 ? $message_minutes.' min' : '').($message_seconds > 0 ? ' '.$message_seconds.' s' : '');
|
||||
$result[$i]['created_date'] = date("j M Y g:i a",$row['created_epoch']);
|
||||
$i;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue