Installing OpenSIPS on Redhat Enterprise Linux 5

We’ve got to set up a SIP Registrar for a fantastic new project that one of our clients recently announced ;) on RHEL5 so we’re going to trial OpenSIPS, backed with MySQL to see how it performs.

There’s a RHEL5 repository mirror here http://centos.leurent.eu/ that I’ve mirrored locally. If you don’t know how to create your own repositories you can read about that here.

First off I installed the opensips-mysql.x86_64 package to guarantee we pull in OpenSIPS as well as it’s MySQL dependencies.

[root@dollrose repos]# yum install opensips-mysql.x86_64
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package opensips-mysql.x86_64 0:1.7.1-0 set to be updated
--> Processing Dependency: opensips = 1.7.1 for package: opensips-mysql
--> Running transaction check
---> Package opensips.x86_64 0:1.7.1-0 set to be updated
--> Processing Dependency: perl(Frontier::RPC2) for package: opensips
--> Running transaction check
---> Package perl-Frontier-RPC.noarch 0:0.07b4-5.el5 set to be updated
--> Processing Dependency: perl(HTTP::Status) for package: perl-Frontier-RPC
--> Processing Dependency: perl(HTTP::Daemon) for package: perl-Frontier-RPC
--> Processing Dependency: perl(Apache::Constants) for package: perl-Frontier-RPC
--> Processing Dependency: perl(HTTP::Request) for package: perl-Frontier-RPC
--> Processing Dependency: perl(XML::Parser) for package: perl-Frontier-RPC
--> Processing Dependency: perl(LWP::UserAgent) for package: perl-Frontier-RPC
--> Running transaction check
---> Package mod_perl.x86_64 0:2.0.4-6.el5 set to be updated
--> Processing Dependency: perl(BSD::Resource) for package: mod_perl
---> Package perl-XML-Parser.x86_64 0:2.34-6.1.2.2.1 set to be updated
---> Package perl-libwww-perl.noarch 0:5.805-1.1.1 set to be updated
--> Processing Dependency: perl-HTML-Parser >= 3.33 for package: perl-libwww-perl
--> Processing Dependency: perl(HTML::Entities) for package: perl-libwww-perl
--> Processing Dependency: perl(Compress::Zlib) for package: perl-libwww-perl
--> Running transaction check
---> Package perl-BSD-Resource.x86_64 0:1.28-1.fc6.1 set to be updated
---> Package perl-Compress-Zlib.x86_64 0:1.42-1.fc6 set to be updated
---> Package perl-HTML-Parser.x86_64 0:3.55-1.fc6 set to be updated
--> Processing Dependency: perl-HTML-Tagset >= 3.03 for package: perl-HTML-Parser
--> Processing Dependency: perl(HTML::Tagset) for package: perl-HTML-Parser
--> Running transaction check
---> Package perl-HTML-Tagset.noarch 0:3.10-2.1.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================================================
Installing:
opensips-mysql x86_64 1.7.1-0 opensips 96 k
Installing for dependencies:
mod_perl x86_64 2.0.4-6.el5 rhel 4.0 M
opensips x86_64 1.7.1-0 opensips 5.7 M
perl-BSD-Resource x86_64 1.28-1.fc6.1 rhel 29 k
perl-Compress-Zlib x86_64 1.42-1.fc6 rhel 52 k
perl-Frontier-RPC noarch 0.07b4-5.el5 epel 40 k
perl-HTML-Parser x86_64 3.55-1.fc6 rhel 92 k
perl-HTML-Tagset noarch 3.10-2.1.1 rhel 14 k
perl-XML-Parser x86_64 2.34-6.1.2.2.1 rhel 210 k
perl-libwww-perl noarch 5.805-1.1.1 rhel 376 k

Transaction Summary
=================================================================================================================================================================================================================
Install 10 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 11 M
Is this ok [y/N]: y
Downloading Packages:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 131 MB/s | 11 MB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : perl-Compress-Zlib 1/10
Installing : perl-BSD-Resource 2/10
Installing : mod_perl 3/10
Installing : perl-HTML-Tagset 4/10
Installing : perl-HTML-Parser 5/10
Installing : perl-libwww-perl 6/10
Installing : perl-XML-Parser 7/10
Installing : perl-Frontier-RPC 8/10
Installing : opensips 9/10
Installing : opensips-mysql 10/10

