Installing OpenSIPS v1.6.1 on CentOS 5 64bit

Smartvox Limited offers a consultancy for installation of OpenSIPS -we have expertise and experience installing and configuring OpenSIPS, Asterisk and PSTN gateways. We also have a wealth of experience in systems integration and networking to get your OpenSIPS server working smoothly with your existing VoIP infrastructure. Details of our consultancy services are located here.

However, if you want to do it all yourself, here is a set of instructions that should help. Installing OpenSIPS v1.6.1 on CentOS 5 64 bit is very straightforward. All the dependencies can be installed using YUM. The packages required will depend on the modules that you intend to use from OpenSIPS. This page describes what must be installed to use OpenSIPS with local MySQL support.

Assumptions about the base system used for the installation

The information given here is based on experience of installing OpenSIPS on a Dell SC1435 with AMD Opteron processors. CentOS version 5.2 x86_64 was installed from discs made using ISO images downloaded from one of the CentOS mirror sites.

You can check your installed version of CentOS using the following commands:

cat /etc/redhat-release Shows the CentOS release version number
uname -m Shows if you have the x86_64 version
cat /proc/cpuinfo Shows the type of processor on your machine

 

Packages assumed to already be installed on the base system

zlib.x86_64 version 1.2.3
openssl.x86_64 version 0.9.8b
mysql.x86_64 version 5.0.45

You may find it useful to run the “yum list” or “yum info [package_name]” commands at the Linux prompt to check what packages are already installed and which version.

By the way, on my server there was also a package for mysql.i386 already installed.

Update and install various packages using YUM

Install the missing packages using the “yum install” command at the Linux prompt. It is probably best to be logged in as root for this.

Packages required by OpenSIPS
yum install gcc
yum install bison
yum install flex
yum install zlib-devel
yum install openssl-devel

Dependencies of openssl-devel
When you attempt to install openssl-devel, it warns you that several other packages and updates are necessary. These dependencies are added automatically, so little effort is required – just confirm that it is ok to install the dependencies and updates.

Updating krb5-libs
Installing e2fsprogs-devel
Installing keyutils-libs-devel
Installing krb5-devel
Installing libselinux-devel
Installing libsepol-devel
Updating krb5-workstation

Install MySQL local server and MySQL headers

Install mysql-server.x86_64
Suggested version: 5.0.45-7.el5
Command: yum install mysql-server.x86_64

Then install mysql headers
Command: yum install mysql-devel.x86_64

Get a copy of the OpenSIPS source files

OpenSIPS
Suggested version: opensips-1.6.1-notls_src.tar.gz
Download site: http://opensips.org/pub/opensips/1.6.1/src
Unzip: tar -xzf opensips-1.6.1-notls_src.tar.gz
Suggested location to copy the source files after unzipping the tarball: /usr/src/opensips

Fix the makefile to include the db_mysql module

OpenSIPS
You should now have all the unzipped files in /usr/src/opensips and have made this your current directory

To enable MySQL server support, edit the file called “Makefile” and locate the section of the file that sets a list of excluded modules. It looks like this:

# if not set on the cmd. line or the env, exclude this modules:
exclude_modules?= jabber cpl-c db_mysql db_postgres osp db_unixodbc \
     db_oracle avp_radius auth_radius group_radius uri_radius \
     xmpp presence presence_xml presence_mwi pua pua_bla pua_mi \
     pua_usrloc pua_xmpp rls mi_xmlrpc perl snmpstats perlvdb \
     ldap carrierroute h350 xcap_client db_berkeley seas peering

 

Simply remove the entry for db_mysql, so it now looks like this:

# if not set on the cmd. line or the env, exclude this modules:exclude_modules?= jabber cpl-c db_postgres osp db_unixodbc \
     db_oracle avp_radius auth_radius group_radius uri_radius \
     xmpp presence presence_xml presence_mwi pua pua_bla pua_mi \
     pua_usrloc pua_xmpp rls mi_xmlrpc perl snmpstats perlvdb \
     ldap carrierroute h350 xcap_client db_berkeley seas peering

 

Compile and install OpenSIPS

Use make to compile and install OpenSIPS

