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:

[code lang=bash]
sudo apt-get -y update
sudo apt-get -y upgrade
[/code]

Install development packages:

[code lang=bash]
sudo apt-get install build-essential flex bison zlib1g-dev libncurses5-dev libssl-dev libfrontier-rpc-perl libmysqlclient-dev pkg-config mysql-client
[/code]

Installation

Prepare source directory:

[code lang=bash]
mkdir -p ~/src
cd ~/src
[/code]

Get OpenSIPS 1.11.6:

[code lang=bash]
wget -c http://opensips.org/pub/opensips/1.11.6/opensips-1.11.6.tar.gz
[/code]

Install and compile OpenSIPS:

[code lang=bash]
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
[/code]

Verify installation:

[code lang=bash]
ls -l /usr/local/sbin
ls -l /usr/local/lib64/opensips/modules
[/code]

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

Basic Configuration

Setup init script for OpenSIPS:

[code lang=bash]
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
[/code]

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

[code lang=bash]
sudo vi /etc/init.d/opensips.init
[/code]

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.

[code lang=bash]
sudo vi /etc/default/opensips
[/code]

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

[code lang=bash]
sudo vi /usr/local/etc/opensips/opensips.cfg
[/code]

Start OpenSIPS:

[code lang=bash]
sudo /etc/init.d/opensips.init start
[/code]

Verify if OpenSIPS is running:

[code lang=bash]
ps ax | grep opensips
netstat -lnptu | grep opensips
tail -f /var/log/syslog | grep opensips
[/code]

Author

This article is written by Anton Raharja.

Update:

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

2 thoughts on “OpenSIPS on Ubuntu Part 1

Leave a Reply

Your email address will not be published. Required fields are marked *