Installed:
opensips-mysql.x86_64 0:1.7.1-0

Dependency Installed:
mod_perl.x86_64 0:2.0.4-6.el5 opensips.x86_64 0:1.7.1-0 perl-BSD-Resource.x86_64 0:1.28-1.fc6.1 perl-Compress-Zlib.x86_64 0:1.42-1.fc6 perl-Frontier-RPC.noarch 0:0.07b4-5.el5
perl-HTML-Parser.x86_64 0:3.55-1.fc6 perl-HTML-Tagset.noarch 0:3.10-2.1.1 perl-XML-Parser.x86_64 0:2.34-6.1.2.2.1 perl-libwww-perl.noarch 0:5.805-1.1.1

Complete!

Create the opensips user

adduser opensips

Then edit /etc/opensips/opensipsctlrc and make the following changes

SIP_DOMAIN=localhost
DBENGINE=MYSQL
DBHOST=localhost
DBNAME=opensips
DBRWUSER="opensipsrw"
DBRWPW="opensips"
DBROOTUSER="root"
USERCOL="username"
INSTALL_EXTRA_TABLES=ask
INSTALL_PRESENCE_TABLES=ask

We can now run opensipsdbctl create and create the database and tables

[root@dollrose opensips]# opensipsdbctl create
MySQL password for root:
INFO: test server charset
INFO: creating database opensips ...
INFO: Core OpenSIPS tables succesfully created.
Install presence related tables? (y/n): y
INFO: creating presence tables into opensips ...
INFO: Presence tables succesfully created.
Install tables for imc cpl siptrace domainpolicy carrierroute userblacklist? (y/n): y
INFO: creating extra tables into opensips ...
INFO: Extra tables succesfully created.

Edit /etc/opensips/opensips.cfg and enable the following options

loadmodule "db_mysql.so"
loadmodule "auth.so"
loadmodule "auth_db.so"
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "db_url",
"mysql://opensips:opensipsrw@localhost/opensips")
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "db_url",
"mysql://opensips:opensipsrw@localhost/opensips")
modparam("auth_db", "load_credentials", "")

Now we can create a couple of new soft phone accounts using the opensipctl add command

[root@dollrose opensips]# opensipsctl add 1234 1234
new user '1234' added
[root@dollrose opensips]# opensipsctl add 5678 5678
new user '5678' added

We can then create the MySQL user and grant him credentials on the database.

[root@dollrose opensips]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 417
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> GRANT ALL PRIVILEGES ON opensips.* TO opensips@localhost IDENTIFIED BY 'opensipsrw';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON opensips.* TO opensips@127.0.0.1 IDENTIFIED BY 'opensipsrw';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

We can now start OpenSIPS!

[root@dollrose opensips]# /etc/init.d/opensips start
Starting opensips:


root@dollrose opensips]# netstat -lpn | grep 5060
tcp 0 0 10.20.0.11:5060 0.0.0.0:* LISTEN 4253/opensips
tcp 0 0 87.252.58.21:5060 0.0.0.0:* LISTEN 4253/opensips
tcp 0 0 127.0.0.1:5060 0.0.0.0:* LISTEN 4253/opensips
udp 0 0 10.20.0.11:5060 0.0.0.0:* 4253/opensips
udp 0 0 87.252.58.21:5060 0.0.0.0:* 4253/opensips
udp 0 0 127.0.0.1:5060 0.0.0.0:* 4253/opensips

I win! :D

About rus

Arrogant, narcissistic and imperatively logical. I first started coding in the mid 80s on an Amstrad 6128, entering games found in the back of Amstrad Action.After watching Hackers and falling in love with Angelina Jolie I installed Slackware 2.0 on a P200 in 1997and spent the next 6-7 years studying computery things at various colleges and universities.Several years later I can now be found in an office premises by day sat in front of a Macbook, using a Windows VM to manage Linux servers, or in a field by night, fire dancing and holding pyrotechnics casually in my hands whilst they explode.

, , ,

banner