Bug#281524: running asterisk with realtime priority

Tzafrir Cohen Tzafrir Cohen <tzafrir.cohen@xorcom.com> (by way of Mark Purcell <msp@debian.org>), 281524@bugs.debian.org
Thu, 2 Dec 2004 01:21:05 +1100


--Boundary-00=_RNdrBr5W2AQywwF
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Wed, Nov 17, 2004 at 08:17:57AM +1100, Mark Purcell wrote:
> On Tue, Nov 16, 2004 at 03:59:55PM +0200, Tzafrir Cohen wrote:
> > This requires changing the init.d script:
>
> [...]
>
> > (Asterisk 1.0.2-2.1 is loacally-built)
>
> Tzafrir,
>
> Thanks for the suggestion.
>
> Could you forward a copy of your init.d script and any other changes
> you have done for your 2.1 version.

It's still work in progress, but generally the changes are:

1. Seperate chan_h323.so to a separate package as well .
   I'm currently checking this one. It should reduce depepdencies for
	 those that only need sip, iax and zaptel.

	 The main package still depends on ncurses for some reason, though.

2. the init.d script got its own /etc/default/asterisk . It defualts
   to using '-p'

3. A separate asterisk-config package for everything under /etc/asterisk

4. allow globbing in include:
   http://bugs.digium.com/bug_view_page.php?bug_id=0002825

(2) is the topic of this bug . (3) is a must for us, but may also be
useful for Debian. (1) should be useful IMHO, but it should be tested
"in the field" quite shortly when we release our next version. Ditto
for (4).

I attach some files from the debian/ subdirectory of our package.

--
Tzafrir Cohen   icq#16849755    050-7952406
tzafrir.cohen@xorcom.com  http://xorcom.com



--Boundary-00=_RNdrBr5W2AQywwF
Content-Type: text/plain;
  charset="us-ascii";
  name=" "
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=rules

#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# This file is public domain software, originally written by Joey Hess. 

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This is the debhelper compatibility version to use.
export DH_COMPAT=4

DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)

export PROC := $(shell dpkg-architecture -qDEB_HOST_ARCH)

OPTFLAGS= -O2

ifeq ($(DEB_HOST_ARCH),amd64)
OPTFLAGS+= -m64
endif

export OPTFLAGS

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -g
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

export OPENH323DIR=/usr/share/openh323
export PWLIBDIR=/usr/share/pwlib

#include /usr/share/dpatch/dpatch.make

configure: 
	dh_testdir
	# Add here commands to configure the package.

	touch configure-stamp

build-arch: configure  build-arch-stamp
build-arch-stamp:
	dh_testdir

	# Add here command to compile/build the package.
	cd channels/h323; make
	$(MAKE)

	touch build-arch-stamp

build-indep:  configure build-indep-stamp
build-indep-stamp:
	dh_testdir

	# Add here command to compile/build the arch indep package.
	# It's ok not to do anything here, if you don't need to build
	#  anything for this package.
	#/usr/bin/docbook-to-man debian/asterisk.sgml > asterisk.1
	$(MAKE) progdocs
	
	touch build-indep-stamp


build: build-arch build-indep

