Bobcares

Install Kamailio SIP proxy server on CentOS 7 with ease

by | Dec 9, 2020

Wondering how to install Kamailio sip proxy server on centos 7? We can help you with it.

Here at Bobcares, we have seen several such CentOS related queries as part of our Server Management Services for web hosts and online service providers.

Today we’ll see how to install phpIPAM on CentOS.

 

Know more about Kamailio

Kamailio is a distribution of SER. It mainly provides a scalable SIP server suitable for small through to carrier-grade installations.

It can handle over 5000 call setups per second. Also, it can serve up to 300,000 active subscribers with just a 4GB Ram System.

Moreover, it functions as a Registrar server, Location server, Proxy server, SIP Application server, and Redirect server.

 

How we install Kamailio sip proxy server on CentOS 7

Now let’s take a look at how our Support Engineers install the Kamailio sip proxy server.

 

Step 1: Setting SELinux to a Permissive/Disabled mode

Here is the command we run to set the SELinux to permissive mode.

$ sudo setenforce 0
$ sudo sed -i ‘s/^SELINUX=.*/SELINUX=permissive/g’ /etc/selinux/config

Or else we can also permanently disable it by rebooting the CentOS system.

$ sudo setenforce 0
$ sudo sed -i ‘s/^SELINUX=.*/SELINUX=disabled/g’ /etc/selinux/config
$ sudo reboot

After rebooting, we confirm SELinux status:

$ sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 31

 

Step 2: Install MariaDB Database server

Kamailio requires a database server to function. For this, we will install the MariaDB database server by running the below commands.

$ sudo yum -y install mariadb-server
$ sudo systemctl enable –now mariadb
$ sudo mysql_secure_installation

 

Step 3: Add Kamailio RPM Repository

CentOS 8:

$ sudo wget -O /etc/yum.repos.d/kamailio.repo http://download.opensuse.org/repositories/home:/kamailio:/v5.3.x-rpms/CentOS_8/home:kamailio:v5.3.x-rpms.repo

Some packages are not on CentOS 8 repository. We have to use Fedora 29 repository on CentOS 8. If the same issue happens to you, change the repository by running the commands below.

$ sudo wget -O /etc/yum.repos.d/kamailio.repo http://download.opensuse.org/repositories/home:/kamailio:/v5.3.x-rpms/Fedora_29/home:kamailio:v5.3.x-rpms.repo

CentOS 7:

$ sudo wget -O /etc/yum.repos.d/kamailio.repo http://download.opensuse.org/repositories/home:/kamailio:/v5.3.x-rpms/CentOS_7/home:kamailio:v5.3.x-rpms.repo

 

Step 4: Install Kamailio SIP Server on CentOS 8/CentOS 7

Once we add the repository, we install the Kamailio SIP Server on CentOS 8/CentOS 7 Linux.

$ sudo yum install vim kamailio kamailio-presence kamailio-ldap kamailio-mysql kamailio-debuginfo kamailio-xmpp kamailio-unixodbc kamailio-utils kamailio-tls kamailio-outbound kamailio-gzcompress

Dependency tree will be shown. In that we enter the ‘Y’ key to begin installation.

Then we confirm Kamailio version.

$ kamailio -version
version: kamailio 5.3.3 (x86_64/linux) c918a3
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: c918a3
compiled on 14:32:52 Mar 16 2020 with gcc 8.2.1

 

Step 5: Configuring Kamailio SIP proxy server on CentOS 8/CentOS 7

Now we edit the file /etc/kamailio/kamctlrc and make sure the DBENGINE variable is set to MySQL. Then we remove the pound symbol to uncomment it.

$ sudo vi /etc/kamailio/kamctlrc

After that, we set the database engine to MySQL.

DBENGINE=MYSQL
DBHOST=localhost

We run the below command to create users and tables required by Kamailio (Schema).

$ sudo kamdbctl create
MySQL password for root:
INFO: test server charset
INFO: creating database kamailio …
INFO: granting privileges to database kamailio …
INFO: creating standard tables into kamailio …
INFO: Core Kamailio tables succesfully created.
Install presence related tables? (y/n): y
INFO: creating presence tables into kamailio …
INFO: Presence tables succesfully created.
Install tables for imc cpl siptrace domainpolicy carrierroute
drouting userblacklist htable purple uac pipelimit mtree sca mohqueue
rtpproxy rtpengine secfilter? (y/n): y
INFO: creating extra tables into kamailio …
INFO: Extra tables succesfully created.
Install tables for uid_auth_db uid_avp_db uid_domain uid_gflags
uid_uri_db? (y/n): y
INFO: creating uid tables into kamailio …
INFO: UID tables succesfully created.

When asked for a root password, we enter the MySQL root user password as configured through mysql_secure_installation

Then we answer all the questions that follow. Next we edit /etc/kamailio/kamailio.cfg to configure Kamailio:

$ sudo vi /etc/kamailio/kamailio.cfg

Then we add the following lines just below #!KAMAILIO.

#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_USRLOCDB
#!define WITH_NAT
#!define WITH_PRESENCE
#!define WITH_ACCDB

After that, we start Kamailio

$ sudo systemctl restart kamailio

Then we enable the service to start on boot.

$ sudo systemctl enable kamailio

Finally, now we have a running Kamailio SIP server on CentOS.

$ systemctl status kamailio
● kamailio.service - Kamailio (OpenSER) - the Open Source SIP Server
Loaded: loaded (/usr/lib/systemd/system/kamailio.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2020-12-05 16:35:23 EAT; 12s ago
Main PID: 9648 (kamailio)
Tasks: 41 (limit: 24003)
Memory: 50.0M
CGroup: /system.slice/kamailio.service
├─9648 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9649 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9650 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9651 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9652 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9653 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9654 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9655 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9656 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9658 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
├─9659 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
......

[Need any further assistance with CentOS queries? – We are here to help you.]

 

Conclusion

In today’s writeup, we saw how our Support Engineers install Kamailio sip proxy on CentOS.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

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

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF