Kamailio Supernode & Siremis GUI Install guide

A Kamailio supernode is a SIP router capable of user authentication and status tracking among other things.  It can be used to create a private secure peer-to-peer SIP service similar to Skype™ for example.  It can also be used to connect to other nodes, gateways, PBX’s etc.  Siremis is currently be the best GUI for use with Kamailio.

This guide was tested using:

CentOS 7
Kamailio v4.4
Siremis v4.4

Features:

*secure peer-to-peer communication
*person to person or group voice calls
*person to person video calls
*screen sharing
*instant messaging
*presence status
*call detail records

Pre-install

yum -y update && yum -y groupinstall core && yum -y groupinstall base && yum -y install epel-release
yum install httpd mariadb-server php php-mysql php-gd php-curl rtpproxy

Confirm that selinux is disabled

sestatus

Kamailio

nano /etc/yum.repos.d/kamailio44.repo
[home_kamailio_v4.4.x-rpms]
name=RPM Packages for Kamailio v4.4.x (CentOS_7)
type=rpm-md
baseurl=http://download.opensuse.org/repositories/home:/kamailio:/v4.4.x-rpms/CentOS_7/
gpgcheck=1
gpgkey=http://download.opensuse.org/repositories/home:/kamailio:/v4.4.x-rpms/CentOS_7//repodata/repomd.xml.key
enabled=1
yum install kamailio kamailio-presence kamailio-mysql kamailio-tls 

Set mysql and apache servers to start on boot.

systemctl enable mariadb
systemctl enable httpd

Rtproxy is optional if not using NAT

systemctl enable rtpproxy

nano /etc/kamailio/kamctlrc and uncomment the DBENGINE line as follows

DBENGINE=MYSQL

Create MySQL database.  Answer “y” to all options.

systemctl restart mariadb
kamdbctl create

Configure Kamailio

————————————————————-

Edit /etc/kamailio/kamailio.cfg so the top of the file looks like the following:

#!KAMAILIO
#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_USRLOCDB
#!define WITH_PRESENCE
##!define WITH_NAT
##!define WITH_TLS
#!define WITH_ACCDB
Add this part around line #240 in with the other loadmodule statements
# -- for siremis CDRs --------------
loadmodule "rtimer.so"
loadmodule "sqlops.so"
Add the following around line #460 at the end of the modparam section before the routing logic section.
# -- for siremis CDRs --------------
modparam("rtimer", "timer", "name=cdr;interval=300;mode=1;")
modparam("rtimer", "exec", "timer=cdr;route=CDRS")
modparam("sqlops", "sqlcon", "cb=>mysql://kamailio:kamailiorw@localhost/kamailio")
Finally add this at the end of the routing section around line #910
# ======================================================
# Populate CDRs Table of Siremis
# ======================================================
route[CDRS] {
    sql_query("cb","call kamailio_cdrs()","rb");
    sql_query("cb","call kamailio_rating('default')","rb");
    }
 
Alternatively, replace the entire file with this pre-configured kamailio.cfg file.
————————————————————–
 
If pointing users to a FQDN you need to specify that as a local alias.  The commented out example is located around line #170 in /etc/kamailio/kamailio.cfg.  This is required if pointing SIP clients to the FQDN instead of the IP address.
/* add local domain aliases */
alias="your_server_fqdn"
systemctl restart kamailio

Create kamailio systemd file

nano /etc/systemd/system/kamailio.service
[Unit]
Description=Kamailio - the Open Source SIP Server
After=network-online.target
After=mariadb.service httpd.service

[Service]
Type=forking
Environment='CFGFILE=/etc/kamailio/kamailio.cfg'
EnvironmentFile=/etc/default/kamailio
ExecStartPre=/usr/bin/mkdir -m=2770 -p /var/run/kamailio
ExecStartPre=/usr/bin/chown kamailio:kamailio /var/run/kamailio
PIDFile=/var/run/kamailio.pid
ExecStart=/usr/sbin/kamailio -P /var/run/kamailio.pid -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP
ExecStopPost=/usr/bin/rm -f /var/run/kamailio.pid
Restart=on-abort

[Install]
WantedBy=multi-user.target
systemctl daemon-reload
chkconfig kamailio off
systemctl enable kamailio
systemctl restart kamailio

Siremis

cd /usr/src
wget http://siremis.asipto.com/pub/downloads/siremis/siremis-4.4.0.tgz
tar zxvf siremis*
cp -a siremis*/. /var/www/html
cd /var/www/html
make prepare24
rm -rf /var/www/html/Makefile
rm -rf /var/www/html/Changelog
rm -rf /var/www/html/README
chown -R apache. /var/www/html

Create apache config file

nano /etc/httpd/conf.d/siremis.conf
<Directory "/var/www/html/siremis">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
        <FilesMatch "\.xml$">
            Order deny,allow
            Deny from all
        </FilesMatch>
        <FilesMatch "\.inc$">
            Order deny,allow
            Deny from all
        </FilesMatch>
  </Directory>

<Directory "/var/www/html/openbiz">
    AllowOverride All
    Order deny,allow
    Deny from all
  </Directory>

<Directory "/var/www/html/misc">
    AllowOverride All
    Order deny,allow
    Deny from all
  </Directory>
systemctl restart httpd

Create MySQL user

mysql -e "GRANT ALL PRIVILEGES ON siremis.* TO siremis@localhost IDENTIFIED BY 'siremisrw';"

Lock down the database and set root password

mysql_secure_installation

Answer Y to everything.

Set PHP timezone.

nano +878 /etc/php.ini
#For example
date.timezone = America/Vancouver
systemctl restart httpd

Run the web install wizard from a web browser at http://your_server_ip_or_fqdn/siremis

*Note in the above image that you should have all 4 boxes checked at the bottom for a first time install.

If you want to run the install wizard again
rm -rf /var/www/html/siremis/install.lock

Administration

Change admin password and email

Add SIP users

Install and configure client

On your desktop or mobile device install your favorite SIP software such as Jitsi.  

The SIP ID is username@your_server_ip_or_fqdn where username is the name added in the above image.

To set up the client to use TLS remember that it uses port 5061.  It is not obvious how to set that up in Jitsi so an image of the relevant section in Jitsi v2.8.x is shown below.

References:

Run your own Skype-like service in less than one hour
Siremis v4.4.x – Installation