# Install And Maintain Kamailio v4.0.x Version From GIT
gcc compiler: apt-get install gcc
flex - apt-get install flex
bison - apt-get install bison
libmysqlclient-dev - apt-get install libmysqlclient-dev
make - apt-get install make
if you want to enable more modules, some of them require extra libraries:
libssl - apt-get install libssl-dev
libcurl - apt-get install libcurl4-openssl-dev
libxml2 - apt-get install libxml2-dev
libpcre3 - apt-get install libpcre3-dev
#Getting sources from GIT
mkdir -p /usr/local/src/kamailio-4.0
git clone --depth 1 --no-single-branch git://git.sip-router.org/sip-router kamailio
git checkout -b 4.0 origin/4.0
nano -w modules.lst # Add db_mysql to the variable include_modules.
Save the modules.lst and exit.
make include_modules="db_mysql" cfg
make PREFIX="/usr/local/kamailio-4.0" include_modules="db_mysql" cfg
If you set this PREFIX you have to change most of the paths below from '/usr/local/…' to '/usr/local/kamailio-4.0/…'.
# ! >>>> http://sip-router.org/wiki/tutorials/makefile-system
# Compile Kamailio
make Q=0 all
# Install Kamailio
# What and where was installed
# kamailio - Kamailio SIP server
# kamdbctl - script to create and manage the Databases
# kamctl - script to manage and control Kamailio SIP server
# sercmd - CLI - command line tool to interface with Kamailio SIP server
To be able to use the binaries from command line, make sure that '/usr/local/sbin' is set in PATH environment variable.
You can check that with 'echo $PATH'. If not and you are using 'bash', open '/root/.bash_profile' and at the end add:
Kamailio (OpenSER) modules are installed in:
# Replace …/lib/… with ../lib64/… in most of 64b architectures.
# The documentation and readme files are installed in:
# The man pages are installed in:
The configuration file was installed in:
In case you set the PREFIX variable in 'make cfg …' command, then replace /usr/local in all paths above with the value of PREFIX in order to locate the files installed.
# Create MySQL database
nano -w /usr/local/etc/kamailio/kamctlrc
Locate DBENGINE variable and set it to MYSQL:
- kamailio - (with default password 'kamailiorw') - user which has full access rights to 'kamailio' database
- kamailioro - (with default password 'kamailioro') - user which has read-only access rights to 'kamailio' database
#To fit your requirements for the VoIP platform, you have to edit the configuration file.
Follow the instruction in the comments to enable usage of MySQL. Basically you have to add several lines at the top of config file, like:
If you changed the password for the 'kamailio' user of MySQL, you have to update the value for 'db_url' parameters.
You can browse kamailio.cfg online on GIT repository.
# The init.d script
The init.d script can be used to start/stop the Kamailio server in a nicer way. A sample of init.d script for Kamailio is provided at:
Just copy the init file into the /etc/init.d/kamailio. Then change the permissions:
chmod 755 /etc/init.d/kamailio
then edit the file updating the $DAEMON and $CFGFILE values:
You need also setup a configuration file in the /etc/default/ directory. This file can be found at:
You need to rename the file to 'kamailio' after you've copied it. Then edit this file and set RUN_KAMAILIO=yes. Edit the other options at your convenience.
Create the directory for pid file:
mkdir -p /var/run/kamailio
Default setting is to run Kamailio as user “kamailio” and group “kamailio”. For that you need to create the user:
adduser --quiet --system --group --disabled-password \
--shell /bin/false --gecos "Kamailio" \
--home /var/run/kamailio kamailio
# set ownership to /var/run/kamailio
chown kamailio:kamailio /var/run/kamailio
Then you can start/stop Kamailio using the following commands:
# Ready to rock
Now everything is in place. You can start the VoIP service, creating new accounts and setting the phones.
A new account can be added using 'kamctl' tool via 'kamctl add <username> <password> <email>'. (or try without the email)
kamctl add test testpasswd email@example.com
If you are asked for SIP_DOMAIN environment variable do one of the following option.
# export SIP_DOMAIN=mysipserver.com
# edit '/root/.kamctlrc' and add:
The maintenance process is very simple right now. You have to be user 'root' and execute following commands:
git pull origin
Now you have the latest Kamailio devel running on your system.