Summary:ASTERISK-03796: [patch] ztdummy support in zaptel.init
Reporter:Paul Dugas (pdugas)Labels:
Date Opened:2005-03-28 13:50:27.000-0600Date Closed:2008-06-07 10:50:25
Versions:Frequency of
Environment:Attachments:( 0) zaptel.init.bug3886patch.txt
( 1) zaptel.init.patch
Description:Not sure if this will be of any use to others but I need to load zaptel and ztdummy on boot for my VoIP only installation.  Attached is a patch for zaptel.init that looks for ZTDUMMY_ONLY=yes (I set it in my /etc/sysconfig/zaptel).  If it finds it, it loads zaptel without waiting for /dev/zap (which never gets created without hardware apparently) then loads ztdummy.


If you like, I suggest adding a commented out line in zaptel.sysconfig like so:

#ZTDUMMY_ONLY=yes  # uncomment to NOT load hardware modules

With a suitable explanatory comment.

(I faxed in my wavier a few months back.)
Comments:By: Paul Dugas (pdugas) 2005-03-28 15:16:59.000-0600

Need to take part of this back...  /dev/zap wasn't being created because I didn't remember the udev additions on this box.  I've modified my version of zaptel.init to just put the <code>if [ "${ZTDUMMY_ONLY}" = "yes" ]; then...</code> around the hardware module loading/unloading only.

By: Paul Dugas (pdugas) 2005-03-28 21:28:48.000-0600

Okay.  I'm going to back-pedal again and suggest that all that is needed is to change the definition of MODULES and RMODULES (set them both to "ztdummy") if there is not zaptel hardware in the machine.  Sorry for the noise to get to something that simple.

By: Mark Spencer (markster) 2005-03-28 22:50:36.000-0600

How about this...  patch zaptel.init so that if none of the drivers load, we load ztdummy (if it's around)...

By: Kevin P. Fleming (kpfleming) 2005-03-31 10:34:26.000-0600

Unfortunately, with 2.6 kernels, the modules will load regardless of the presence of the hardware (which is as designed, not a bug).

I suspect that the only way to "know" there is no Zaptel hardware in the machine is to attempt to load all hardware drivers, then wait an appropriate amount of time for them to initialize and be told about the available boards. Once that is done, you can check the output of ztcfg or /dev/zap/* to see if any channels appeared. If not, then load ztdummy.

Would it be possible to make ztdummy make itself 'secondary', so that it only provides it services when no hardware modules are doing so? That would allow it to be loaded at all times, and it would provide timing if no hardware is present or if the hardware drivers are unloaded for some reason.

By: Kevin P. Fleming (kpfleming) 2005-03-31 14:36:52.000-0600

After some discussion, it appears the simplest way to do this is to just try loading the hardware drivers, and then after waiting a few seconds (2-3), check /proc/zaptel. If it's empty, then you don't have any functioning Zaptel hardware and ztdummy needs to be loaded.

By: Kenneth Shumard (kshumard) 2005-03-31 22:00:01.000-0600

Implemented per kpfleming's suggestion in zaptel.init.bug3886patch.txt. (Disclaimer on file)

edited on: 03-31-05 22:00

By: Kevin P. Fleming (kpfleming) 2005-03-31 22:47:26.000-0600

Committed to CVS, thanks!

By: Russell Bryant (russell) 2005-04-04 02:22:01

not included in 1.0 since it is a new feature

By: Digium Subversion (svnbot) 2008-06-07 10:50:25

Repository: dahdi
Revision: 612

U   trunk/zaptel.init

r612 | kpfleming | 2008-06-07 10:50:24 -0500 (Sat, 07 Jun 2008) | 3 lines

Make zaptel.init automatically load ztdummy if none of the hardware
drivers find any Zaptel hardware (bug ASTERISK-3796)