# You *MUST* edit this file to suit your personal needs!
# This is just a sample script that is customized for my environment

# Source function library.
. /etc/rc.d/init.d/functions

export PATH=/usr/local/sbin:/usr/local/bin:$PATH

# Our own MSN
INDIAL=5558888

# Remote MSN that we want to connect to and that we accept for incoming
# connections (this interface provides access to the .pohlers.org domain)
OUTDIAL=2516669999

# See how we were called.
case "$1" in
  start)
	echo -n "Starting ISDN subsystem: "
	# for some reason, autoloading does not always work
	# this appears to be a timing problem between the "isdn" and the
	# "teles" module
	modprobe isdn_device
	daemon isdnlog -w 10 -x4087 -l3063 -D -h10 /dev/isdnctrl
	isdnctrl addif isdn0                                        >&/dev/null
	isdnctrl encap isdn0 rawip # syncppp                        >&/dev/null
	isdnctrl l2_prot isdn0 hdlc                                 >&/dev/null
	isdnctrl l3_prot isdn0 trans                                >&/dev/null
	isdnctrl eaz isdn0 $INDIAL                                  >&/dev/null
	isdnctrl huptimeout isdn0 300                               >&/dev/null
	isdnctrl addphone isdn0 in $OUTDIAL                         >&/dev/null
	# isdnctrl addphone isdn0 out 0$OUTDIAL                     >&/dev/null
	isdnctrl secure isdn0 on                                    >&/dev/null
	ifconfig isdn0 cortex.corpus.uni-muenster.de pointopoint libelle.pohlers.org -broadcast >&/dev/null
	route add libelle.pohlers.org isdn0                         >&/dev/null
	route add hummel.pohlers.org gw libelle.pohlers.org dev isdn0>&/dev/null
	echo
	touch /var/lock/subsys/isdn
	;;
  stop)
	echo -n "Shutting down ISDN subsystem: "
	killproc isdnlog
	isdnctrl delphone isdn0 in $OUTDIAL                         >&/dev/null
	isdnctrl delphone isdn0 out 0$OUTDIAL                       >&/dev/null
	isdnctrl hangup isdn0                                       >&/dev/null
	route del libelle.pohlers.org isdn0                         >&/dev/null
	route del hummel.pohlers.org  isdn0                         >&/dev/null
	ifconfig isdn0 down                                         >&/dev/null
	isdnctrl delif isdn0                                        >&/dev/null
	echo
	rm -f /var/lock/subsys/isdn
	;;
  *)
	echo "Usage: isdn {start|stop}"
	exit 1
esac

exit 0

