Asterisk timer ztdummy
How to compile ztdummyztdummy is a Linux kernel module that will provide your Asterisk with a Zaptel timer even if you don't have any Digium hardware installed in your Linux server. For Linux kernel version 2.4 the ztdummy module takes timing from the usb-uhci kernel module, which should be loaded before ztdummy. Note that usb-uhci must not be compiled into the kernel, it'll only work with ztdummy if loaded as a module! On kernel version 2.6 ztdummy uses internal high-resolution kernel timer and does not require any USB. Using the internal kernel timer is recommended.
General instructions for compiling all of the zaptel modules including ztdummy are here: Asterisk Zaptel Installation
Do you have the correct USB Controller?If you are using a Linux 2.4 kernel you will need a USB controller to use ztdummy.
There are two types of USB controller chips used on motherboards: USB OHCI and USB UHCI. To use ztdummy, you need an USB UHCI type controller on the motherboard, as the OHCI chips work very differently. If you do not have an appropriate USB controller as a timing source, then you should use Asterisk zaprtc. It was originally written by Klaus-Peter Junghanns and is distributed at http://www.junghanns.net/asterisk/.
- To check if you have the usb_uhci module, do lsmod
- Check out the zaptel module from the Asterisk CVS repository
- Make sure you have the Linux Kernel source files installed
- Edit the Makefile and remove the '#' in front of ztdummy in the top
- Do a make all
- Do make install
- To load the ztdummy, do modprobe ztdummy
You will probably want to include 'modprobe ztdummy' in your /etc/rc.d/rc.local to make sure it is present at startup before Asterisk is launched.
This page contains outdated information. Now that 2.6 kernels are norm, it still talks about 2.4 and 'make linux26' which have been deprecated.
Also these instructions do not work on Fedora 6/7 as of kernel 18.104.22.168-32 . These are the errors when doing modprobe ztdummy after compilation
ztdummy: Unknown symbol rtc_register
ztdummy: Unknown symbol rtc_unregister
ztdummy: Unknown symbol rtc_control
even though crc_ccitt is set as M. here is the output from lsmod | grep zaptel
zaptel 186404 0
crc_ccitt 6337 1 zaptel
There is a bug opened with Digium
Install instructions for Debian Lenny as of 2/3/2010 for ztdummy timerCheck out zaptel package
svn checkout http://svn.digium.com/svn/zaptel/branches/1.4 zaptel
Install kernel source (assuming you've got build-essential)
sudo apt-get install linux-headers-`uname -r`
sudo make install
sudo modprobe ztdummy
Install instructions for CentOS as of 3/10/2008 for ztdummy timer only
Install the CentOS kernel sources (google it)
Build the kernel source
Make sure /usr/src/kernel/.config is your kernel config
Make sure /lib/modules/`uname -r`/build points to your kernel directory
svn co http://svn.digium.com/svn/zaptel/tags/22.214.171.124 zaptel
this: action "Removing zaptel module: " rmmod zaptel
to: action "Removing zaptel module: " rmmod ztdummy zaptel
mkdir -p /var/lib/digium/licenses/
echo zap/*:asterisk:asterisk:660 >> /etc/udev/permissions.d/50-udev.permissions
chkconfig --add zaptel
/etc/init.d/zaptelIf you are running a RedHat based system run
$ make config
from within the zaptel source directory. This will create a file called zaptel in /etc/init.d/. Edit the file and search or MODULES and RMODULES, you will see a list of all of the zaptel modules i.e. wcfxo and wctdm(OLD:wcfxs). I deleted all of the entires with the quotes "" becasue I didn't have any additional hardware and added ztdummy to both fields. You can probably just add ztdummy to the list.
Now if you type
$ sudo service zaptel start
ztdummy should be running. If you use the ntsysv or similar gui utility you can ensure the service starts after all reboots.
Installation for Red Hat/Fedora/CentOS Linux 2.6 kernels and recent Zaptel sources
- Check out the zaptel module from the Asterisk CVS repository
- Make sure you have the Linux kernel source files installed
- cd to the zaptel source directory
- Do make linux26
- Do make install
- Do make config
- Edit /etc/sysconfig/zaptel and comment or delete all MODULES lines except the one referencing ztdummy. Be sure to uncomment the ztdummy line.
- Do /etc/init.d/zaptel start to start zaptel and ztdummy
- Use chkconfig as usual to automate zaptel and ztdummy startup
- Follow the instructions in README.udev so that /dev/zap/pseudo is created with the correct permissions during boot.
Notes: USB existence/type are irrelevant on Linux 2.6 kernels because timing is performed within the kernel. Use lsmod to verify that both zaptel and ztdummy are loaded. If you see "chan_zap.c: Unable to open '/dev/zap/pseudo': No such device or address" in /var/log/asterisk/full, make sure that you followed the instructions in README.udev and edited /etc/udev/permissions.d/50-udev.permissions to include "zap/*:asterisk:asterisk:660". Reboot to make udev changes effective.
undefined reference to `uhci_devices'I was just on the phone with Digium about getting the ztdummy module to compile and load. I followed the instructions above and I was unable to build the module. I kept getting the following errors (RH 7.3, 2.4.20-28.7 Kernel, all updates):
- make ztdummy
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o: In function `_start':
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o(.text+0x18): undefined reference to `main'
ztdummy.o: In function `init_module':
ztdummy.o(.text+0x7): undefined reference to `uhci_devices'
... more errors ...
collect2: ld returned 1 exit status
make: *** [ztdummy] Error 1
Digium suggested the following:
1. Edit Makefile and uncomment ztdummy from the "MODULES" line.
2. Run the command "touch ztdummy.c"
3. Then "make; make install"
4. After that, issuing a "modprobe ztdummy" loaded the module
It worked for me, although this does confuse me a bit, as "make ztdummy" still creates the same errors. Go figure.
Update: Actually, it's quite reasonable - the Makefile tries to build an executable "ztdummy". As there is no code for an executable (read: main(...) ) it fails with the above errors. If you just want to build the ztdummy module, use "make ztdummy.o" for kernels 2.4 or "make ztdummy.ko" for 2.6 respectively.
Auto-Load ztdummyAdd the following to your /etc/modules.conf to get ztdummy to load at boot.
alias char-major-196 ztdummy
ztdummy and Kernel 2.6Recent CVS versions (as of July 2004) also have zaptel modules which work with 2.6 kernels (type "make linux26" to compile them). The 2.6 version of the ztdummy module is completely different to the 2.4 version. Firstly it does not rely on the USB hardware being there; instead it uses the PC hardware's clock (which under 2.6 kernels can be set to generate interrupts at the required precision), so it can be used on any machine, rather than only those with the right USB hardware. Effectively the 2.6 version of ztdummy does the same job as zaprtc does for 2.4 kernels. I have been using ztdummy for 2.6 for a while now, and have had no problems with it.
Update May '05: Timing problems with IAX and MeetMe and a possible solution for 2.6
Please read this and take a look at bug 4301.
Further Update Jan '06: Tony Mountifield' 2.6 timer patches (May '05) are now in ztdummy, however, they require >=2.6.13 to build.
upgrading to from 2.6.12 to 2.6.15 made my zttest score go from 98.5% to 99.95%. This improvement should be sufficient to run
meetme. (but watch out for some scsi driver changes in the kernel.)
To install, simply checkout zaptel from the Asterisk CVS and do the following:
- cd /usr/src/zaptel
- READ /usr/src/zaptel/README.udev and follow the steps
- check modules on: /etc/sysconfig/zaptel> if you have no digium hardware comment out all modeules except ztdummy.
- make install
- Reboot to make udev changes take effect
- modprobe zaptel
- modprobe ztdummy
Should be working. If you are having any problems with the compile, try:
- As root
- /usr/src/linuxsrc2.6.whatever/#> make cloneconfig && make modules
zaptel and xen-kernel 2.6.26-1-xen-686 in Debian LennyRTC is not available in this kernel, thus zaptel will complain "Error inserting ztdummy (/lib/modules/2.6.x.x/misc/ztdummy.ko): Unknown symbol in module, or unknown parameter (see dmesg)"
See notes in this thread. Edit ztdummy.c and comment the defines for RTC (add // before #define USE_RTC). Rebuild a Kernel with CONFIG_HZ=1000 and HighResolutionTimer enabled (apt-get source linux-image-`uname -r`)
FATAL: Error inserting ztdummy (/lib/modules/2.6.x.x/misc/ztdummy.ko): Unknown symbol in module, or unknown parameter (see dmesg)The kernel has to be recompiled with CONFIG_CRC_CCITT=y or CONFIG_CRC_CCITT=m. To do this, run 'make menuconfig' and change it under 'Library Routines -> CRC-CCIT functions'. If you compiled it as a module,
load it, otherwise reboot. If the problem persists, enable RTC in the kernel.
undefined reference to "unlink_td" (wrong UHCI driver)If you get unresolved symbols when you try to load the module and one of the unresolved symbols is "unlink_td" you probably compiled the alternate UHCI drivers instead of the standard one. Apparently ztdummy needs the standard UHCI driver built in the kernel to work correctly. Go back and do a 'make menuconfig'. Unselect the alternate UHCI driver and select the standard one as a module. One you do rebuild the kernel and modules it should work. Install the new kernel and modules and reboot.
WARNING: Error inserting rtc (/lib/modules/2.6.x.x/kernel/drivers/char/rtc.ko): No such deviceThis occurs because module genrtc is loaded. genrtc emulates rtc, you must unload genrtc and load rtc, then you can load tzdummy.
- modprobe ztdummy
WARNING: Error inserting rtc (/lib/modules/2.6.x.x/kernel/drivers/char/rtc.ko): No such device
FATAL: Error inserting ztdummy (/lib/modules/2.6.x.x/misc/ztdummy.ko): Unknown symbol in module, or unknown parameter (see dmesg)
FATAL: Error running install command for ztdummy
ztdummy: unresolved symbol zt_transmit ztdummy: unresolved symbol zt_receive
ztdummy: unresolved symbol zt_register
- lsmod | grep rtc
- rmmod genrtc
- modprobe rtc
- modprobe ztdummy
You can tell that you are loading the wrong UHCI drivers in other ways...
1. The alternate driver usually doesn't load by default.
2. The alternate driver exists and is the only uhci module.
3. The alternate driver is called simply 'uhci.o' instead of the standard one 'usb_uhci".
Update June '06: For best results with ztdummy, use at least a 2.6.13 kernel with one or both of the following built in to the kernel:
Processor Type and Features --> Timer frequency (set this to 1000 Hz)
Device Drivers --> Character devices --> Enhanced Real Time Clock Support
Update 2015 - Debian 3.2 (and late 2.6) kernels: For many (silly) reasons some folks (still) require good old ztdummy for backwards compatibility/testing/migration. There was nothing comprehensive available on the web until now.. there's a fully pre-patched 126.96.36.199 tree here. Download to /usr/src, gunzip, untar and install as per usual zaptel install instructions.
Compiles fine with the newer 2.6 AND 3.2 Debian kernels at least.
Specifically tested with Debian wheezy amd64 running 3.2 kernel and SMP. Same version running under VMWARE compiles and runs just swell too.
It contains patches that fix all the IOCTL changes in kernel > 2.6.36 amongst other things.
Don't forget to tweak zaptel.rules (to accommodate udev changes) by modifying = to == where applicable.
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+