Choppy Custom Recordings and Voicemail (MOH and built-in recordings work fine)

I’m a newbie to Linux/Asterisk/FreePBX but I’m catching on quick. I’ve spent the last week trying to get a system up and running the way I want.

The only thing keeping me from rolling this out to production is audio issues on anything that I have recorded myself using the System Recordings Module from a connected phone or any of my voice mail messages that I have recorded. The audio seems to skip or stutter randomly every 5-10 seconds.

If I download the actual recorded .wav file to my computer and play it, it sounds crystal clear, so this appears to be a playback issue within Asterisk. The problem does not seem to present itself when playing any of the built-in Asterisk files (including Music on Hold). Also, this doesn’t appear to be an issue with my phones as the same problem presents itself whether I connect via a SIP extension or from an outside line via the Trunk.

CPU Usage stays below 1% while playing back the audio, so it doesn’t appear to be a performance issue.

The likely culprit, from what I have read so far, seems to be a timing issue. This is a VOIP only setup with no FXO/FXS card. I am using dahdi_dummy which appears to be up and running, but performing below par. dahdi_test gives Max 99.995% Min 99.683% Avg 99.883.

My asterisk server (CentOS 5.4) is running on a virtual machine under Windows Server 2008 Hyper-V R2 and has the latest (version 2.0) Integration Services for Linux installed. Unfortunately, I believe the virtual environment is what is causing my timing problems. The integration services offer support for accelerated disk and ethernet access via VMBUS, but I don’t believe there is any hardware timing or synchronization support.

I’m hoping someone on the forum can give me some direction on how to either improve my timing issues, or get around them. Since the built-in recordings and music on hold files are in ulaw format, and my SIP trunk and phones use ulaw, and those files seem to work, I would like to try using ulaw as the format for my own custom recording to see if that solves the problem. Unfortunately, I haven’t been able to find a way to change the default recording format for the System Recordings module or for voicemail. I did find the Call Recording Format setting within the General Settings Module, but this doesn’t seem to have any effect on the System Recordings or voicemail.

I would try recording the files locally in the ulaw format and then uploading them, but I’m not sure where I would even start to get a file recorded or converted into ulaw format.

Any help or suggestions on getting System Recordings to record in ulaw or in getting better timing results would be much appreciated.

Here are all of the relevant bits about my system setup that I can think of. Let me know if I am missing something relevant:

CentOS 5.4
Kernel 2.6.18-164.11.1.el5 x86_64 SMP
Asterisk 1.6.0.21.1
FreePBX 2.0.6.1

I installed using the AsteriskNow 1.5 (x86_64) iso, then updated the kernel so that I could properly install the Microsoft Integration Services. After installing the Integration Services I did a yum update to update all modules to the latest versions. Then I had to manually fix a bunch of folder permissions and ownership settings that got overwritten to get everything working. Then I upgraded to FreePBX 2.0.6.1 using the GUI based upgrade module. Then I upgraded to Asterisk 1.6.0.21.1 from Asterisk 1.4.0.29 (I believe), however, the audio problems were present before the upgrade to Asterisk 1.6.

So I figured out how to record and convert my *.wav files using sox from the command line. Unfortunately, the only way I could get FreePBX to see these new recordings was to transfer them to my windows machine via pscp over ssh, then upload them from the System Recordings Module.

I tried ulaw gsm and sln formats and they don’t seem to make much difference. Gsm sounded terrible, ulaw sounded good but had the same stuttering problem, and sln was perhaps a little better than ulaw and wav with perhaps a little less stuttering. Unfortunately, the stuttering is not consistent so its very subjective trying to decide what really works better.

Here’s the command I used to convert the files:

sox mysound.wav mysound.gsm
sox mysound.wav -t raw -s -w -c 1 mysound.sln

I couldn’t get sox to convert ulaw so I found a way to convert using Audacity for windows. Exported the wav file as uncompressed, raw (no header), U-law with a .ulaw extension.

Also, upon further consideration, it is possible that the same stuttering problem does exist with the built-in recordings, just that they are too short to notice. Typical it only stutters ever 5 or 6 seconds. Also, with the Music on Hold, it may be that because it isn’t speech, the stuttering isn’t as noticeable.

If anyone has encountered these stuttering issues and has found any way to get around it with some audio format or with some other tweak, please let me know. I’m almost ready to just live with the stuttering, but unfortunately it sometimes falls on a key word or phrase. (“For sales press *&#[email protected]” is pretty frustrating to a caller.)

PS. I also tried enabling Jitter Buffer via the Asterisk SIP Settings Module with the default settings and it doesn’t seem to make any difference.

I had the exact same problem which was driving me crazy. My setup was identical except I’m using 1.6.2 and FreePBX 2.7. I read through the timing.txt document which had a lot of good information. I found my version here (https://reviewboard.asterisk.org/r/164/diff/5/?file=2927#file2927line14).

Based on this I built asterisk removing the res_timing_pthread.so from the build and then manually deleting the file from /usr/lib/asterisk/modules. This greatly improved the playback of system recordings and eliminated the annoying pauses I had with system recordings.

I still get pauses on voicemail greetings and voicemail recordings. I’m going to play around a little with a few more settings to see if I can get this resolved. I think I’ll try removing the dahdi timing module too.

Rob

I’m not sure this made much of a difference but I’m sure there is a way to make this work. I’m thinking about testing a version under ubuntu 9.10 since the kernel is much newer and will support the timing without dahdi.

Rob

I’m giving up running this setup. I think the timing issues will end up causing too many issues. I’ve read about some other people running it under OpenVZ or VMWare so I think I’ll try that instead, or stick with the dedicated machines for now. I don’t think Hyper-V is a good platform for this particular deployment. I’ve got other Linux VM’s running without issue but they don’t have timing sensitive apps like asterisk.

If anyone else manages to ever get this working with a future version of Hyper-V, Integration Services, or Asterisk, let me know. I’d love to get this working under Hyper-V Server.

In the mean time, I’ve resorted to running a dedicated box.

I decided to work through installing openvz and it has been working great without the voicemail issues. I’ve also tested fax receiving and been getting good results.

It has been a major pain to set up and learn. I built the HN (host) as a CentOS 5.4 machine on an older P4, 3.00GHz machine. I used the 2.6.26 kernel version of openvz. I’m running ubuntu 9.10 in the container so that I get the latest distributions of glibc. By taking these steps I was able to completely eliminate dahdi from the install and instead rely on the kernel timing. I have only installed asterisk and asterisk addons (plus spandsp for faxing).

No call quality or overall issues so far with asterisk running in the container and faxing has been more reliable then I had on a dedicated CentOS machine…probably due to the improved timing but I really don’t know.

I’m going to create some more containers for asterisk and see how it goes. The openvz approach for containers sharing the same kernel probably is a better fit for asterisk virtualization.

Rob