[Asterisk-Users] HDLC kernel 2.4.26

Michael A Rowley os2mac at earthlink.net
Fri May 28 21:20:12 MST 2004


Hello all interested.

Well, I just went through the trials and tribulations of getting hdlc 
working...  it works, I can get to the internet on the asterisk 
machine.  Now all I have to do is get dhcp working... :(

Here is my setup:

Gento 2004.1
2.4.26 gentoo
sethdlc 1.15 downloaded from the generic-hdlc site.
config is as follows

zaptel.conf
nethdlc=21-24

Gentoo uses rc-update system, so these are the scripts in my 
/etc/init.d directory...[] denote the filename

[zaptel]

#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: 
/home/cvsroot/gentoo-x86/net-misc/asterisk/files/0.9.0/asterisk.rc6,v 
1.1 2004/05/10 01:37:19 stkn Exp $

depend() {
	before asterisk
	before hdlc
}

start() {
	ebegin "Installing Modules..."
	/sbin/modprobe ${MODULES}
	einfo "Starting Zaptel Configuration Load..."
	/sbin/ztcfg ${ZAPOPTS}
	eend $?
}

stop() {
	ebegin "Unloading Modules..."
	/sbin/modprobe -r ${MODULES}
	einfo "Zaptel stopped"
	eend $?
}

restart() {
	stop
	start
}


[asterisk]

#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: 
/home/cvsroot/gentoo-x86/net-misc/asterisk/files/0.9.0/asterisk.rc6,v 
1.1 2004/05/10 01:37:19 stkn Exp $

depend() {
	need zaptel
	before hdlc
}

start() {
	ebegin "Starting asterisk PBX"
	/usr/sbin/asterisk ${OPTIONS}
	eend $?
}

stop() {
	ebegin "Stopping asterisk PBX"
	/usr/sbin/asterisk -r -x "STOP NOW" 2>/dev/null
	eend $?
}


[hdlc]

#!/sbin/runscript
# written by Michael A Rowley, for West Marion Family Medicine
# start script for generic hdlc on digium hardware.

depend() {
	need zaptel
}

start() {
	# this will have to be fixed to work for other protocols, like cisco, 
etc... but for frame relay ;)
	ebegin "Starting HDLC->PVC0"
	einfo "Create" ${HDLC} ${MODE} lmi ${LMI}
	/sbin/sethdlc ${HDLC} ${MODE} lmi ${LMI}
	einfo "Create" ${PVC}
	/sbin/sethdlc ${HDLC} create ${DLCI}
	einfo "bring up" ${HDLC} "and " ${PVC}
	/sbin/ifconfig ${HDLC} up
	/sbin/ifconfig ${PVC} ${LOCALIP} netmask ${HDLCMASK} pointopoint 
${REMOTEIP}
	#einfo "Add routing" ${REMOTEIP} "netmask" ${HDLCMASK}
	#/sbin/route add -net ${REMOTEIP} netmask ${HDLCMASK}
	einfo "Add default gateway" ${REMOTEIP}
	/sbin/route add default gw ${REMOTEIP} metric 1 ${PVC}
	eend $?
}

stop() {
	ebegin "Stopping HDLC->PVC"
	einfo "Remove routing info..."
	/sbin/route del default gw ${REMOTEIP} metric 1 ${PVC}
	/sbin/route del -net ${REMOTEIP} netmask ${HDLCMASK}
	einfo "bring down devices..."
	/sbin/ifconfig ${PVC} down
	/sbin/ifconfig ${HDLC} down
	einfo "Remove Devices..."
	/sbin/sethdlc ${HDLC} delete ${DLCI}
	eend $?
}

restart() {
	stop
	start
}


In /etc/conf.d are the following:

[zaptel]

# Config file for /etc/init.d/zaptel
# Michael A Rowley, 28MAY2004
#

# add list of modules that need to be installed for Zaptel interface

MODULES="wct1xxp wcfxs"

# add options to pass to ztcfg below.

ZAPOPTS=""

[asterisk]

# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: 
/home/cvsroot/gentoo-x86/net-misc/asterisk/files/0.9.0/asterisk.confd,v 
1.1 2004/05/10 01:37:19 stkn Exp $

#
# see "asterisk -h" for a list of options
#
#

OPTIONS="vvvvvvvcfq"

[hdlc]

# Configuration file for /etc/init.d/hdlc
# Michael A Rowley, 28MAY2004

# what devices are we going to use?

HDLC="hdlc0"
PVC="pvc0"

# IP info
LOCALIP="209.26.250.74"
REMOTEIP="209.26.250.73"
HDLCMASK="255.255.255.252"

# Protocol info
MODE="fr"
LMI="ansi"
DLCI="44"


I hope this helps anyone out there who is battling with this.

Remember, YMMV :)  But, man, this makes me feel like a god!  :)  Well, 
maybe a minor diety.. :)

Michael




More information about the asterisk-users mailing list