J.E.B. Solutions Inc.Call 1-416-207-9579 and Ask for Your FREE Consultation
 Web Design 
 Business Streamlining 
 Custom Software 
 Technical Support 
 Backup Strategies 
 Security 101 - Home Users 
 Server Configuration 
 Telephone & VOIP 
 Vonage - First Looks 
 Vonage - Easy Setup 
 Asterisk @ JEB 
 Asterisk @ JEB2 
 Asterisk Features 
 VOIP And 911 Service 
 VOIP Protocols 
 Digium Zap Hardware 
 About Us 

Asterisk Digium Zaptel Hardware TDM Configuration Tweaks

Warning! Warning! Warning

This page is mostly technical details. If this is not for you then we suggest you read one of our other articles on Telephone and VOIP technology.


Digium TDM22B: TDM400P + 2FX0 + 
2FXS Modules The tips and patches provided here are provided "as is" with no warrantee of any kind. Follow this guide at your own risk. Use common sense. Smart people make backups.

I won't claim that this is the best or the only way to do things. However, these steps got our office phone system working nicely with Digium Zaptel hardware with the Asterisk PBX.

Please note that there are still SERIOUS problems with this card and/or the various software that interact with it. After a lot of tweaking most of the problems can be resolved or ignored. However, the fact that ring groups can put an incoming call into limbo hasn't been resolved.

Anyone who can help me resolve this problem will be my hero. :)

Our Office Setup

Our Asterisk server has two Digium TDM400P cards. Each card has two FXO and two FXS modules each. In Digium speak we have two "TDM22B" models. If you want read more about the JEB Office Asterisk Server you can do so here.

Physically Install the Cards

This is pretty straight forward.
  • Shut down your PC
  • Pop open the case
  • Deal with removing all the bad karma and static from your body. Typically I just touch the metal frame of the computer case. I try to avoid shuffling my feet on the rug, petting your fluffy pet, or other static generating activity.
  • Turn off the power supply, but leave it plugged in. Wait thirty seconds. Most computers have a light inside the computer case that turns off when the power is really off.
  • Insert TDM22B cards
  • Connect a power connector to each card. This is necessary or the card will not work!
  • Boot the PC

Ensure You have a Dedicated IRQ for each card!

Digium TDM cards should not share IRQs.

You can check for IRQ sharing by running the command: cat /proc/interrupts. Another useful command is lspci -v.

What can you do if the TDM cards are sharing interrupts? Try the following:

  • Try disabling devices in the BIOS you don't need. I disabled the printer, VGA IRQ among other things.
  • Read your motherboard manual. Some slots may be forced to use certain IRQs. Some slots may share IRQs. You may be able to change IRQ assignment in the BIOS setup or just by moving the card to another slot.

    Keep in mind that moving cards around can cause a plug and play juggle. When you Boot your PC you may have some plug and play fun. Deal with any Kudzu issues and then reboot your computer again. It took three reboots for Kudzu to stop removing/adding devices. After this it locked on to my nice new conflict free IRQ settings.

  • Disable USB and com ports. I'd do this as a last resort because you will have to mess around with etc/inittab and possibly other files to remove lines referencing the removed hardware to prevent errors. Also it's nice to be able to just toss in a USB memory stick for quickly copying files if the network is down.

Check Motherboard PCI version

Asterisk will run on just about any hardware. However, Digium cards need a PCI 2.2 version slot.

If the green lights on the back of the card don't ever turn on, or the card isn't detected by kudzu or genzaptelconf try another motherboard.

Our test Celeron 700MHz machine ran Asterisk perfectly, but was incompatible with the Digium cards. Switching to a system with a newer Asus A7V8X-X motherboard solved the problem.

Disable ztdummy

If you are using TDM cards then you should not be using the ztdummy device. A clue that you are using ztdummy is that cat /proc/interrupts will show a high number of interrupts on a USB device that's constantly increasing at the same rate as your zaptel interrupts are being triggered.

