Kamailio SIP Server Installation

Installation :-

For 64 bit install the following packages:

sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6

Now, to install the Kamailio server, you need to add the relevant repository to the list of repositories, and then install it through apt-get.

wget -O- http://deb.kamailio.org/kamailiodebkey.gpg | sudo apt-key add -
sudo nano /etc/apt/sources.list

The first command will download a GPG key, and the second will opens the list of repositories. At the end of this list, add the following:

deb http://deb.kamailio.org/kamailio {ubuntu-nickname} main
deb-src http://deb.kamailio.org/kamailio {ubuntu-nickname} main

Ex: Replace with ubuntu nickname

deb http://deb.kamailio.org/kamailio trusty main
deb-src http://deb.kamailio.org/kamailio trusty main

Then we need to update apt-get so that it includes the packages from the added repository, and then install it:

1. sudo apt-get update
2. sudo apt-get install libxml2-dev
3. sudo apt-get install kamailio kamailio-mysql-modules kamailio-tls-modules kamailio-presence-modules

Kamailio server stores the usernames and passwords on a local MySQL server, so it’s necessary that we install it. When you install it and it asks for a root password, choose one and make sure to not forget it. Execute:

sudo apt-get install mysql-server
sudo apt-get install rtpproxy

Copy kamailio-advanced.cfg from /etc/kamailio/ to any place convenient to you to edit it.

sudo cp /etc/kamailio/kamailio-advanced.cfg

The above command will copy kamailio-advanced.cfg to current location. Rename this file to kamailio.cfg by executing:

mv kamailio-advanced.cfg kamailio.cfg

Now edit this file.

sudo nano kamailio.cfg

Add the following below #!KAMAILIO

#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_NAT
#!define WITH_DEBUG
#!define WITH_DIALOG

specify alias if you have a domain name
#alias=”sip.mydomain.com” to alias=”mydomain.com”

Now save(Ctrl+O) exit nano editor (Ctrl+X)

Copy this updated kamailio.cfg to /etc/kamailio/ by executing

sudo cp kamailio.cfg /etc/kamailio/

Create a new file kamailio_fifo in /tmp and and assign read/write permissions to it.

sudo chmod 777 /tmp/kamailio_fifo

Configure the IP for Kamailio as well as the database that will be used (in this case, MySQL) by editing /etc/kamailio/kamctlrc to contain

Now we’re ready to configure Kamailio. Edit the file in /etc/default/kamailio by removing the required hashtag so that it reads:


Now create the database for the Kamailio installation by executing

kamdbctl create

When required, enter the password for the root user for MySQL that you specified earlier. Create all the tables that your are prompted to create.

You can add users to the current database with the following command:

kamctl add userid password

and then, when prompted for the kamailio@localhost password, enter the password as specified in the /etc/kamailio/kamctlrc file – by default, it is ‘kamailiorw’.

To add a user
kamctl add username password

To remove a user
kamctl rm username

Default Password: kamailiorw

To display all users
kamctl db show subscriber

To display online users
kamctl ul show

netstat -a -n | grep 5060

Start Kamailio SIP Server : sudo service kamailio start

Stop Kamailio SIP Server : sudo service kamailio stop

Restart Kamailio SIP Server : sudo service kamailio restart


Michael Patterson sat down with the CEO of Boston Byte, Mustapha Shaikh to discuss the significance and rapid digitization of the healthcar...