Kamailio v5 with Siremis v5 GUI on Debian v9 MariaDB Apache Install Guide

Kamailio sip router
Kamailio® is an Open Source SIP Server released under GPL, able to handle thousands of call setups per second. Kamailio can be used to build large platforms for VoIP and realtime communications – presence, WebRTC, Instant messaging and other applications.  Moreover, it can be easily used for scaling up SIP-to-PSTN gateways, PBX systems or media servers like Asterisk™, FreeSWITCH™ etc.

Siremis is a web management interface for Kamailio.  It allows configuration of user profiles, routing rules, view accounting, registered phones, display charts etc.

This guide was tested using:

Debian v9 (Stretch)
Kamailio v5
Siremis v5


apt update && apt upgrade
apt install dbus nano sudo curl git lsb-release mariadb-server apache2


apt install php php-mysql php-gd php-curl php-xml php-xmlrpc php-pear

Set PHP timezone.

nano +924 /etc/php/7.0/apache2/php.ini
#For example
date.timezone = America/Vancouver
systemctl restart apache2


cd /usr/src
wget http://pear.php.net/get/XML_RPC-1.5.5.tgz
pear upgrade XML_RPC-1.5.5.tgz 

Disable Selinux

Check status


If the command is found and is not disabled, set SELINUX=disabled in /etc/selinux/config.  Requires reboot for changes to take effect.

sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/selinux/config

Disable Firewall

It is sometimes helpful to disable the firewall during installation.

systemctl disable firewalld
systemctl disable iptables
systemctl stop firewalld
systemctl stop iptables



timedatectl set-timezone America/Vancouver

​timedatectl status
systemctl restart rsyslog


wget -O- http://deb.kamailio.org/kamailiodebkey.gpg | sudo apt-key add -
echo "deb http://deb.kamailio.org/kamailio51 $(lsb_release -sc) main" >/etc/apt/sources.list.d/kamailio.list
apt update && apt install kamailio kamailio-mysql-modules kamailio-presence-modules kamailio-xml-modules

nano /etc/kamailio/kamctlrc and uncomment the DBENGINE and CHARSET lines as follows


Create Kamailio database

kamdbctl create

Answer y to everything.

Configure Kamailio


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

#!define WITH_MYSQL
#!define WITH_AUTH
##!define WITH_NAT
##!define WITH_TLS
#!define WITH_ACCDB
##!define WITH_DEBUG
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 */
systemctl restart kamailio


cd /var/www
git clone https://github.com/asipto/siremis

Create apache config file.  

cat >> /etc/apache2/sites-available/siremis.conf << EOF
<VirtualHost *:80>

    #ServerName www.example.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    ErrorLog /var/log/apache2/error.log
    CustomLog /var/log/apache2/access.log combined

    Alias /siremis "/var/www/siremis/siremis"
    <Directory "/var/www/siremis/siremis">
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted

            <FilesMatch "\.xml$">
                Require all denied

            <FilesMatch "\.inc$">
                Require all denied


a2dissite 000-default
a2ensite siremis
a2enmod rewrite
systemctl restart apache2

Create Siremis configs and set permissions

cd /var/www/siremis
make prepare24
make chown

Create MySQL user

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

Lock down the database


Answer Y to everything.


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

Siremis web wizard page 1

Siremis web wizard page 2

Siremis web wizard page 4

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

Siremis web wizard page 4

Siremis web wizard page 5

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


chmod 000 /var/www/siremis/siremis/install


Change admin password and email

Kamailio administration change username and password1

Siremis administration change password and username 2

Add SIP users

Siremis administration add SIP users 1

Siremis Administration add SIP users 2



apt -y install firewalld
systemctl enable firewalld
systemctl start firewalld

firewall-cmd --permanent --zone=public --add-service={http,https}
firewall-cmd --permanent --zone=public --add-port={5060,5061}/tcp
firewall-cmd --permanent --zone=public --add-port={5060,5061}/udp
firewall-cmd --reload
firewall-cmd --list-all

Log file

To write Kamailio logs to a separate log file in addition to /var/log/syslog.

## Add the following line to /etc/rsyslog.conf
local0.*             -/var/log/kamailio.log
touch /var/log/kamailio.log
systemctl restart rsyslog

Siremis v5.1.x - Installation