Listing 4. isdnsetup Script for the Spellcaster DataCommute/BRI
#!/bin/sh
#
# Script to setup the ISDN interfaces and run
# ipppd. Edit the script
# set the phone numbers, the number of channels to
# use, and the type of connection.
#
# Specify the phone number(s) to dial
# here
PHONE1="95551234"
PHONE2="95551234"
#
# Specify the directory numbers of your ISDN line
# here
DIRNO1="5553961"
DIRNO2="5552907"
#
# Specify the number of B channels to use (Use 1
# or 2)
CHANNELS="2"
#
# Drop link if inactive for xxx seconds
TIMEOUT="300"
#
# TYPE can be "dedicated" or "shared"
TYPE="dedicated"
#
# Set DEBUG to debug to enable debugging output in
# syslog
DEBUG="debug"
#
# Check that we don't run this twice
if [ $(/sbin/isdnctrl list all | /usr/bin/wc -l) != 0 ]
then
echo "It would appear the ISDN interface "
echo "is already configured."
exit
fi
if [ "$TYPE" = "dedicated" ]
then
TIMEOUT=0
fi
#
# Setup the first channel
echo "Setting up channel 1..."
/sbin/isdnctrl system on
/sbin/isdnctrl addif ippp0
/sbin/isdnctrl addphone ippp0 in "*"
/sbin/isdnctrl addphone ippp0 out $PHONE1
/sbin/isdnctrl l2_prot ippp0 hdlc
/sbin/isdnctrl encap ippp0 syncppp
/sbin/isdnctrl eaz ippp0 $DIRNO1
/sbin/isdnctrl callback ippp0 off
/sbin/isdnctrl cbdelay ippp0 0
/sbin/isdnctrl ihup ippp0 off
/sbin/isdnctrl huptimeout ippp0 $TIMEOUT
#
# Setup the second channel if necessary
if [ "$CHANNELS" = "2" ]
then
echo "Setting up channel 2..."
/sbin/isdnctrl l3_prot ippp0 trans
/sbin/isdnctrl addslave ippp0 ippp32
/sbin/isdnctrl addphone ippp32 in "*"
/sbin/isdnctrl addphone ippp32 out $PHONE2
/sbin/isdnctrl l2_prot ippp32 hdlc
/sbin/isdnctrl l3_prot ippp32 trans
/sbin/isdnctrl encap ippp32 syncppp
/sbin/isdnctrl eaz ippp32 $DIRNO2
/sbin/isdnctrl callback ippp32 off
/sbin/isdnctrl cbdelay ippp32 0
/sbin/isdnctrl ihup ippp32 off
/sbin/isdnctrl huptimeout ippp32 $TIMEOUT
fi
#
# Run ipppd to get things going
if [ "$CHANNELS" = "2" ]
then
/sbin/ipppd -ac -pc -bsdcomp mru 1524\
defaultroute passive +mp $DEBUG \
/dev/ippp0/ dev/ippp32 &
else
/sbin/ipppd -ac -pc -bsdcomp mru 1524\
defaultroute passive $DEBUG/dev/ippp0&
fi
#
# Show the current line status
#scctrl -u