Unable to play voicemail file and also download from ARI portal


I am unable to play voicemail file and also download from ARI portal.

The code of audio.php are below:-

<?php /** * @file * plays recording file */ if (isset($_GET['recindex'])) { chdir(".."); include_once("./includes/bootstrap.php"); $path = $_SESSION['ari_user']['recfiles'][$_GET['recindex']]; // See if the file exists if (!is_file($path)) { die("404 File not found!"); } // Gather relevent info about file $size = filesize($path); $name = basename($path); $extension = strtolower(substr(strrchr($name,"."),1)); // This will set the Content-Type to the appropriate setting for the file $ctype =''; switch( $extension ) { case "mp3": $ctype="audio/mpeg"; break; case "wav": $ctype="audio/x-wav"; break; case "Wav": $ctype="audio/x-wav"; break; case "WAV": $ctype="audio/x-wav"; break; case "gsm": $ctype="audio/x-gsm"; break; // not downloadable default: die("404 File not found!"); break ; } // need to check if file is mislabeled or a liar. $fp=fopen($path, "rb"); if ($size && $ctype && $fp) { header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: wav file"); header("Content-Type: " . $ctype); header("Content-Disposition: attachment; filename=" . $name); header("Content-Transfer-Encoding: binary"); header("Content-length: " . $size); fpassthru($fp); } } ?>

This is very critical server for my organization.
Please advise me how to play and download voicemail file from ARI portal.


We know how the code look like, there is absolutely no need to post that.

Please post your FreePBX version together with Asterisk version and your browser you have tested it with.


Thanks for your reply.

The details are below:-

FreePBX version is FreePBX-
Asterisk version is Asterisk 1.4.35
Browser is Firefox and Chromium both.


FreePBX- is old, please upgrade to the latest 2.8 and test again.


It is very critical server.
Can you please tell me any bug on this version FreePBX- ?
How to solve without upgrading ?

Please help us.


If it is a critical server, then click on the link under my name and call Paid Support.

Bugs and features fixed from to (framework):
#4858, #4844, #4501, #4616, #4693, #4719, #4680
#4585, #4587, #4549, #4602, #4603, #4494, #4615 (Security Bug)
#4245, #4461

Is FreePBX-2.9.0 OK ?

FreePBX 2.9 is the latest stable release.

I’m having a similar problem. I’m running FreePBX with Asterisk

I haven’t tried for a while but I’m fairly positive that with FreePBX 2.8, everything worked fine. I just upgraded to FreePBX 2.9 and then noticed that I can no longer play the recordings. I have the recordings emailed to me and the attachments play as expected.

I can’t however play them from the web interface nor can I even play them on the phone. On the phone it just acts like the message is zero seconds long and on the web interface I can’t play or download.

If I try to download I get a 404 message. If I try to play directly in the browser I get a blank line below the message details but nothing starts playing. If I try to play to the extension it places the call but there is nothing to hear once connected.

It appears that the index file somehow got confused. I can copy either the wav or the WAV file to my PC using Webmin file manager and both of them play back with no problems. Any suggestions?

I’m having the same problem. Not only can I not play new voicemails via ARI, I cannot play voicemails that were left prior to the upgrade.

The other thing I noticed is that I cannot navigate around ARI at all. Any time I try I’m getting kicked back to the log in screen almost like there’s an issue with the Session variable.

I did upgrade CentOS the other day and php-* was upgraded to 5.1.6-27 and http to 2.2.3-53.

I’m running Asterisk and FreePBX with all modules up to date.

I have a 2.9 migration tonight from 2.8. Our tests on the backup server can’t replication this issue.

I believe I was already running 2.9 before this started happening. The more I’m looking at it, the more I think the issue was caused by the CentOS update, but I can’t confirm that. If that is indeed the case, i don’t know why I only see a problem with ARI and not with the FreePBX panel.

It looks like I was correct for, at least, my case. My assumption is that when php-common was upgraded it reset the ownership on /var/lib/php/session back to root.apache. After changing ownership to asterisk.asterisk, everything started working normally.

Changing ownership fixed my problem as well. Thanks very much! :slight_smile: