mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-16 19:50:19 +01:00
misc/zaptel: Added to 12.0 repository
This commit is contained in:
parent
aeaff03f0e
commit
bfa15f6fd3
6 changed files with 390 additions and 0 deletions
43
misc/zaptel/README
Normal file
43
misc/zaptel/README
Normal file
|
@ -0,0 +1,43 @@
|
|||
The zaptel drivers and binaries are needed to use popular digital and
|
||||
analogue telephony equipment and are typically installed alongside the
|
||||
asterisk PBX (although these are not required for asterisk if you are
|
||||
not using any hardware to interface with the POTS/PSTN system). Note
|
||||
that if you change your kernel after installing zaptel, you'll have to
|
||||
re-compile zaptel (a simple re-install will not suffice).
|
||||
|
||||
The rc script included will handle loading and unloading kernel modules
|
||||
for you. By default, it will attempt to load the wctdm module for the
|
||||
common Digium cards, and if this fails, will load ztdummy to give you
|
||||
a timing device. Simply edit the MODULES variable at the top of the
|
||||
rc script to load other modules if your hardware requires it. These
|
||||
modules should *not* be loaded in rc.local or rc.modules, but rather
|
||||
here, as starting and stopping rc.zaptel will cause these modules to
|
||||
re-read their config file if you make any changes.
|
||||
|
||||
Users outside of North America may find that they need to edit the
|
||||
zconfig.h file to specify their region's tones. This script does not
|
||||
handle that at present. The statement you'll wish to change is:
|
||||
#define DEFAULT_TONE_ZONE=0
|
||||
|
||||
The Asterisk Handbook First Edition lists the following zones:
|
||||
0 - North America
|
||||
1 - Australia
|
||||
2 - France
|
||||
7 - Japan
|
||||
14 - Taiwan
|
||||
There are many others. Consult your documentation, or google.
|
||||
|
||||
To start zaptel at system boot, do the following:
|
||||
# chmod +x /etc/rc.d/rc.zaptel
|
||||
|
||||
Also, you'll need to add a statement such as the following to rc.local:
|
||||
if [ -x /etc/rc.d/rc.zaptel ]; then
|
||||
/etc/rc.d/rc.zaptel start
|
||||
fi
|
||||
|
||||
rc.zaptel will create a lockfile that is removed when the service is
|
||||
stopped using this script. Thus, you should probably put this in
|
||||
rc.local_shutdown:
|
||||
if [ -x /etc/rc.d/rc.zaptel ]; then
|
||||
/etc/rc.d/rc.zaptel stop
|
||||
fi
|
27
misc/zaptel/doinst.sh
Normal file
27
misc/zaptel/doinst.sh
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
|
||||
config() {
|
||||
NEW="$1"
|
||||
OLD="$(dirname $NEW)/$(basename $NEW .new)"
|
||||
# If there's no config file by that name, mv it over:
|
||||
if [ ! -r $OLD ]; then
|
||||
mv $NEW $OLD
|
||||
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy
|
||||
rm $NEW
|
||||
fi
|
||||
# Otherwise, we leave the .new copy for the admin to consider...
|
||||
}
|
||||
|
||||
# Keep same perms on rc.zaptel.new:
|
||||
if [ -e etc/rc.d/rc.zaptel ]; then
|
||||
cp -a etc/rc.d/rc.zaptel etc/rc.d/rc.zaptel.new.incoming
|
||||
cat etc/rc.d/rc.zaptel.new > etc/rc.d/rc.zaptel.new.incoming
|
||||
mv etc/rc.d/rc.zaptel.new.incoming etc/rc.d/rc.zaptel.new
|
||||
fi
|
||||
|
||||
config etc/rc.d/rc.zaptel.new
|
||||
config etc/zaptel.conf.new
|
||||
|
||||
# Since we're creating kernel modules, this is necessary
|
||||
chroot . depmod -a 2>/dev/null
|
||||
|
209
misc/zaptel/rc.zaptel
Normal file
209
misc/zaptel/rc.zaptel
Normal file
|
@ -0,0 +1,209 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# This shell script takes care of loading and unloading
|
||||
# Zapata Telephony interfaces
|
||||
#
|
||||
# This script is a heavily modified version of zaptel.init found
|
||||
# in the zaptel source archive and thus is covered under the GNU
|
||||
# General Public License version 2.
|
||||
#
|
||||
# Some parts Copyright 2007, Alan Hicks, Lizella, GA
|
||||
#
|
||||
|
||||
# What modules should we try to load on 'start'? By default, we'll
|
||||
# attempt to load the driver for the popular Digium WildCat cards. If
|
||||
# this fails or no modules are specified, the ztdummy module will be
|
||||
# automatically loaded to provide a timing mechanism in the kernel.
|
||||
# If you need some other modules loaded, seperate them with spaces.
|
||||
# MODULES="foo bar"
|
||||
MODULES="wctdm"
|
||||
|
||||
ZTCFG_CMD=/sbin/ztcfg
|
||||
FXOTUNE=/sbin/fxotune
|
||||
LOCKFILE=/var/lock/subsys/zaptel
|
||||
|
||||
# The default syncer Astribank. Usually set automatically to a sane
|
||||
# value by xpp_sync(1) if you have an Astribank. You can set this to an
|
||||
# explicit Astribank (e.g: 01).
|
||||
XPP_SYNC=auto
|
||||
|
||||
# The maximal timeout (seconds) to wait for udevd to finish generating
|
||||
# device nodes after the modules have loaded and before running ztcfg.
|
||||
ZAP_DEV_TIMEOUT=20
|
||||
|
||||
#####################################################################
|
||||
## ##
|
||||
## NOTHING BELOW HERE SHOULD NEED TO BE CHANGED ##
|
||||
## ##
|
||||
#####################################################################
|
||||
|
||||
# recursively unload a module and its dependencies, if possible.
|
||||
# For some reason, modprobe can't seem to remove these modules
|
||||
# on its own, so we kludge this here.
|
||||
# inputs: module to unload.
|
||||
# returns: the result from
|
||||
unload_module() {
|
||||
module="$1"
|
||||
line=$(lsmod 2>/dev/null | grep "^$1 ")
|
||||
if [ "$line" = '' ]; then return; fi # module was not loaded
|
||||
|
||||
set -- $line
|
||||
# $1: the original module, $2: size, $3: refcount, $4: deps list
|
||||
mods=$(echo $4 | tr , ' ')
|
||||
# xpp_usb keeps the xpds below busy if an xpp hardware is
|
||||
# connected. Hence must be removed before them:
|
||||
case "$module" in xpd_*) mods="xpp_usb $mods";; esac
|
||||
for mod in $mods; do
|
||||
# run in a subshell, so it won't step over our vars:
|
||||
(unload_module $mod)
|
||||
# TODO: the following is probably the error handling we want:
|
||||
# if [ $? != 0 ]; then return 1; fi
|
||||
done
|
||||
rmmod $module
|
||||
}
|
||||
|
||||
# I have not tested this function in the least, so I cannot say if it
|
||||
# works properly with Slackware or not. If you can, please test this
|
||||
# and report back any problems or successes you may have so we can fix
|
||||
# this in the SlackBuild script. With that said, I don't see any reason
|
||||
# why this function would not work.
|
||||
# -- Alan Hicks
|
||||
hpec_start() {
|
||||
# HPEC license found
|
||||
if ! echo /var/lib/digium/licenses/HPEC-*.lic | grep -v '\*' | grep -q .; then
|
||||
return
|
||||
fi
|
||||
|
||||
# zaphpec_enable not installed in /usr/sbin
|
||||
if [ ! -f /usr/sbin/zaphpec_enable ]; then
|
||||
echo -n "Running zaphpec_enable: Failed"
|
||||
echo -n "."
|
||||
echo " The zaphpec_enable binary is not installed in /usr/sbin."
|
||||
return
|
||||
fi
|
||||
|
||||
# zaphpec_enable not set executable
|
||||
if [ ! -x /usr/sbin/zaphpec_enable ]; then
|
||||
echo -n "Running zaphpec_enable: Failed"
|
||||
echo -n "."
|
||||
echo " /usr/sbin/zaphpec_enable is not set as executable."
|
||||
return
|
||||
fi
|
||||
|
||||
# zaphpec_enable properly installed
|
||||
action "Running zaphpec_enable: " /usr/sbin/zaphpec_enable
|
||||
if [ $? = 0 ]; then
|
||||
echo -n "done"
|
||||
echo "."
|
||||
else
|
||||
echo -n "Failed"
|
||||
echo -n "."
|
||||
echo " This can be caused if you had already run zaphpec_enable, or if your HPEC license is no longer valid."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Check that telephony is up.
|
||||
#[ "${TELEPHONY}" = "yes" ] || exit 0
|
||||
|
||||
if [ ! -f /etc/zaptel.conf ]; then
|
||||
echo "Could not find /etc/zaptel.conf! Abandon ship!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${DEBUG}" = "yes" ]; then
|
||||
ARGS="debug=1"
|
||||
fi
|
||||
|
||||
RETVAL=0
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
# Load drivers
|
||||
rmmod wcusb 2> /dev/null
|
||||
rmmod wcfxsusb 2> /dev/null
|
||||
rmmod audio 2> /dev/null
|
||||
|
||||
echo "Loading zaptel framework: "
|
||||
modprobe zaptel ${ARGS}
|
||||
|
||||
echo -n "Waiting for zap to come online..."
|
||||
TMOUT=$ZAP_DEV_TIMEOUT # max secs to wait
|
||||
while [ ! -d /dev/zap ] ; do
|
||||
echo -n "$TMOUT "
|
||||
sleep 1
|
||||
TMOUT=$(expr $TMOUT - 1)
|
||||
if [ $TMOUT -eq 0 ] ; then
|
||||
echo " " # line break
|
||||
echo "Error: missing /dev/zap!"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo "OK"
|
||||
echo -n "Loading zaptel hardware modules:"
|
||||
for x in $MODULES; do
|
||||
if modprobe ${x} ${ARGS} 2> /dev/null; then
|
||||
echo "Loaded module: ${x}."
|
||||
fi
|
||||
done
|
||||
sleep 3 # TODO: remove it
|
||||
|
||||
if [ ! -e /proc/zaptel/1 ]; then
|
||||
echo "No functioning zap hardware found in /proc/zaptel, loading ztdummy"
|
||||
modprobe ztdummy 2> /dev/null
|
||||
fi
|
||||
|
||||
echo "Running ztcfg: "
|
||||
$ZTCFG_CMD 2> /dev/null
|
||||
RETVAL=$?
|
||||
|
||||
if [ $RETVAL -eq 0 ]; then
|
||||
touch $LOCKFILE
|
||||
else
|
||||
echo "Something went wrong. Try running ztcfg -vvv."
|
||||
fi
|
||||
|
||||
# This is allowed to fail (or not even run). These files may not
|
||||
# be present, and aren't required for Asterisk.
|
||||
if [ -x "$FXOTUNE" ] && [ -r /etc/fxotune.conf ]; then
|
||||
$FXOTUNE -s || :
|
||||
fi
|
||||
|
||||
hpec_start
|
||||
;;
|
||||
stop)
|
||||
# Unload drivers
|
||||
echo -n "Unloading zaptel hardware drivers:"
|
||||
unload_module zaptel
|
||||
RETVAL=$?
|
||||
echo "."
|
||||
|
||||
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
|
||||
;;
|
||||
unload)
|
||||
# We don't have zaptel helper, so let's not replicate too much code:
|
||||
# allow others to use the unload command.
|
||||
unload_module zaptel
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
reload)
|
||||
echo "Reloading ztcfg: "
|
||||
if $ZTCFG_CMD 2> /dev/null; then
|
||||
echo -n "done"
|
||||
RETVAL=0
|
||||
else
|
||||
echo "ztcfg failed. Are your modules loaded?"
|
||||
RETVAL=1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: zaptel {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
||||
|
19
misc/zaptel/slack-desc
Normal file
19
misc/zaptel/slack-desc
Normal file
|
@ -0,0 +1,19 @@
|
|||
# HOW TO EDIT THIS FILE:
|
||||
# The "handy ruler" below makes it easier to edit a package description. Line
|
||||
# up the first '|' above the ':' following the base package name, and the '|'
|
||||
# on the right side marks the last column you can put a character in. You must
|
||||
# make exactly 11 lines for the formatting to be correct. It's also
|
||||
# customary to leave one space after the ':'.
|
||||
|
||||
|-----handy-ruler-----------------------------------------------------|
|
||||
zaptel: Zaptel (zaptel drivers)
|
||||
zaptel:
|
||||
zaptel: The zaptel drivers enable userland applications to interface with
|
||||
zaptel: certain digital and analogue devices, primarily of use with the
|
||||
zaptel: Asterisk PBX (Private Branch Exchange).
|
||||
zaptel:
|
||||
zaptel:
|
||||
zaptel:
|
||||
zaptel:
|
||||
zaptel:
|
||||
zaptel:
|
84
misc/zaptel/zaptel.SlackBuild
Normal file
84
misc/zaptel/zaptel.SlackBuild
Normal file
|
@ -0,0 +1,84 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2006, Alan Hicks, Lizella, GA
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use of this script, with or without modification, is
|
||||
# permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of this script must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# Modified by Robby Workman <rworkman@slackbuilds.org> with a few things
|
||||
# related to udev rules and such
|
||||
|
||||
set -e
|
||||
|
||||
PRGNAM="zaptel"
|
||||
VERSION="1.4.6"
|
||||
ARCH=${ARCH:-i486}
|
||||
BUILD=${BUILD:-1}
|
||||
TAG=${TAG:-_SBo}
|
||||
|
||||
CWD=$(pwd)
|
||||
TMP=${TMP:-/tmp/SBo}
|
||||
PKG="$TMP/package-$PRGNAM"
|
||||
OUTPUT=${OUTPUT:-/tmp}
|
||||
|
||||
rm -rf $PKG $TMP/$PRGNAM-$VERSION
|
||||
mkdir -p $TMP $PKG $OUTPUT
|
||||
cd $TMP
|
||||
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
|
||||
cd $PRGNAM-$VERSION
|
||||
chown -R root:root .
|
||||
chmod -R a-s,u+w,go+r-w .
|
||||
|
||||
# There's no ./configure script here. "make" has to be run once to
|
||||
# configure the system and even when everything is ok, make will
|
||||
# exit with a non-zero status the first time. We have to kludge this
|
||||
# so the script doesn't bail when called with "set -e".
|
||||
make || true
|
||||
make
|
||||
make install DESTDIR=$PKG
|
||||
|
||||
( cd $PKG
|
||||
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
|
||||
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
|
||||
)
|
||||
|
||||
mkdir -p $PKG/install $PKG/usr/doc/$PRGNAM-$VERSION $PKG/etc/rc.d
|
||||
cp -a ChangeLog LICENSE README* $PKG/usr/doc/$PRGNAM-$VERSION/
|
||||
cat $CWD/zaptel.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/zaptel.SlackBuild
|
||||
find $PKG/usr/doc -type f -exec chmod 0644 {} \;
|
||||
chown -R root:root $PKG/usr/doc
|
||||
|
||||
# Fix up the manpages
|
||||
mv $PKG/usr/share/man $PKG/usr/man
|
||||
gzip -9 $PKG/usr/man/man?/*.?
|
||||
|
||||
# Don't clobber config file and init script
|
||||
mv $PKG/etc/zaptel.conf $PKG/etc/zaptel.conf.new
|
||||
install -m 0755 $CWD/rc.zaptel $PKG/etc/rc.d/rc.zaptel.new
|
||||
|
||||
# udev handles device node creation
|
||||
rm -fr $PKG/dev
|
||||
# hotplug is dead
|
||||
rm -rf $PKG/etc/hotplug
|
||||
# rename udev rules file
|
||||
mv $PKG/etc/udev/rules.d/xpp.rules $PKG/etc/udev/rules.d/96-xpp.rules
|
||||
|
||||
cat $CWD/slack-desc > $PKG/install/slack-desc
|
||||
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
||||
|
||||
cd $PKG
|
||||
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
|
8
misc/zaptel/zaptel.info
Normal file
8
misc/zaptel/zaptel.info
Normal file
|
@ -0,0 +1,8 @@
|
|||
PRGNAM="zaptel"
|
||||
VERSION="1.4.6"
|
||||
HOMEPAGE="http://www.digium.com"
|
||||
DOWNLOAD="http://downloads.digium.com/pub/zaptel/releases/zaptel-1.4.6.tar.gz"
|
||||
MD5SUM="f0cf2e89028235c3dc447810e5089dbb"
|
||||
MAINTAINER="Alan Hicks"
|
||||
EMAIL="alan@lizella.net"
|
||||
APPROVED="rworkman"
|
Loading…
Reference in a new issue