At Caktus, we use the Asterisk open source telephony platform. While setting up Asterisk, we tested a number of different system environments and configurations to help determine what would best fit our telephone needs. This involved running Asterisk on both real and virtual machines and testing several configuration front ends, including FreePBX and DeStar. This article discusses a fairly technical problem we confronted while installing a basic Asterisk setup on the Debian GNU/Linux operating system (on real hardware); namely, when the ztdummy Linux kernel module was loaded, Asterisk was unable to play back any recordings (even its own). When we unloaded the ztdummy module, however, recordings would play back fine. The catch, of course, was that we needed ztdummy loaded for conference room support.
The keys to discovering the solution to the problem were (a) the exact same configuration worked fine on different hardware, and (b) we had seen problems with the Linux kernel's real time clock (RTC) in virtual machine setups. Furthermore, we saw a lot of the following in syslog:
rtc: lost some interrupts at 1024Hz.
We tried the solution you'll probably find if you Google the above error message:
echo 1024 > /proc/sys/dev/rtc/max-user-freq
Which supposedly allows user-space programs to employ a higher timer frequency than the normal default (64). In our case, however, Asterisk behavior remained unchanged. In short, the problem appeared to be a bug related to the RTC and zaptel's ztdummy module (which is used for timing).
While we consistently tried to avoid rebuilding the kernel, it finally seemed that it might be worth a try after all other options had failed. We chose a solution we had seen for users running Asterisk in a virtual environment, which is to recompile one's kernel with 1000Hz High-Res Timers and prevent ztdummy from using the RTC. It worked great (and it's the solution we're still using today). Here's the basic process on a Debian Etch system:
apt-get install linux-source-2.6.18 kernel-package cd /usr/src/linux-source-2.6.18 make menuconfig
Now navigate to 'Processor type and features' and set 'Timer frequency' to 1000Hz (about 5 up from the bottom). Hit Exit twice and safe the config. Now:
make-kpkg --append-to-version '-freq1000' --revision 1 kernel_image cd .. dpkg --i dpkg -i linux-image-2.6.18-freq1000_1_i386.deb update-initramfs -k 2.6.18-freq1000 -c update-grub
Now check out /boot and /boot/grub/menu.lst, make sure everything looks okay, and reboot. If the kernel booted okay, you can now build the modified ztdummy:
apt-get install module-assistant m-a prepare m-a update m-a get zaptel m-a unpack zaptel cd /usr/src/modules/zaptel vim ztdummy.c # find #define USE_RTC and comment it out m-a -O build zaptel # the -O is important, it tells m-a not to overwrite your changes cd /usr/src dpkg -i --force-overwrite zaptel-modules-2.6.18-freq1000_1.2.11.dfsg-1+1_i386.deb modprobe ztdummy
Finally, check dmesg to make sure the module loaded okay, verify that you have a load statement for chan_zap.so in /etc/asterisk/modules.conf, and restart Asterisk. You should be good to go!