diff options
-rw-r--r-- | Makefile | 17 | ||||
-rw-r--r-- | dahdi.init | 256 | ||||
-rw-r--r-- | init.conf.sample | 65 | ||||
-rw-r--r-- | system.conf.sample | 287 |
4 files changed, 10 insertions, 615 deletions
@@ -94,6 +94,7 @@ ifdef INITRD_DIR INIT_TARGET := $(DESTDIR)$(INITRD_DIR)/dahdi COPY_INITD := install -D dahdi.init $(INIT_TARGET) endif +RCCONF_DIR := $(firstword $(wildcard /etc/sysconfig /etc/default)) NETSCR_DIR := $(firstword $(wildcard /etc/sysconfig/network-scripts )) ifdef NETSCR_DIR @@ -198,23 +199,25 @@ install-modules: modules [ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || : config: - install -d $(DESTDIR)/etc/dahdi - install -D -m 644 system.conf.sample $(DESTDIR)/etc/dahdi/system.conf ifdef COPY_INITD $(COPY_INITD) - install -D -m 644 init.conf.sample $(DESTDIR)/etc/dahdi/init.conf -ifdef ADD_INITD - $(ADD_INITD) endif +ifdef RCCONF_DIR + ifeq (,$(wildcard $(DESTDIR)$(RCCONF_DIR)/dahdi)) + install -D -m 644 dahdi.sysconfig $(DESTDIR)$(RCCONF_DIR)/dahdi + endif endif ifdef COPY_NETSCR $(COPY_NETSCR) endif +ifdef ADD_INITD + $(ADD_INITD) +endif @echo "DAHDI has been configured." @echo "" @echo "If you have any DAHDI hardware it is now recommended to " - @echo "edit /etc/dahdi/init.conf and set an optimal value for" - @echo " the variable MODULES." + @echo "edit /etc/default/dahdi or /etc/sysconfig/dahdi and set there an " + @echo "optimal value for the variable MODULES." @echo "" @echo "I think that the DAHDI hardware you have on your system is:" @kernel/xpp/utils/dahdi_hardware || true diff --git a/dahdi.init b/dahdi.init deleted file mode 100644 index 030a3a3..0000000 --- a/dahdi.init +++ /dev/null @@ -1,256 +0,0 @@ -#!/bin/sh -# -# zaptel This shell script takes care of loading and unloading \ -# DAHDI Telephony interfaces -# chkconfig: 2345 9 92 -# description: The DAHDI telephony drivers allow you to use your Linux \ -# computer to accept incoming data and voice interfaces -# -# config: /etc/dahdi/init.conf - -initdir=/etc/init.d - -# Don't edit the following values. Edit /etc/dahdi/init.conf instead - -DAHDI_CFG=/sbin/ztcfg -DAHDI_CFG_CMD="$DAHDI_CFG" # e.g: for a custom .conf location - -FXOTUNE=/sbin/fxotune - -# 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 dahdi_cfg. -DAHDI_DEV_TIMEOUT=20 - -# -# Determine which kind of configuration we're using -# -system=redhat # assume redhat -if [ -f /etc/debian_version ]; then - system=debian -fi - -# Source function library. -if [ $system = redhat ]; then - . $initdir/functions || exit 0 -fi - -# Source zaptel configuration. -. /etc/dahdi/init.conf - -# Choose a lock file location. -if [ $system = debian ]; then - LOCKFILE=/var/lock/dahdi -elif [ $system = redhat ]; then - LOCKFILE=/var/lock/subsys/dahdi -fi - -# recursively unload a module and its dependencies, if possible. -# where's modprobe -r when you need it? -# 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 -} - -# Initialize the Xorcom Astribank (xpp/) using perl utiliites: -# intended to replace all the the three functions below if user has -# installed the dahdi-perl utilities. -xpp_startup() { - # do nothing if there are no astribank devices: - if ! grep -q connected /proc/xpp/xbuses 2>/dev/null; then return 0; fi - - echo "Waiting for Astribank devices to initialize:" - cat /proc/xpp/XBUS-[0-9]*/waitfor_xpds 2>/dev/null || true - - # overriding locales for the above two, as perl can be noisy - # when locales are missing. - # No register all the devices if they didn't auto-register: - LC_ALL=C zt_registration on - - # this one could actually be run after ztcfg: - LC_ALL=C xpp_sync "$XPP_SYNC" -} - - -hpec_start() { - # HPEC license found - if ! echo /var/lib/digium/licenses/HPEC-*.lic | grep -v '\*' | grep -q .; then - return - fi - - # dahdihpec_enable not installed in /usr/sbin - if [ ! -f /usr/sbin/dahdihpec_enable ]; then - echo -n "Running dahdihpec_enable: Failed" - echo -n "." - echo " The dahdihpec_enable binary is not installed in /usr/sbin." - return - fi - - # dahdihpec_enable not set executable - if [ ! -x /usr/sbin/dahdihpec_enable ]; then - echo -n "Running dahdihpec_enable: Failed" - echo -n "." - echo " /usr/sbin/dahdihpec_enable is not set as executable." - return - fi - - # dahdihpec_enable properly installed - if [ $system = debian ]; then - echo -n "Running dahdihpec_enable: " - /usr/sbin/dahdihpec_enable 2> /dev/null - elif [ $system = redhat ]; then - action "Running dahdihpec_enable: " /usr/sbin/dahdihpec_enable - fi - if [ $? = 0 ]; then - echo -n "done" - echo "." - else - echo -n "Failed" - echo -n "." - echo " This can be caused if you had already run dahdihpec_enable, or if your HPEC license is no longer valid." - fi -} - -shutdown_dynamic() { - if ! grep -q ' DAHDI_DUMMY/' /proc/* 2>/dev/null; then return; fi - - # we should only get here if we have dynamic spans. Right? - $DAHDI_CFG_CMD -s -} - -# Check that telephony is up. -if [ "${TELEPHONY}" != "yes" ]; then - echo "No TELEPHONY found" - exit 0 -fi - -if [ ! -x "$DAHDI_CFG" ]; then - echo "dahdi_cfg not executable" - exit 0 -fi - -if [ ! -f /etc/dahdi/system.conf ]; then - echo "/etc/dahdi/system.conf not found" - exit 0 -fi - -if [ "${DEBUG}" = "yes" ]; then - ARGS="debug=1" -fi - -RETVAL=0 - -# See how we were called. -case "$1" in - start) - # Load drivers - if [ $system = debian ]; then - echo -n "Loading DAHDI framework: " - modprobe dahdi ${ARGS} 2> /dev/null && echo -n "done" - echo "." - elif [ $system = redhat ]; then - action "Loading DAHDI framework: " modprobe dahdi ${ARGS} - fi - echo -n "Waiting for zap to come online..." - TMOUT=$DAHDI_DEV_TIMEOUT # max secs to wait - while [ ! -d /dev/dahdi ] ; do - sleep 1 - TMOUT=`expr $TMOUT - 1` - if [ $TMOUT -eq 0 ] ; then - echo "Error: missing /dev/dahdi!" - exit 1 - fi - done - echo "OK" - echo -n "Loading DAHDI hardware modules:" - for x in $MODULES; do - eval localARGS="\$${x}_ARGS" - if modprobe ${x} ${ARGS} ${localARGS} 2> /dev/null; then - echo -n " $x" - echo "." - fi - done - sleep 3 # TODO: remove it - - # If you have zaptel-perl, the three below can be replaced with: - xpp_startup - - if [ ! -e /proc/dahdi/1 ]; then - echo "No hardware timing source found in /proc/dahdi, loading dahdi_dummy" - modprobe dahdi_dummy 2> /dev/null - fi - - if [ $system = debian ]; then - echo -n "Running dahdi_cfg: " - $DAHDI_CFG_CMD 2> /dev/null && echo -n "done" - echo "." - elif [ $system = redhat ]; then - action "Running dahdi_cfg: " $DAHDI_CFG_CMD - fi - RETVAL=$? - - [ $RETVAL -eq 0 ] && touch $LOCKFILE - - if [ -x "$FXOTUNE" ] && [ -r /etc/fxotune.conf ]; then - # Allowed to fail if e.g. Asterisk already uses channels: - $FXOTUNE -s || : - fi - - hpec_start - ;; - stop) - # Unload drivers - #shutdown_dynamic # FIXME: needs test from someone with dynamic spans - echo -n "Unloading DAHDI hardware drivers:" - unload_module dahdi - RETVAL=$? - echo "." - - [ $RETVAL -eq 0 ] && rm -f $LOCKFILE - ;; - unload) - # We don't have DAHDI helper, so let's not replicate too much code: - # allow others to use the unload command. - unload_module dahdi - ;; - restart) - $0 stop - $0 start - ;; - reload) - if [ $system = debian ]; then - echo -n "Reloading dahdi_cfg: " - $DAHDI_CFG_CMD 2> /dev/null && echo -n "done" - echo "." - elif [ $system = redhat ]; then - action "Reloading dahdi_cfg: " $DAHDI_CFG_CMD - fi - RETVAL=$? - ;; - *) - echo "Usage: dahdi {start|stop|restart|reload}" - exit 1 -esac - -exit $RETVAL diff --git a/init.conf.sample b/init.conf.sample deleted file mode 100644 index fec18d5..0000000 --- a/init.conf.sample +++ /dev/null @@ -1,65 +0,0 @@ -TELEPHONY=yes -# DEBUG: Pass debug=1 to modules you load. -# May break xpp_usb. -#DEBUG=yes -# -#Alternatively set: options dahdi debug=1 -#in /etc/modprobe.d/dahdi or /etc/modprobe.conf. -# -# DAHDI_CFG: The full path to dahdi_cfg. default: /sbin/dahdi_cfg . -#DAHDI_CFG=/usr/local/sbin/dahdi_cfg -# -# DAHDI_CFG_CMD: allow adding extra parameters to the dahdi_cfg command. -# May be handy for -v, but mostly for: -#DAHDI_CFG_CMD=/sbin/dahdi_cfg -c /home/tzafrir/mydahdi.conf -# -# XPP_SYNC: Can be used to set an explicit Astribank unit as the -# synchronizing Astribank. Passed to xpp_sync(8) . -# Default is 'auto' and is almost always a good choice. -#XPP_SYNC=01 - -# Un-comment as per your requirements; modules to load/unload -#Module Name Hardware -MODULES="$MODULES tor2" # T400P - Quad Span T1 Card - # E400P - Quad Span E1 Card - -MODULES="$MODULES wct4xxp" # TE405P - Quad Span T1/E1 Card (5v version) - # TE410P - Quad Span T1/E1 Card (3.3v version) -#wct4xxp_ARGS="t1e1override=15" # Additional parameters for TE4xxP driver -# or use /etc/modprobe.d/dahdi or /etc/modprobe.conf . - -MODULES="$MODULES wcte12xp" # TE120P - Single Span T1/E1 Card - -MODULES="$MODULES wct1xxp" # T100P - Single Span T1 Card - # E100P - Single Span E1 Card - -MODULES="$MODULES wcte11xp" # TE110P - Single Span T1/E1 Card - -MODULES="$MODULES wctdm24xxp" # TDM2400P - Modular FXS/FXO interface (1-24 ports) - -MODULES="$MODULES wcfxo" # X100P - Single port FXO interface - # X101P - Single port FXO interface - -MODULES="$MODULES wctdm" # TDM400P - Modular FXS/FXO interface (1-4 ports) - -#MODULES="$MODULES dahdi_dummy" # DAHDI Timing Only Interface - -MODULES="$MODULES xpp_usb" # Xorcom Astribank Device - -# Disables Astribank hotplug firmware loading -#XPP_HOTPLUG_DISABLED=yes -# -# Disables Astribank udev hook called when an Astribank is added and ready -# or removed. -#ASTRIBANK_HOOK_DISABLED=yes -# -# Setup the configuration for the PRI module of the Astribank. -# Default: all E1,TE . See xpp/README.Astribank . -#XPP_PRI_SETUP='NUM/*/XPD-01=NT,E1' - -# Extensions gendahdiconf are (base + channel_number) -# base is by default 6000: -#base_exten=6000 -# -# There are a host of other variables you can set to affect -# gendahdiconf. See the beginning of the script. diff --git a/system.conf.sample b/system.conf.sample deleted file mode 100644 index 3e6d55d..0000000 --- a/system.conf.sample +++ /dev/null @@ -1,287 +0,0 @@ -# -# DAHDI Configuration File -# -# This file is parsed by the DAHDI Configurator, dahdi_cfg -# -# Span Configuration -# ~~~~~~~~~~~~~~~~~~ -# First come the span definitions, in the format -# -# span=<span num>,<timing source>,<line build out (LBO)>,<framing>,<coding>[,yellow] -# -# All T1/E1 spans generate a clock signal on their transmit side. The -# <timing source> parameter determines whether the clock signal from the far -# end of the T1/E1 is used as the master source of clock timing. If it is, our -# own clock will synchronise to it. T1/E1's connected directly or indirectly to -# a PSTN provider (telco) should generally be the first choice to sync to. The -# PSTN will never be a slave to you. You must be a slave to it. -# -# Choose 1 to make the equipment at the far end of the E1/T1 link the preferred -# source of the master clock. Choose 2 to make it the second choice for the master -# clock, if the first choice port fails (the far end dies, a cable breaks, or -# whatever). Choose 3 to make a port the third choice, and so on. If you have, say, -# 2 ports connected to the PSTN, mark those as 1 and 2. The number used for each -# port should be different. -# -# If you choose 0, the port will never be used as a source of timing. This is -# appropriate when you know the far end should always be a slave to you. If the -# port is connected to a channel bank, for example, you should always be its -# master. Any number of ports can be marked as 0. -# -# Incorrect timing sync may cause clicks/noise in the audio, poor quality or failed -# faxes, unreliable modem operation, and is a general all round bad thing. -# -# The line build-out (or LBO) is an integer, from the following table: -# -# 0: 0 db (CSU) / 0-133 feet (DSX-1) -# 1: 133-266 feet (DSX-1) -# 2: 266-399 feet (DSX-1) -# 3: 399-533 feet (DSX-1) -# 4: 533-655 feet (DSX-1) -# 5: -7.5db (CSU) -# 6: -15db (CSU) -# 7: -22.5db (CSU) -# -# framing:: -# one of 'd4' or 'esf' for T1 or 'cas' or 'ccs' for E1 and BRI. -# 'd4' could be referred to as 'sf' or 'superframe' -# -# coding:: -# one of 'ami' or 'b8zs' for T1 or 'ami' or 'hdb3' for E1 and BRI. -# * For E1 there is the optional keyword 'crc4' to enable CRC4 checking. -# * If the keyword 'yellow' follows, yellow alarm is transmitted when no -# channels are open. -# -#span=1,0,0,esf,b8zs -#span=2,1,0,esf,b8zs -#span=3,0,0,ccs,hdb3,crc4 -# -# Dynamic Spans -# ~~~~~~~~~~~~~ -# Next come the dynamic span definitions, in the form: -# -# dynamic=<driver>,<address>,<numchans>,<timing> -# -# Where <driver> is the name of the driver (e.g. eth), <address> is the -# driver specific address (like a MAC for eth), <numchans> is the number -# of channels, and <timing> is a timing priority, like for a normal span. -# use "0" to not use this as a timing source, or prioritize them as -# primary, secondard, etc. Note that you MUST have a REAL zaptel device -# if you are not using external timing. -# -# dynamic=eth,eth0/00:02:b3:35:43:9c,24,0 -# -# If a non-zero timing value is used, as above, only the last span should -# have the non-zero value. -# -# Channel Configuration -# ~~~~~~~~~~~~~~~~~~~~~ -# Next come the definitions for using the channels. The format is: -# <device>=<channel list> -# -# Valid devices are: -# -# e&m:: -# Channel(s) are signalled using E&M signalling (specific -# implementation, such as Immediate, Wink, or Feature Group D -# are handled by the userspace library). -# fxsls:: -# Channel(s) are signalled using FXS Loopstart protocol. -# fxsgs:: -# Channel(s) are signalled using FXS Groundstart protocol. -# fxsks:: -# Channel(s) are signalled using FXS Koolstart protocol. -# fxols:: -# Channel(s) are signalled using FXO Loopstart protocol. -# fxogs:: -# Channel(s) are signalled using FXO Groundstart protocol. -# fxoks:: -# Channel(s) are signalled using FXO Koolstart protocol. -# sf:: -# Channel(s) are signalled using in-band single freq tone. -# Syntax as follows: -# -# channel# => sf:<rxfreq>,<rxbw>,<rxflag>,<txfreq>,<txlevel>,<txflag> -# -# rxfreq is rx tone freq in Hz, rxbw is rx notch (and decode) -# bandwith in hz (typically 10.0), rxflag is either 'normal' or -# 'inverted', txfreq is tx tone freq in hz, txlevel is tx tone -# level in dbm, txflag is either 'normal' or 'inverted'. Set -# rxfreq or txfreq to 0.0 if that tone is not desired. -# -# unused:: -# No signalling is performed, each channel in the list remains idle -# clear:: -# Channel(s) are bundled into a single span. No conversion or -# signalling is performed, and raw data is available on the master. -# bchan:: -# Like 'clear' except all channels are treated individually and -# are not bundled. 'inclear' is an alias for this. -# rawhdlc:: -# The DAHDI driver performs HDLC encoding and decoding on the -# bundle, and the resulting data is communicated via the master -# device. -# dchan:: -# The DAHDI driver performs HDLC encoding and decoding on the -# bundle and also performs incoming and outgoing FCS insertion -# and verification. 'fcshdlc' is an alias for this. -# hardhdlc:: -# The hardware driver performs HDLC encoding and decoding on the -# bundle and also performs incoming and outgoing FCS insertion -# and verification. Is subject to limitations and support of underlying -# hardware. -# nethdlc:: -# The DAHDI driver bundles the channels together into an -# HDLC network device, which in turn can be configured with -# sethdlc. You can also optionally pass the name for the network interface -# after the channel list. -# Syntax: -# -# nethdlc=<channel list>[:interface name] -# Use original names, don't use the names which have been already registered -# in system e.g eth. -# dacs:: -# The DAHDI driver cross connects the channels starting at -# the channel number listed at the end, after a colon -# dacsrbs:: -# The DAHDI driver cross connects the channels starting at -# the channel number listed at the end, after a colon and -# also performs the DACSing of RBS bits -# -# The channel list is a comma-separated list of channels or ranges, for -# example: -# -# 1,3,5 (channels one, three, and five) -# 16-23, 29 (channels 16 through 23, as well as channel 29) -# -# So, some complete examples are: -# -# e&m=1-12 -# nethdlc=13-24 -# fxsls=25,26,27,28 -# fxols=29-32 -# -#fxoks=1-24 -#bchan=25-47 -#dchan=48 -#fxols=1-12 -#fxols=13-24 -#e&m=25-29 -#nethdlc=30-33 -#clear=44 -#clear=45 -#clear=46 -#clear=47 -#fcshdlc=48 -#dacs=1-24:48 -#dacsrbs=1-24:48 -# -# Tone Zone Data -# ~~~~~~~~~~~~~~ -# Finally, you can preload some tone zones, to prevent them from getting -# overwritten by other users (if you allow non-root users to open /dev/dahdi/* -# interfaces anyway). Also this means they won't have to be loaded at runtime. -# The format is "loadzone=<zone>" where the zone is a two letter country code. -# -# You may also specify a default zone with "defaultzone=<zone>" where zone -# is a two letter country code. -# -# An up-to-date list of the zones can be found in the file dahdi/zonedata.c -# -loadzone = us -#loadzone = us-old -#loadzone=gr -#loadzone=it -#loadzone=fr -#loadzone=de -#loadzone=uk -#loadzone=fi -#loadzone=jp -#loadzone=sp -#loadzone=no -#loadzone=hu -#loadzone=lt -#loadzone=pl -defaultzone=us -# -# PCI Radio Interface -# ~~~~~~~~~~~~~~~~~~~ -# (see http://www.zapatatelephony.org/app_rpt.html) -# -# The PCI Radio Interface card interfaces up to 4 two-way radios (either -# a base/mobile radio or repeater system) to DAHDI channels. The driver -# may work either independent of an application, or with it, through -# the driver's ioctl() interface. This file gives you access to specify -# load-time parameters for Radio channels, so that the driver may run -# by itself, and just act like a generic DAHDI radio interface. -# -# Unlike the rest of this file, you specify a block of parameters, and -# then the channel(s) to which they apply. CTCSS is specified as a frequency -# in tenths of hertz, for example 131.8 HZ is specified as 1318. DCS -# for receive is specified as the code directly, for example 223. DCS for -# transmit is specified as D and then the code, for example D223. -# -# The hardware supports a "community" CTCSS decoder system that has -# arbitrary transmit CTCSS or DCS codes associated with them, unlike -# traditional "community" systems that encode the same tone they decode. -# -# this example is a single tone DCS transmit and receive -# -# specify the transmit tone (in DCS mode this stays constant): -#tx=D371 -# -# specify the receive DCS code: -#dcsrx=223 -# -# this example is a "community" CTCSS (if you only want a single tone, then -# only specify 1 in the ctcss list) -# -# specify the default transmit tone (when not receiving): -#tx=1000 -# -# Specify the receive freq, the tag (use 0 if none), and the transmit code. -# The tag may be used by applications to determine classification of tones. -# The tones are to be specified in order of presedence, most important first. -# Currently, 15 tones may be specified.. -# -#ctcss=1318,1,1318 -#ctcss=1862,1,1862 -# -# The following parameters may be omitted if their default value is acceptible -# -# Set the receive debounce time in milliseconds: -#debouncetime=123 -# -# set the transmit quiet dropoff burst time in milliseconds: -#bursttime=234 -# -# set the COR level threshold (specified in tenths of millivolts) -# valid values are {3125,6250,9375,12500,15625,18750,21875,25000} -#corthresh=12500 -# -# Invert COR signal {y,n} -#invertcor=y -# Set the external tone mode; yes, no, internal {y,n,i} -#exttone=y -# -# Now apply the configuration to the specified channels: -# -# We are all done with our channel parameters, so now we specify what -# channels they apply to -#channels=1-4 -# -# Overiding PCM encoding -# ~~~~~~~~~~~~~~~~~~~~~~ -# Usually the channel driver sets the encoding of the PCM for the -# channel (mulaw / alaw. That is: g711u or g711a). However there are -# some cases where you would like to override that. 'mulaw' and 'alaw' -# set different such encoding. Use them for channels you have already -# defined with e.g. 'bchan' or 'fxoks'. -#mulaw=1-4 -#alaw=1-4 -# -# 'deflaw' is similar, but resets the encoding to the channel driver's -# default. It must be useful for something, I guess. -#mulaw=1-10 -#deflaw=5 -# |