clean: cleaned 
cleaned:
	dh_testdir
	dh_testroot
	rm -f build-arch-stamp build-indep-stamp configure 

	# Add here commands to clean up after the build process.
	-$(MAKE) -C channels/h323 clean
	-$(MAKE) clean
	rm -fR doc/api agi/eagi-test agi/eagi-sphinx-test

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs var/run/asterisk

	# Add here commands to install the package into debian/<packagename>
	$(MAKE) INSTALL_PREFIX=$(CURDIR)/debian/tmp install samples
	cp debian/asterisk.conf $(CURDIR)/debian/tmp/etc/asterisk/asterisk.conf
	cp channels/h323/h323.conf.sample $(CURDIR)/debian/tmp/etc/asterisk/h323.conf
	cp rapid_conf/*  $(CURDIR)/debian/tmp/etc/asterisk/
	cp contrib/scripts/addmailbox $(CURDIR)/debian/tmp/usr/sbin/
	chmod +x $(CURDIR)/debian/tmp/usr/sbin/addmailbox
	mkdir -p $(CURDIR)/debian/tmp/etc/default
	cp debian/asterisk.default $(CURDIR)/debian/tmp/etc/default/asterisk
	mkdir -p $(CURDIR)/debian/tmp/usr/lib/cgi-bin/asterisk/
	cp contrib/scripts/vmail.cgi $(CURDIR)/debian/tmp/usr/lib/cgi-bin/asterisk/
	chmod +x $(CURDIR)/debian/tmp/usr/lib/cgi-bin/asterisk/vmail.cgi


	dh_install --sourcedir=debian/tmp

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir -i
	dh_testroot -i
	dh_installdocs -i
	dh_installman asterisk.8.gz
	dh_installexamples -i -XCVS
	dh_installcron -i
	dh_installchangelogs ChangeLog -i
	dh_link -i 
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i


# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_installdocs -a
	dh_installexamples -a -XCVS
	dh_installlogrotate -a
	dh_installinit -a -- defaults 21
	dh_installchangelogs ChangeLog -a
	dh_strip -a
	dh_link -a
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	rm debian/asterisk/usr/lib/asterisk/modules/pbx_gtkconsole.so
	rm debian/asterisk/usr/lib/asterisk/modules/chan_h323.so
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure clean 

--Boundary-00=_RNdrBr5W2AQywwF
Content-Type: text/plain;
  charset="us-ascii";
  name=" "
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=control

Source: asterisk
Priority: optional
Section: comm
Maintainer: Debian VoIP Team <pkg-voip-maintainers@lists.alioth.debian.org>
Uploaders: Mark Purcell <msp@debian.org>, Kilian Krause <kk@verfaction.de>, Jose Carlos Garcia Sogo <jsogo@debian.org>, Goedson Teixeira Paixao <goedson@debian.org>, Santiago Garcia Mantinan <manty@debian.org>
Standards-Version: 3.5.6
Build-Depends: debhelper (>= 4.0.4), libgtk1.2-dev | libgtk-dev, libreadline4-dev | libreadline-dev, libgsm1-dev, libssl-dev, libzap-dev, libtonezone-dev, doxygen, bison, libedit-dev, libasound2-dev, postgresql-dev, unixodbc-dev, libpri-dev (>= 0.6.0+1.0), libopenh323-dev (>= 1.13.5.4-1), libpt-1.6.3 (>=1.6.6.4-2), libspeex-dev, dpatch

Package: asterisk
Architecture: any
Section: comm
Depends: ${shlibs:Depends}, asterisk-sounds-main (>= 1:1.0.2), libpt-1.6.3 (>= 1.6.6.4-2), libpri1 (>= 0.6), asterisk-config
Suggests: gnomemeeting, ohphone, kphone, asterisk-doc, asterisk-dev, rate-engine, mpg123
Description: Open Source Private Branch Exchange (PBX)
 Asterisk is an Open Source PBX and telephony toolkit.  It is, in a
 sense, middleware between Internet and telephony channels on the bottom,
 and Internet and telephony applications at the top.
 .
 Asterisk can be used with Voice over IP (SIP, H.323, IAX) standards, or the 
 Public Switched Telephone Network (PSTN) through Supported Hardware.
 .
 Supported hardware:
 .
  * All Wildcard (tm) products from Digium (http://www.digium.com)
  * QuickNet Internet PhoneJack and LineJack (http://www.quicknet.net)
  * Full Duplex Sound Card supported by Linux
  * Adtran Atlas 800 Plus
  * ISDN4Linux compatible ISDN card
  * Tormenta Dual T1 card (http://www.bsdtelephony.com.mx)
  * CAPI compatible ISDN cards can be run using the add-on package chan-capi
 .
 This Debian package includes the sample configuration, with demonstration
 extensions, etc
 .
 Website: http://www.asterisk.org.

Package: asterisk-h323
Architecture: any
Recommends: asterisk
Replaces: asterisk (<= 1.0.2-1)
Section: comm
Depends: ${shlibs:Depends}
Description: Gtk based console for asterisk
 This package provides a h323 support for the Asterisk Open Source PBX system.
 It was separated out into its own package because of openh323's many 
 dependencies

Package: asterisk-gtk-console
Architecture: any
Recommends: asterisk
Replaces: asterisk (<= 1.0.2-1)
Section: comm
Depends: ${shlibs:Depends}
Description: Gtk based console for asterisk
 This package provides a limited GTK based console for the Asterisk Open Source
 PBX system.
 .
 It was separated out to into its own package to avoid having the main package 
 depend on xlibs and gtk-1.2

Package: asterisk-doc
Recommends: asterisk
Conflicts: asterisk (<=0.1.12-3)
Replaces: asterisk (<=0.1.12-3)
Section: doc
Architecture: all
Description: Documentation for asterisk
 Asterisk is an Open Source PBX and telephony toolkit.
 .
 This package contains the source documentation needed if you wish to
 extend the asterisk package.

Package: asterisk-dev
Architecture: all
Recommends: asterisk
Conflicts: asterisk (<=0.1.12-3)
Replaces: asterisk (<=0.1.12-3)
Section: devel
Description: Development files for asterisk
 Asterisk is an Open Source PBX and telephony toolkit.
 .
 This package contains the include files used if you wish to compile a
 package which requires asterisk source file headers.

Package: asterisk-sounds-main
Architecture: all
Recommends: asterisk
Conflicts: asterisk (<=0.1.12-3), asterisk-sounds (<= 1:1.0.2-1)
Replaces: asterisk (<=0.4.0-5), asterisk-sounds (<= 1:1.0.2-1)
Section: comm
Description: Sound files for asterisk
 Asterisk is an Open Source PBX and telephony toolkit.
 .
 This package contains the default sound files for operation of asterisk

Package: asterisk-web-vmail
Architecture: all
Depends: httpd-cgi
Section: comm
Description: Sound files for asterisk
 Asterisk is an Open Source PBX and telephony toolkit.
 .
 This package contains a web-based interface for the voice-mail system

Package: asterisk-config
Architecture: all
Section: comm
Description: Sound files for asterisk
 Asterisk is an Open Source PBX and telephony toolkit.
 .
 This package contains the configuration files of Asterisk

--Boundary-00=_RNdrBr5W2AQywwF
Content-Type: text/plain;
  charset="us-ascii";
  name=" "
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="asterisk.default"

# This file allows you to alter the configuration of the Asterisk
# init.d script
#
# AST_REALTIME: if set to anything other than "0", asterisk will run in 
#               real-time priority (pass '-p' to asterisk). un-rem the 
#               following line to disable asterisk from running in real-time 
#               priority
#AST_REALTIME=no
#
# PARAMS: exra parameters to pass to asterisk
#         The example here may help you in debugging, but is not intended for 
#         production use.
#PARAMS="-g -vvv"

--Boundary-00=_RNdrBr5W2AQywwF
Content-Type: text/plain;
  charset="us-ascii";
  name=" "
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="asterisk-h323.install"

usr/lib/asterisk/modules/chan_h323.so

--Boundary-00=_RNdrBr5W2AQywwF
Content-Type: text/plain;
  charset="us-ascii";
  name=" "
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="asterisk.init"

#! /bin/sh
#
# asterisk	start the asterisk PBX
# (c) Mark Purcell <msp@debian.org>
# May be distributed under the terms of this General Public License
#
# Based on:
#
# skeleton	example file to build /etc/init.d/ scripts.
#		This file should be used to construct scripts for /etc/init.d.
#
#		Written by Miquel van Smoorenburg <miquels@cistron.nl>.
#		Modified for Debian GNU/Linux
#		by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
# Version:	@(#)skeleton  1.9  26-Feb-2001  miquels@cistron.nl
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/asterisk
NAME=asterisk
DESC="Asterisk PBX"

# by default: use real-time priority
PARAMS=""
AST_REALTIME="yes"
if [ -x /etc/default/asterisk ]; then . /etc/default/asterisk; fi

if [ "$AST_REALTIME" != "no" ]
then
  PARAMS="$PARAMS -p"
fi

test -x $DAEMON || exit 0

set -e

case "$1" in
  start)
	echo -n "Starting $DESC: "
	start-stop-daemon --start --chuid $NAME \
		--exec $DAEMON $PARAMS
	echo "$NAME."
	;;
  stop)
	echo -n "Stopping $DESC: "
	$DAEMON -rx 'stop now' > /dev/null && echo -n "$NAME"
	echo "."
	exit 0
	;;
  reload)
	echo "Reloading $DESC configuration files."
	$DAEMON -rx 'reload'
	;;
  logger-reload)
	$DAEMON -rx 'logger reload'
	;;
  extensions-reload)
	echo "Reloading $DESC configuration files."
	$DAEMON -rx 'extensions reload'
	;;
  restart|force-reload)
	$DAEMON -rx 'restart gracefully' > /dev/null && echo -n "$NAME"
	;;
  *)
	N=/etc/init.d/$NAME
	# echo "Usage: $N {start|stop|restart|reload|logger-reload|extensions-reload|force-reload}" >&2
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0

--Boundary-00=_RNdrBr5W2AQywwF--