Let's get started
It's assumed you already have a server with a base CentOS installation before you begin. Do NOT install a GUI such as Gnome or KDE. We only want to be running in console text mode not GUI graphics mode. If you already have a desktop or server GUI installed you will want to exit to console mode. You do that by typing init 3 from a terminal or console window. You will need to be logged in as root in order to do this so if not you can su root. All instructions in this guide are assuming you are always logged in as root running in level 3 console text mode.
Get rid of all installed groups except 'Yum Utilities' so we are starting with a clean slate. Check the delete list before entering 'y' to make sure none of these remove 'sshd' or 'yum' (they don't but check just in case things change with newer revisions).
yum grouplist installed
Installed Groups:
DNS Name Server
Editors
Legacy Network Server
Mail Server
Network Servers
System Tools
Text-based Internet
Web Server
Windows File Server
Yum Utilities
yum groupremove '
DNS Name Server'
yum groupremove 'Editors'
yum groupremove 'Legacy Network Server'
yum groupremove 'Mail Server'
yum groupremove 'Network Servers'
yum groupremove 'System Tools'
yum groupremove 'Text-based Internet'
yum groupremove 'Web Server'
yum groupremove 'Windows File Server'
Now update the base install
yum -y update
Install OpenSIPS and OpenSIPS-CP required packages, other useful packages, and their dependencies
yum groupinstall core
yum groupinstall base
yum install nano gcc gcc-c++ bison flex zlib-devel openssl-devel mysql-server mysql-devel subversion pcre-devel php-mysql php-pear
Selinux is not required or recommended. This will create the required file if it does not already exist. If it already exists copy paste or edit the contents indicated here to be sure selinux never runs.
nano /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
# SETLOCALDEFS= Check local definition changes
SETLOCALDEFS=0
(Ctrl-x> y >Enter)
Make sure selinux is turned off for this session
setenforce 0
OpenSIPS and xmlrpc
Thanks to the author of this post for the valuable information
Compile the library xmlrpc-c which is required for OpenSIPS-CP. If you forget to use --disable-abyss-threads the system will dump the core because OpenSIPS is multiprocess but not multithreaded. The newer versions of xmlrpc compile by default with threads enabled. This problem does not occur with Debian or Ubuntu because they use an older version of xml-rpc (0.9.1) that does not support threads.
If the --prefix=/usr is not used the sofware will install in /usr/local which will result in CentOS not able to find the xmlrpc libraries which will be in /usr/local/lib instead of /usr/lib. So you would have to copy/paste and then /sbin/ldconfig -v. Or you would have to create a symbolic link. Using the --prefix=/usr so it is put in the expected place to begin with is simpler IMHO.
cd /usr/src
wget http://sourceforge.net/projects/xmlrpc-c/files/Xmlrpc-c%20Super%20Stable/1.16.36/xmlrpc-c-1.16.36.tgz/download
tar -xzvf xmlrpc-c-1.16.36.tgz
cd xmlrpc-c-1.16.36
./configure --disable-abyss-threads --prefix=/usr
make
make install
Download the latest OpenSIPS v6 source
cd /usr/src
svn co https://opensips.svn.sourceforge.net/svnroot/opensips/branches/1.6 opensips
Remove from the “Exclude=” (line 52) the modules db_mysql and mi_xmlrpc so that they are included in the compilation process.
cd /usr/src/opensips
nano Makefile
remove the db_mysql and mi_xmlrpc in the section starting on line 52 and then save.
Now compile OpenSIPS
cd /usr/src/opensips
make prefix=/ all
make prefix=/ install
uncomment (#) DBENGINE=MYSQL
nano /etc/opensips/opensipsctlrc
start mysql
service mysqld start
Create OpenSIPS database. NOTE: when it asks for a root password it will be blank unless you have previously set it to something else.
opensipsdbctl create
Answer 'y' to both questions
edit the opensips.cfg file
nano /etc/opensips/opensips.cfg
uncomment the following lines:
loadmodule "db_mysql.so"
loadmodule "auth.so"
loadmodule "auth_db.so"
modparam("usrloc", "db_mode", 2)
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
Uncomment and modify the following section adding 127.0.0.1 or your IP if it is a remote server.
Check if OpenSIPS starts
opensipsctl start
you should see
wget http://sourceforge.net/projects/opensips-cp/files/opensips-cp/4.0/opensips-cp_4.0.tgz/download
pear install MDB2
The next part of this install guide assumes you have already installed the OpenSIPS MySQL database. If not please refer to that section higher up in this guide. Also, you will need your MySQL root password which is blank if you have not entered one yet.
Install the admin privileges table schema.
mysql -D opensips -p
> INSERT INTO ocp_admin_privileges (username,password,ha1,available_tools,permissions) values ('admin','admin',md5('admin:admin'),'all','all');
> \q
The above line creates an 'admin' user account with password 'admin'. This is what you use to log into OpenSIPS-CP initially.
mysql -D opensips -p
Install stored procedure schema that generates cdr records from acc table.
cd /var/www/html/opensips-cp/config/tools/system/cdrviewer
cd /var/www/html/opensips-cp/config/tools/system/smonitor
mysql -D opensips -p < tables.mysql
First line generates cdrs in 3 minute intervals. Second line collects data every minute using smonitor and should not be changed.
mysqladmin -u root password 'abcdef'