You should still be in the directory /usr/src/opensips to run these commands:

make clean
make
make install

I got some warnings about “old-style function definitions” in file lex.yy.c, but I ignored them.

Test that OpenSIPS runs ok

Try running OpenSIPS

At the Linux command prompt, type:
opensipsctl start

You should see something like this:


[root@svoxser03 opensips]# opensipsctl startINFO: Starting OpenSIPS :INFO: started (pid: 29697)    

 

Another test you can use to check if OpenSIPS is actually running, is this:
ps ax | grep opensips

You should see something like this:


[root@svoxser03 opensips]# ps ax | grep opensips29839 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid29841 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid29842 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid29843 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29844 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29845 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29846 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29847 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29848 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29849 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29850 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29851 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29852 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29853 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29854 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29855 ? S 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
29858 pts/0 S+ 0:00 grep opensips

 

And finally…

Create automated startup scripts
The sample startup script for Fedora (/usr/src/opensips/packaging/fedora/opensips.init) is quite close to being suitable for CentOS. Before you try it, copy it to /etc/init.d and set its permissions to make it executable. Rename it opensips and make the following changes to the script:

Change the Source function library from /etc/rc.d/init.d/functions to /etc/init.d/functions
Make sure the correct paths are set for your config file and your program. For example, you will probably want to set the variable oser like this:
oser=/usr/local/sbin/opensips
Add a path statement:
PATH=/sbin:/bin:/usr/local/sbin:/usr/local/bin
On the line that starts the daemon, remove “| tail -1” and instead get the line to look like this:
daemon $oser $OPTIONS >/dev/null 2>/dev/null

Test it from the command line, using commands such as:
/etc/init.d/opensips start
/etc/init.d/opensips status
/etc/init.d/opensips stop

Hint: if you are having inexplicable problems getting it to start, you may need to manually delete the file /var/lock/subsys/opensips

Once you are sure it works, you can set it to run automatically like this:
Edit the startup script /etc/init.d/opensips and edit the comment line (approx third line):
# chkconfig: – 85 15
Change it to
# chkconfig: 345 96 15

At the Linux command prompt, type:
chkconfig –add opensips

Reboot the server to check that opensips starts automatically.

Start writing your own opensips.cfg config file
A default config file is deposited by the installation process in /usr/local/etc/opensips. Additional sample files are dropped in the directory /usr/src/opensips/examples. There are many online guides and “cook books” to help you with programming. For example:
http://www.opensips.org/index.php?n=Resources.DocsCookbooks

Another option would be to purchase a copy of the new book by Flavio E. Goncalves:
http://www.packtpub.com/building-telephony-systems-with-opensips-1-6/book

The same book is available from Amazon too. Or the previous edition is available here:
http://www.amazon.co.uk/Building-Telephony-Systems-OpenSER-Goncalves/dp/1847193730

However, the recommended option is to save yourself the time and frustration of learning a whole new technology – just contact Smartvox and ask us to quote for setting up your proxy server. We have years of experience working with ITSP solutions for NAT traversal, user registration, failover and redundancy, integration with Application Servers, re-direction to voicemail on no answer or busy etc, etc.

  What did you think of this article? Please vote by clicking a coloured button
(90%) (10%) (0%) (0%)

3 thoughts on “Installing OpenSIPS v1.6.1 on CentOS 5 64bit

  1. Thanks for the post, its very informative.
    I am facing one small issue. After “Make install”, the system is unable to find command “opensipsctl”. Hence i am unable to start opensips. would you be able to help?

    • These notes are over 2 years old and the current version of OpenSIPS is now 1.8. Installing 1.8 is a little different – for example, instead of makefile, you have to edit makefile.conf to enable the db_mysql module. I now always use the following commands to build opensips:
      make prefix=/ all
      make prefix=/ install
      The prefix options cause the compiled modules to all be placed in directory:
      /lib64/opensips/modules
      The file for opensipsctl should be located in /sbin (or in /usr/local/sbin if you did not use the prefix=/ argument when you ran make). Perhaps you need to adjust the PATH on your Linux server so it can find the opensipsctl file.

Comments are closed.