Blogs on System Administration, Scripting, System Monitoring, Cloud Computing & Virtualizaton, VoIP Systems, SMS Systems and Web Applications Development.

How to Install OpenSIPS?


Introduction

This article is to give an overview to install OpenSIPS with its default settings.

Description

In this article, we are installing OpenSIPS version 2.1.0 in Centos OS. So change your settings as per your OS.

Methodology

Before starting installation Process, Install some of the dependencies of OpenSIPS:
$ sudo yum install gcc gcc-c++ bison flex zlib-devel openssl-devel mysql-devel subversion pcre-devel ncurses-devel ncurses
Following is the step by step guide for installing OpenSIPS.

Step # 1

Download and extract OpenSIPS source:
$ tar -zxvf opensips-2.1.0.tar.gz

Step # 2

Edit Private and Shared Memory as per requirement:
$ vi opensips-2.1.0/config.h
Change Following values as per requirement:
#ifdef HP_MALLOC
#define PKG_MEM_SIZE 64                         /* Used only if PKG_MALLOC is defined*/
#else
#define PKG_MEM_SIZE 8                          /* Used only if PKG_MALLOC is defined*/
#endif
#define SHM_MEM_SIZE 128                                /* Used if SH_MEM is defined*/
#define SHM_MAX_SECONDARY_HASH_SIZE 128
#define DEFAULT_SHM_HASH_SPLIT_PERCENTAGE 2     /* Used if SH_MEM is defined*/
#define DEFAULT_SHM_SECONDARY_HASH_SIZE 32

Step # 3

Install OpenSIPS with MySQL database support:
$ cd opensips-2.1.0/
$ make include_modules="db_mysql" prefix="/" all
$ make include_modules="db_mysql" prefix="/" install

Step # 4

Create OpenSIPS user for running OpenSIPS:
$ adduser opensips

Step # 5

Configure init Script for OpenSIPS
$ cp opensips-2.1.0/packaging/fedora/opensips.init /etc/init.d/opensips
$ chmod a+x /etc/init.d/opensips
Change OpenSIPS executable path in init script.
$ which opensips
  /sbin/opensips
$ vi /etc/init.d/opensips
Edit OpenSIPS path from /usr/sbin/opensips to /sbin/opensips as following:
opensips=/sbin/$prog

Step # 6

Starting and Verifying OpenSIPS Installation:
$ service opensips start
Starting opensips: [ OK ]
 
$ netstat -pln | grep opensips
udp 0 0 127.0.0.1:5060 0.0.0.0:* 9814/opensips
 
$ ps aux | grep opensips
opensips 9814 0.0 0.2 100348 4524 ? S 17:38 0:00 /usr/local/sbin/opensips -u opensips -g opensips -P /var/run/opensips.pid -f /etc/opensips/opensips.cfg
opensips 9815 0.2 0.0 100348 948 ? S 17:38 0:00 /usr/local/sbin/opensips -u opensips -g opensips -P /var/run/opensips.pid -f /etc/opensips/opensips.cfg
opensips 9816 0.0 0.0 100348 984 ? S 17:38 0:00 /usr/local/sbin/opensips -u opensips -g opensips -P /var/run/opensips.pid -f /etc/opensips/opensips.cfg
opensips 9817 0.0 0.0 100348 1112 ? S 17:38 0:00 /usr/local/sbin/opensips -u opensips -g opensips -P /var/run/opensips.pid -f /etc/opensips/opensips.cfg
opensips 9818 0.0 0.0 100348 1128 ? S 17:38 0:00 /usr/local/sbin/opensips -u opensips -g opensips -P /var/run/opensips.pid -f /etc/opensips/opensips.cfg
opensips 9819 0.0 0.0 100348 1108 ? S 17:38 0:00 /usr/local/sbin/opensips -u opensips -g opensips -P /var/run/opensips.pid -f /etc/opensips/opensips.cfg
opensips 9820 0.0 0.0 100348 1128 ? S 17:38 0:00 /usr/local/sbin/opensips -u opensips -g opensips -P /var/run/opensips.pid -f /etc/opensips/opensips.cfg

Step # 7

Checking OpenSIPS logs:
$ tailf /var/log/messages | grep opensips
 
Jan 27 17:44:41 OSIP opensips: INFO:core:fix_poll_method: using epoll_lt as the IO watch method (auto detected)
Jan 27 17:44:41 OSIP opensips: INFO:core:shm_mem_init: allocating SHM block
Jan 27 17:44:41 OSIP /usr/local/sbin/opensips[9929]: NOTICE:core:main: version: opensips 2.1.1 (x86_64/linux)
Jan 27 17:44:41 OSIP /usr/local/sbin/opensips[9929]: INFO:core:main: using 32 Mb shared memory
Jan 27 17:44:41 OSIP /usr/local/sbin/opensips[9929]: INFO:core:main: using 2 Mb private memory per process
Jan 27 17:44:41 OSIP /usr/local/sbin/opensips[9929]: INFO:core:evi_publish_event: Registered event <E_CORE_THRESHOLD(0)>
Jan 27 17:44:41 OSIP /usr/local/sbin/opensips[9929]: INFO:core:evi_publish_event: Registered event <E_CORE_SHM_THRESHOLD(1)>
Jan 27 17:44:41 OSIP /usr/local/sbin/opensips[9929]: INFO:core:evi_publish_event: Registered event <E_CORE_PKG_THRESHOLD(2)>
Jan 27 17:44:41 OSIP /usr/local/sbin/opensips[9929]: INFO:sl:mod_init: Initializing StateLess engine
Jan 27 17:44:41 OSIP /usr/local/sbin/opensips[9929]: INFO:maxfwd:mod_init: initializing...
Jan 27 17:44:41 OSIP /usr/local/sbin/opensips[9929]: INFO:core:evi_publish_event: Registered event <E_MYSQL_CONNECTION(3)>
Jan 27 17:44:41 OSIP /usr/local/sbin/opensips[9929]: INFO:tm:mod_init: TM - initializing...
Jan 27 17:44:41 OSIP /usr/local/sbin/opensips[9929]: INFO:rr:mod_init: rr - initializing
Jan 27 17:44:41 OSIP /usr/local/sbin/opensips[9929]: INFO:sipmsgops:mod_init: initializing...
Jan 27 17:44:41 OSIP /usr/local/sbin/opensips[9929]: INFO:core:mod_init: initializing UDP-plain protocol
Jan 27 17:44:41 OSIP /usr/local/sbin/opensips[9929]: INFO:core:probe_max_sock_buff: using rcv buffer of 448 kb
Jan 27 17:44:41 OSIP opensips: INFO:core:daemonize: pre-daemon process exiting with 0
Now you can start Configuring OpenSIPS Database

0 comments:

Post a Comment

Please Enter your Comments Here.