Zaptel timers for Asterisk
There are at least two Asterisk applications that need support of a timer to work properly:
- Asterisk cmd MeetMe: The conferencing application
- Asterisk iax channels: IAX trunking
It may also be required with Music on Hold, i.e. to improve sound quality.
For Linux, several solutions exist to provide a timer, for other operating systems there is nothing, yet.
How to get a working timer
- Zaptel hardware device will provide timing to Asterisk.
- ztdummy is a dummy Zaptel device that provides no channels and only timing. It can use various sources for the timing
- Linux kernels with HZ set to 1000. This was the default of kernel 2.6.0 - 2.6.12, and normally requires a kernel rebuild on newer kernels.
- RTC support - works in i386 and amd64 as of 2.6.15.
- HPET timers - for even newer kernels (right now requires an external patch, see http://bugs.digium.com/view.php?id=10314 ).
- UHCI USB controller - abuses a timer in those USB controllers (controllers made by Intel or Via). Should work on any kernel.
The above should work with minimal tweaking in a default installation of Zaptel.
Some alternatives that have been suggested to ztdummy over the years:
- If you don't have Digium hardware, there are three replacements:
- Asteriks realzap: This trivial zap driver can generate zaptel timing out of anything. However you need to have RTAI running, which is far from trivial! realzap comes with bristuff http://www.junghanns.net/downloads/
- zaprtc found on http://www.junghanns.net/downloads/ uses the real time clock in the PC instead. Look for Zaprtc on the lower left hand of the web page. The version 0.0.1 is for kernel 2.4. For 2.6 use zaprtc from bristuff package. Zaprtc will not work on SMP systems (Multiprocessor), where the RTC clock is used for SMP support. Is it still true? See http://lists.digium.com/pipermail/asterisk-dev/2004-September/006022.html.
Note: Zaprtc is actually a replacement for the standard RTC module. It provides the same facilities, but includes extra parts for Zaptel use. You will need to unload standard RTC module (rmmod rtc) or re-compile the kernel without RTC support (in your kernel source dir: "make menuconfig" --> Character Devices --> uncheck Enhanced Real Time Clock; now re-compile the kernel) in order to be able to use zaprtc.
For FreeBSD
- See Asterisk FreeBSD: Zaptel driver development for FreeBSD
For OpenWRT
- See the OpenWRT forum on the dummy zaptel driver for Asterisk on OpenWRT running the Linux 2.4 kernels in the stable (WhiteRussian) releases.
Comments
333unable to open IAX timing interface
crw-rw---- 1 root audio 10, 135 2008-04-29 17:25 /dev/rtc
I do have a /dev/rtc file in place. I was hoping to run this without the ztdummy module, however I will continue to investigate.
333
Why can't we use /dev/rtc ?
For imformation mplayer use /dev/rtc @1024 if it can from years.
PS : I am not sure POSIX timer could provide a such resolution.
333Re: Clarification usage on ztdummy
Linux provides many types of real-time timers. You don't need to maintain a crappy little non-standard and non-portable driver. The asterisk server should be using POSIX timers.
This is just oh-my-god bad. What a hack!
333Error message - is this caused by a timing problem?
— Accepting AUTHENTICATED call from 217.160.244.186, requested format = 4, actual format = 4
— Executing Answer("IAX2/livevoip@217.160.244.186:4569/3", "") in new stack
— Executing Wait("IAX2/livevoip@217.160.244.186:4569/3", "2") in new stack
— Executing AGI("IAX2/livevoip@217.160.244.186:4569/3", "areskicc.php") in new stack
— Launched AGI Script /var/lib/asterisk/agi-bin/areskicc.php
areskicc.php: 'agi_request' => 'areskicc.php'
areskicc.php: 'agi_channel' => 'IAX2/livevoip@217.160.244.186:4569/3'
areskicc.php: 'agi_language' => 'en'
areskicc.php: 'agi_type' => 'IAX2'
areskicc.php: 'agi_uniqueid' => '1110514027.0'
areskicc.php: 'agi_callerid' => '"8005550000" '
areskicc.php: 'agi_dnid' => 'unknown'
areskicc.php: 'agi_rdnis' => 'unknown'
areskicc.php: 'agi_context' => 'livevoipinbound'
areskicc.php: 'agi_extension' => '8005550001'
areskicc.php: 'agi_priority' => '3'
areskicc.php: 'agi_enhanced' => '0.0'
areskicc.php: 'agi_accountcode' => ''
areskicc.php: 'dig' => '/usr/bin/dig'
areskicc.php: 'debug' => 'true'
areskicc.php: >> ANSWER
areskicc.php: string(82) ""8005550000" ; IAX2/livevoip@217.160.244.186:4569/3 ; 1110514027.0 ; "n
areskicc.php: string(26) "Requesting DTMF ::> Len-10"n
areskicc.php: >> GET DATA prepaid-enter-pin-number 10000 10
— Playing 'prepaid-enter-pin-number' (language 'en')
Mar 10 23:07:09 NOTICE954: res_musiconhold.c:309 monmp3thread: Request to schedule in the past?!?!
Mar 10 23:07:09 WARNING962: file.c:1058 ast_waitstream_full: Wait failed (No such file or directory)
== Spawn extension (livevoipinbound, 8005550001, 3) exited non-zero on 'IAX2/livevoip@217.160.244.186:4569/3'
— Hungup 'IAX2/livevoip@217.160.244.186:4569/3'
333AutoStart Kernel 2.6
333Re: Clarification usage on ztdummy
333Clarification usage on ztdummy
333more about ztdummy
after successfully modprobing ztdummy, you should now have /proc/zaptel
upon asterisk startup in the logs you might see:
Mar 23 11:27:36 WARNING16384: Unable to open IAX timing interface: Permission denied
this refers to /dev/zap/pseudo. make it read/writable by the process running asterisk.
The "Unable to load config iax1.conf" message in the log file is unrelated, as are the "ignoring port for now", and "ignoring rxwink". You can rid yourself of these warnings by copying iax.conf into iax1.conf.
333ztdummy
I used this ztdummy-module and got scratched up sound from asterisk. (worked before)
With zaprtc it worked better however for all hardcore linuxers: You HAVE to execute the rtcsetup. I am not completely clear what it does but if you dont execute it asterisk will not respond. (asterisks scheduler will have no timing instead of a bad one :)
And if you get messages about missing symbols when loading one of the kernel modules you should do "lsmod" and look if the module is loaded. You find it in your sourcedirectory after compiling called "zaptel.o".