This document describes how to setup Asterisk on Debian, inside of a Linux-Vserver.

install a vserver

A typical Debian stable vserver install works fine for our purposes.

install asterisk

The debian package of asterisk in stable works fine, if you don’t need any advanced features. If you need something like the SRTP patch, then you will need a more current revision, see below for that.

# aptitude install asterisk

install the zaptel driver

We need the ztdummy driver, which provides a software timer help to steady the sound a bit. To get that installed, we need a special kernel module. Thats easy! We just use module-assistant to get a kernel module for our running kernel compiled.

NOTE: this has to be done on the host, not in the vserver itself!

# aptitude install module-assistant
# m-a prepare
# m-a update
# m-a get zaptel
# m-a build zaptel
# m-a install zaptel
# modprobe ztdummy
# echo ztdummy >> /etc/modules

You can also just type m-a and follow the gui.

When you upgrade the kernel, if the ABI number changes, you will need to rebuild these modules! What is the ABI number? Well if you look at your kernel revision you can see it:

# uname -r
2.6.22-1-vserver-686

That shows you the ABI number is 1, when that changes to a 2, the modules you built wont work anymore and will need to be rebuilt.

get the ztdummy devices so the vserver can use them

In order for the vserver to be able to access the ztdummy interface on the host, you need to create a few device nodes in the vserver’s /dev directory.

# mkdir -p /etc/vservers/vserver_name/dev/zap
mknod /etc/vservers/vserver_name/dev/zap/ctl c 196 0
mknod /etc/vservers/vserver_name/dev/zap/timer c 196 253
mknod /etc/vservers/vserver_name/dev/zap/channel c 196 254
mknod /etc/vservers/vserver_name/dev/zap/pseudo c 196 255

N=1; \

while [ $N -lt 250 ]; do \
        mknod /etc/vservers/vserver_name/dev/zap/$N c 196 $N; \
        N=$[$N+1]; \
done

add a capability to the vserver

Asterisk runs better when it has the kernel capability SYS_NICE available. All capabilities are disabled by default with vservers, so if you are going to add it, you need to put the line SYS_NICE in the file /etc/vservers//bcapabilities file and then restart your vserver.

(need a note here about what this gives us)
(need a note here about why this is a security risk)

configure asterisk

our extensions.conf
our meetme.conf
our sip.conf

testing out asterisk

# asterisk -r
asterisk> core set verbose 4
Verbosity was 0 and is now 4

(dial)

some asterisk tricks

  1. adding cool hold music
  2. kicking people out of the conference

adding SRTP (secure RTP)

SRTP gives us encrypted VOIP, some more details about it should go here.

In order to get SRTP, a special patch needs to be applied to asterisk to get the functionality and asterisk has to be recompiled with it.

To do that follow these steps:

# echo "pietro added links so he won't forget"

www.voip-info.org/wiki/view/Asterisk+SRTP
www.e164.org/wiki/AsteriskSRTP
bugs.digium.com/view.php?id=5413#69868