Disabling ztdummy will eliminate 1,000 extra interrupts a second.

Issues with genzaptelconf

Overall genzaptelconf is a great idea. However, the default "genzaptelconf" from Asterisk@home 1.0 has a few flaws due to bad assumptions.

Symptoms may include one or more of the following

  • An extension on a second TDM22B card can answer a call, but not dial out.
  • Running the "zap show channels" command from the asterisk console doesn't correctly show "from-pstn" and "from-internal" correctly for extensions and incoming lines.
  • Extensions and incoming lines are both thrown into the same group=0 (g0) group
  • From the shell running "ztcfg -v -v" doesn't match the zap Show Channels results from the asterisk console.
  • An incoming call with callerid blocked will show the callerid of your last defined zap extension instead of "unknown caller". This also affects the CDR logs.
  • One TDM card worked great, but extensions on the second one don't work properly.

Techno Details

Most of the problems arise from assuming default values. When a value is set these channel settings falling through to the next channel. This may pass incorrect settings to subsequent channels.

Any fxs_ks implicitly gets set for a "from-pstn" context ...but doesn't revert back to "from-internal" for any fxo_ks. This means if you have an extension defined after an incoming line (e.g. the first port on your second TDM22B) it will default it to an incoming line!

Also, both extensions and incoming lines are tossed together into group 0. This can screw up your dialing rules. My original hack was to create a trunk for Zap/3 and Zap/4 and have all my routes use both trunks. However, not having a proper g0 route makes more difficult to generate dial plans and shell scripts that dial out on the first available lines.

My /usr/local/sbin/genzaptelconf Fixes/Tweaks/Features

You can try my patched /usr/local/sbin/genzaptelconf.

This is experimental. Use at your own risk. It works for us, but my fixes may break some other assumption that you are relying on just as badly as the original bad assumptions broke my configuration. :)


  • Fixes the extension (fxo_ks/from-internal) after incoming line (fxs_ks/from-pstn) problem. The from-internal or from-pstn setting is always set and never assumed.
  • Automatically throws extensions into group=1 and incoming lines into group=0. Without this setting the default AAH route of g0 will also try to dial out on your extension as if it was an incoming line.
  • Allows you to add a customized setting that applies to all zap channels (/etc/asterisk/zapata_custom_chan_default.conf). This file is not overwritten when you re-run genzaptelconf.
  • Seems to fix the incoming call blocked call showing the callerid of your last Zap extension instead of "unknown caller" on incoming call blocked calls. It does this by pulling in the extension customizations after the main channel configurations so the extension callerid isn't used as the default for the incoming lines.
  • Allows you to add a customized setting for a specific zap channel (/etc/asterisk/zapata_custom_chan_[channel number].conf). For example, I could create an /etc/asterisk/zapata_custom_chan_3.conf file to boosts the volume only on Zap channel 3.

    It's also good if you want to force the group for a specific port. If you have an unused port on your TDM card (e.g. one of the incoming line ports isn't used yet) you can set this channel to another group so it won't be lumped in with the good incoming lines in the g0 group.

Unrelated Rant

Sadly, sometimes you'll find that your local phone company provides extremely poor service. Sadly mine can't properly install a new phone line. Four months later and they still screwing something up six ways to Sunday. Fortunately, there's Vonage. Read how I got a new Vonage line up and running in five easy steps.

Download the Patched Script

Here's the script: /usr/local/sbin/genzaptelconf. Right click on the link and do a save-as.


I got ahold of the original author of genzaptelconf. He said that Asterisk@home included an older version of his script. Versions of Asterisk@home after 1.5 do include this revised script.

However...you still have to do a small 1 line mod to /etc/asterisk/zapata.conf for it to work.

Here's the genzaptelconf link:

Home | Custom Software | Business Streamlining | Web Design | Multi-Media | Technical Support | About Us
© 2019 J.E.B. Solutions Inc. All rights reserved. terms of use | privacy policy