OpenSIPS on Ubuntu Part 1

OpenSIPS 1.11.6 LTS installation on Ubuntu Server 14.04 LTS Part 1.

This article is divided into three sections:

  1. Preparation
  2. Installation
  3. Basic Configuration

The focus on this part is only the installation and a very basic configuration just to see if the OpenSIPS installed properly.

Warning, you have to also follow and do the next part to finalize setups and to secure the OpenSIPS installation on Ubuntu.

Let’s do the part 1.

Preparation

Update and upgrade Ubuntu:

sudo apt-get -y update
sudo apt-get -y upgrade

Install development packages:

sudo apt-get install build-essential flex bison zlib1g-dev libncurses5-dev libssl-dev libfrontier-rpc-perl libmysqlclient-dev pkg-config mysql-client

Installation

Prepare source directory:

mkdir -p ~/src
cd ~/src

Get OpenSIPS 1.11.6:

wget -c http://opensips.org/pub/opensips/1.11.6/opensips-1.11.6.tar.gz

Install and compile OpenSIPS:

cd ~/src
tar -zxf opensips-1.11.6.tar.gz
cd opensips-1.11.6-tls
TLS=1 make all
TLS=1 make include_modules='db_mysql' modules
sudo TLS=1 make include_modules='db_mysql' install

Verify installation:

ls -l /usr/local/sbin
ls -l /usr/local/lib64/opensips/modules

For i386 the modules directory is in /usr/local/lib/opensips.

Basic Configuration

Setup init script for OpenSIPS:

cd ~/src/opensips-1.11.6-tls/packaging/debian/
sudo cp opensips.init /etc/init.d/
sudo chmod 755 /etc/init.d/opensips.init
sudo cp opensips.default /etc/default/opensips
sudo chmod 644 /etc/default/opensips
sudo update-rc.d opensips.init defaults 99
sudo groupadd opensips
sudo useradd -M -s /usr/sbin/nologin -g opensips opensips

Edit /etc/init.d/opensips.init, and change these parts:

  • Search for PATH and add /usr/local/sbin to PATH. Eg: PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
  • Search for DAEMON and change DAEMON=/usr/sbin/opensips to DAEMON=/usr/local/sbin/opensips
  • Search for /etc/opensips/opensips.cfg and then change it to /usr/local/etc/opensips/opensips.cfg
sudo vi /etc/init.d/opensips.init

Configure init script by editing /etc/default/opensips. Change RUN_OPENSIPS=no to RUN_OPENSIPS=yes, this will make /etc/init.d/opensips.init actually run OpenSIPS daemon.

sudo vi /etc/default/opensips

Next, update sample opensips.cfg for the first time:

  • Search for CUSTOMIZE ME, it should be only 1 line, its the listen option. Change the default IP 127.0.0.1 to your server IP address, or 0.0.0.0 for all IP in your server:

    listen=udp:0.0.0.0:5060

  • Add one line just after above listen line to define and allow access to TCP:

    listen=tcp:0.0.0.0:5060

  • Followed by changing disable_tcp option from yes to no:

    disable_tcp=no

sudo vi /usr/local/etc/opensips/opensips.cfg

Start OpenSIPS:

sudo /etc/init.d/opensips.init start

Verify if OpenSIPS is running:

ps ax | grep opensips
netstat -lnptu | grep opensips
tail -f /var/log/syslog | grep opensips

Author

This article is written by Anton Raharja.

Update:

  • Part 2 is available here
  • Part 3 is available here
Advertisement

2 thoughts on “OpenSIPS on Ubuntu Part 1

Comments are closed.