- portline="$(echo ${portline} | ${SED} -e 's/^\(.*\),$/\1/')"
-
- misdn_cfg_pt1="#
-# Configuration file for your misdn hardware
-#
-# Usage: /usr/sbin/misdn-init start|stop|restart|config|scan|help
-#
-
-#
-# Card Settings
-#
-# Syntax: card=<number>,<type>[,<option>...]
-#
-# <number> count your cards beginning with 1
-# <type> either 0x1,0x4 or 0x8 for your hfcmulti hardware,
-# or the name of your card driver module.
-# <option> ulaw - uLaw (instead of aLaw)
-# dtmf - enable DTMF detection on all B-channels
-#
-# pcm_slave - set PCM bus into slave mode
-# If you have a set of cards, all wired via PCM. Set
-# all cards into pcm_slave mode and leave one out.
-# The left card will automatically be Master.
-#
-# ignore_pcm_frameclock - this can be set in conjunction with
-# pcm_slave. If this card has a
-# PCI Bus Position before the Position
-# of the Master, then this port cannot
-# yet receive a frameclock, so it must
-# ignore the pcm frameclock.
-#
-# rxclock - use clocking for pcm from ST Port
-# crystalclock - use clocking for pcm from PLL (genrated on board)
-# watchdog - This dual E1 Board has a Watchdog for
-# transparent mode
-#
-#"
- misdn_cfg_pt2="#
-# Port settings
-#
-# Syntax: <port_type>=<port_number>[,<port_number>...]
-#
-# <port_type> te_ptp - TE-Mode, PTP
-# te_ptmp - TE-Mode, PTMP
-# te_capi_ptp - TE-Mode (capi), PTP
-# te_capi_ptmp - TE-Mode (capi), PTMP
-# nt_ptp - NT-Mode, PTP
-# nt_ptmp - NT-Mode, PTMP
-# <port_number> port that should be considered
-#"
- misdn_cfg_pt3="#
-# Port Options
-#
-# Syntax: option=<port_number>,<option>[,<option>...]
-#
-# <option> master_clock - use master clock for this S/T interface
-# (only once per chip, only for HFC 8/4)
-# optical - optical (only HFC-E1)
-# los - report LOS (only HFC-E1)
-# ais - report AIS (only HFC-E1)
-# slip - report SLIP (only HFC-E1)
-# nocrc4 - turn off crc4 mode use double frame instead
-# (only HFC-E1)
-#
-# The master_clock option is essential for retrieving and transmitting
-# faxes to avoid failures during transmission. It tells the driver to
-# synchronize the Card with the given Port which should be a TE Port and
-# connected to the PSTN in general.
-#
-#option=1,master_clock
-#option=2,ais,nocrc4
-#option=3,optical,los,ais,slip
-
-
-#
-# General Options for your hfcmulti hardware
-#
-# poll=<number>
-#
-# Only one poll value must be given for all cards.
-# Give the number of samples for each fifo process.
-# By default 128 is used. Decrease to reduce delay, increase to
-# reduce cpu load. If unsure, don't mess with it!!!
-# Valid is 32, 64, 128, 256.
-#
-# dsp_poll=<number>
-# This is the poll option which is used by mISDN_dsp, this might
-# differ from the one given by poll= for the hfc based cards, since
-# they can only use multiples of 32, the dsp_poll is dependant on
-# the kernel timer setting which can be found in the CPU section
-# in the kernel config. Defaults are there either 100Hz, 250Hz
-# or 1000Hz. If your setting is either 1000 or 250 it is compatible
-# with the poll option for the hfc chips, if you have 100 it is
-# different and you need here a multiple of 80.
-# The default is to have no dsp_poll option, then the dsp itself
-# finds out which option is the best to use by itself
-#
-# pcm=<number>
-#
-# Give the id of the PCM bus. All PCM busses with the same ID
-# are expected to be connected and have equal slots.
-# Only one chip of the PCM bus must be master, the others slave.
-#
-# debug=<number>
-#
-# Enable debugging (see hfc_multi.h for debug options).
-#
-# dsp_options=<number>
-#
-# set this to 2 and you'll have software bridging instead of
-# hardware bridging.
-#
-#
-# dtmfthreshold=<milliseconds>
-#
-# Here you can tune the sensitivity of the dtmf tone recognizer.
-#
-# timer=<1|0>
-#
-# set this to 1 if you want hfcmulti to register at ztdummy (zaptel)
-# and provide a 1khz timing source for it. This makes it possible
-# to have an accurate timing source for asterisk through zaptel from
-# hfcmulti to make applications like Meetme and faxing between wctdm
-# and hfcmulti work properly.
-#
-poll=128
-dsp_poll=80
-dsp_options=0
-dtmfthreshold=100
-debug=0"
-
- if [ -f ${misdn_init_conf} ]; then
- cp "${misdn_init_conf}" "${misdn_init_conf}.save" || die "could not backup your existing ${misdn_init_conf}!"
- echo "[OK] ${misdn_init_conf} already present. backing it up to ${misdn_init_conf}.save"
- fi
- echo "${misdn_cfg_pt1}${NL}${cardline}${NL}${misdn_cfg_pt2}${NL}${portline}${NL}${NL}${misdn_cfg_pt3}" > ${misdn_init_conf} || die "could not write to /etc/misdn-init.conf!"
-#echo "${misdn_cfg_pt1}${NL}${cardline}${NL}${misdn_cfg_pt2}${NL}${portline}${NL}${NL}${misdn_cfg_pt3}" > testconf || die "could not write to /etc/misdn-init.conf!"
-
- echo "[OK] ${misdn_init_conf} created. It's now safe to run \"/usr/sbin/misdn-init start\""
- if [ ${portcount} -gt 1 ]; then
- echo "[ii] make your ports (1-${portcount}) available in asterisk by editing \"/etc/asterisk/misdn.conf\""
- elif [ ${portcount} -eq 1 ]; then
- echo "[ii] make your port (1) available in asterisk by editing \"/etc/asterisk/misdn.conf\""
- fi
- fi
-}
-
-function check_cfg_file {
- if [ ! -f ${misdn_init_conf} ]; then