Installing in Linux
From Pbxnsip Wiki
Because of the large number of Linux flavours, we recommend Linux intallations only if you are familiar with Linux and how to run daemons. Here are some tips to make life easier.
There is also forum available on this topic, please see the "Linux-related Topics" forum on http://forum.pbxnsip.com.
Contents |
Updates
If you want to do an update, you need to stop the pbx process, copy the executable file over and then restart the service. If you need to update the audio files, you can do this while the process is running.
File System
You can install the files at any place in your file system. Typically you would choose a place like /usr/local/pbxnsip or /srv/pbxnsip. Make sure that the process receives the --dir argument with that path; and you also might want to specify the --config option so that the configuration file stays in the same directory as the other files.
Please load the audio files into that directory. These files are available from the pbxnsip download page. You must install the audio_en (US English) files; other languages are optional. You can do this with the command "unzip filename -d <pbx dir>", where xx is the language.
Also make sure that the recordings directory exists and can be written - all recordings go into this directory. A snapshot of the file system might look like this then:
ibm:/usr/local/pbxnsip # ls -alg total 17300 drwxr-xr-x 32 root 952 Mar 18 15:15 . drwxr-xr-x 22 root 512 Dec 16 09:23 .. drwxr-xr-t 2 root 160 Feb 8 16:47 acds drwxr-xr-t 2 root 184 Mar 12 11:52 adrbook drwxr-xr-t 2 root 160 Feb 9 11:33 attendants drwxr-xr-x 2 root 6520 Mar 2 06:32 audio_de drwxr-xr-x 2 root 6536 Mar 1 17:37 audio_en drwxr-xr-x 2 root 232 Mar 2 06:32 audio_moh drwxr-xr-t 2 root 160 Jan 4 16:14 callingcards drwxr-xr-t 2 root 80 Dec 20 12:30 calls drwxr-xr-t 2 root 24424 Mar 27 10:39 cdr drwxr-xr-t 2 root 80 Mar 18 15:15 colines drwxr-xr-t 2 root 136 Jan 16 10:22 conferences -rwxr-xr-x 1 root 3443 Mar 20 18:59 config.xml drwxr-xr-t 2 root 160 Feb 3 13:34 dial_plan drwxr-xr-t 2 root 256 Feb 5 17:24 dial_plan_entry drwxr-xr-t 2 root 136 Dec 20 12:30 domain_alias drwxr-xr-t 2 root 136 Dec 20 12:30 domains drwxr-xr-t 2 root 424 Mar 22 19:12 extensions drwxr-xr-t 2 root 136 Feb 21 15:27 hoots drwxr-xr-t 2 root 160 Feb 23 17:26 hunts drwxr-xr-t 2 root 136 Dec 20 12:45 ivrnodes drwxr-xr-t 2 root 280 Mar 25 14:52 messages -rwxr-xr-x 1 root 4233268 Mar 20 18:59 pbxctrl-suse10 drwxr-xr-x 2 root 808 Mar 25 14:52 recordings drwxr-xr-t 2 root 400 Mar 27 11:23 registrations drwxr-xr-t 2 root 80 Dec 20 12:30 srvflags drwxr-xr-t 2 root 160 Feb 28 19:12 trunks drwxr-xr-t 2 root 784 Mar 22 19:12 user_alias drwxr-xr-t 2 root 664 Mar 22 19:12 users
Debian
In debian, you need to create a startup file in the /etc/init.d directory. You may call this file "pbxnsip". This file might look like this:
#!/bin/bash
PBXEXE=/root/pbxnsip/pbx1.1/pbxctrl-debian3.1
PBXDIR=/root/pbxnsip/pbx1.1
#Service script for the pbxnsip PBX:
case "$1" in
start)
echo -n "Starting pbxnsip daemon"
$PBXEXE --dir $PBXDIR || return=$rc_failed
echo -e "$return"
;;
stop)
echo -n "Shutting down pbxnsip daemon:"
killall $PBXEXE || return=$rc_failed
echo -e "$return"
;;
restart)
$0 stop && $0 start || return=$rc_failed
;;
status)
echo -n "Checking for service pbxnsip: "
checkproc /usr/sbin/pbxnsip && echo OK || echo No process
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
esac
# Inform the caller not only verbosely and set an exit status.
test "$return" = "$rc_done" || exit 1
exit 0
To install the script, just use the command "update-rc.d" like this:
update-rc.d pbxnsip defaults
SuSE10
The SuSE10 Linux comes with an integrated firewall. Make sure that the firewall is not causing any trouble, otherwise you will not see any packets going out or coming in. By default, the firewall is in a very pessimistic configuration.
In order to start the PBX process automatically up, you can try the folloging file pbxd (put it into the directory /etc/init.d and make sure it has execute permission with "chmod a+rx pbxd"). Also make sure that the path variables in the script below are set to your local installation. In SuSE, you can use "/sbin/chkconfig --add pbxnsip" to set the links automatically.
#!/bin/sh
# Copyright (c) 2006-2008 pbxnsip Inc., MA, USA
#
# /etc/init.d/pbxd
#
### BEGIN INIT INFO
# Provides: pbxd
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start pbxd to provide SIP PBX services
### END INIT INFO
#
PBX_BIN=/srv/pbx/pbxctrl-suse10
PBX_DIR=/srv/pbx
PBX_CONFIG=/srv/pbx/pbx.xml
# Check for missing binaries (stale symlinks should not happen)
test -x $PBX_BIN || exit 5
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_failed <num> set local and overall rc status to <num><num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
# rc_active checks whether a service is activated by symlinks
. /etc/rc.status
# First reset status of this service
rc_reset
case "$1" in
start)
echo -n "Starting pbxd"
startproc $PBX_BIN --dir $PBX_DIR --config $PBX_CONFIG
rc_status -v
;;
stop)
echo -n "Shutting down pbxd"
killproc -TERM $PBX_BIN
rc_status -v
;;
restart)
$0 stop
$0 start
rc_status
;;
status)
echo -n "Checking for service pbxd: "
checkproc $PBX_BIN
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
rc_exit
A common requirement is to set the tftp server option for VoIP phones. In SuSE 10, you need to edit the file "/etc/dhcpd.conf" (don’t edit the file "/var/lib/dhcp/etc/dhcpd.conf", it will be overwritten when you restart the DHCP server). Just add the following lines:
host cisco7960 {
option tftp-server-name "10.1.10.5";
hardware ethernet 00:06:d7:e5:bc:9d;
fixed-address 10.1.10.21;
}
Make sure that you enable the DHCP server in yast2. After changing the file, you can use the command "rcdhcpd reload" to make the server re-read the configuration.
RedHat Enterprise Linux
In RedHat, you can use the chkconfig tool to add the service.
The following file should be called "/etc/init.d/pbxnsip" and can be used as template for controlling the service. This file should be executable (use "chmod a+rx /etc/init.d/pbxnsip" for this purpose).
#!/bin/bash
#
# Init file for pbxnsip PBX
#
# Copyright (C) 2006 pbxnsip Inc., USA
#
# chkconfig: 2345 20 80
# description: SIP-based PBX
#
# processname: pbxctrl
# pidfile: /var/run/pbxctrl.pid
# source function library
. /etc/rc.d/init.d/functions
RETVAL=0
# Installation location
INSTALLDIR=/srv/pbx
PBX=$INSTALLDIR/pbxctrl
start()
{
echo -n "Starting PBX:"
$PBX --dir $INSTALLDIR
echo
RETVAL=1
}
stop()
{
echo -n "Stopping PBX:"
killproc $PBX -TERM
echo
RETVAL=1
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status $PBX
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
RETVAL=1
esac
exit $RETVAL
Make sure that the installation directory is correct in the above file and that the executable is accessible under the name "pbxctrl" (you can set a link with the ln command, for example "ln -s pbxctrl-rhes4-2.0.0.1603 pbxctrl").
Go to the /etc/init.d directory ("cd /etc/init.d"). You can add the service with the command "chkconfig --add pbxnsip". To start the service, you can then use the command "service pbxnsip start". To stop the service, use the command "service pbxnsip stop".
Marvell SheevaPlug
The SheevaPlug is an embedded system running a Debian system on an ARM processor. It provides a attractive price/performance ratio and is suitable for many small offices.
After putting the device into the power plug and connecting the LAN, you need to determine the IP address. For this, you need to check which IP address your DHCP server assigned to the device. Then you can use SSH to log in to the computer. The default password for root is "nosoup4u".
Then you need to make sure that you have some tools on the system that are required for the installation:
apt-get install wget
In order to start the installation, create a directory for the PBX and download the software:
mkdir /usr/local/pbxnsip cd /usr/local/pbxnsip wget http://www.pbxnsip.com/download/audio_en_30.zip wget http://www.pbxnsip.com/download/audio_moh_30.zip wget http://www.pbxnsip.com/download/pbxctrl-sheevaplug-4.0.0.3204 unzip audio_en_30.zip unzip audio_moh_30.zip chmod a+rx pbxctrl-* rm audio_en_30.zip audio_moh_30.zip ln -s pbxctrl-sheevaplug-4.0.0.3204 pbxctrl-sheevaplug
Then you should create the startup script (copy & paste the text below into the file /etc/init.d/pbxnsip)
cat >/etc/init.d/pbxnsip
#!/bin/bash
PBXEXE=pbxctrl-sheevaplug
PBXDIR=/usr/local/pbxnsip
#Service script for the pbxnsip PBX:
case "$1" in
start)
echo -n "Starting pbxnsip daemon"
cd $PBXDIR
./$PBXEXE --dir $PBXDIR || return=$rc_failed
echo -e "$return"
;;
stop)
echo -n "Shutting down pbxnsip daemon:"
killall $PBXEXE || return=$rc_failed
echo -e "$return"
;;
restart)
$0 stop && $0 start || return=$rc_failed
;;
status)
echo -n "Checking for service pbxnsip: "
checkproc $PBXEXE && echo OK || echo No process
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
esac
# Inform the caller not only verbosely and set an exit status.
test "$return" = "$rc_done" || exit 1
exit 0
Then make sure that the file is executable and add the service:
chmod a+rx /etc/init.d/pbxnsip update-rc.d pbxnsip defaults
The restart the PBX and check if you can log into the system:
sync;reboot;exit
