Kamailio 4.x Debian Jessie

linux Varios

Estos días estoy liado con el tema del sipproxy Kamailio….. un gran software y potente donde los haya.
Empezamos con que disponemos de un debian jessie limpito; instalamos las dependencias:

apt-get install git-core gcc flex bison libmysqlclient-dev make libssl-dev libcurl4-openssl-dev libxml2-dev libpcre3-dev mysql-server

Y ahora descargamos el source de kamailio:

root@sipproxy:/usr/src# wget -c https://www.kamailio.org/pub/kamailio/4.2.2/src/kamailio-4.4.4_src.tar.gz
root@sipproxy:/usr/src# tar -zxvf kamailio-4.4.4_src.tar.gz

Preparamos para compilar:

#make cfg

Editamos el fichero /usr/src/kamailio-4.4.4/modules.lst y modificamos:

# the list of extra modules to compile

Guardamos y vamos a compilar:

#make install

Una vez compilado, tendremos los ficheros en /usr/local/etc/kamailio.
Creamos un usuario para el mysql / kamailio:

mysql> grant all privileges on kamailio.* to 'kamailio'@'%' identified by 'kamailio' with grant option;

Modificamos el kamctrlc para que use mysql (en mi caso) y lo dejamos tal que:


## database host

## database name (for ORACLE this is TNS name)

# database path used by dbtext, db_berkeley or sqlite
# DB_PATH=»/usr/local/etc/kamailio/dbtext»

## database read/write user

## password for database read/write user

## database read only user

## password for database read only user

ahora creamos las bbdd:

root@monaca:/usr/local/etc/kamailio# /usr/local/sbin/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
userblacklist htable purple uac pipelimit mtree sca mohqueue
rtpproxy? (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.

preparamos el kamailio para que arranque y crearemos el init.d

root@monaca:/usr/src/kamailio-4.4.4/pkg/kamailio/deb/precise# cp kamailio.init /etc/init.d/kamailio

root@monaca:/usr/src/kamailio-4.4.4/pkg/kamailio/deb/precise# cp kamailio.default /etc/default/kamailio

Editamos el fichero /etc/default/kamailio

# Kamailio startup options

# Set to yes to enable kamailio, once configured properly.

# User to run as

# Group to run as

# Amount of shared and private memory to allocate
# for the running Kamailio server (in Mb)

# Config file

# Enable the server to leave a core file when it crashes.
# Set this to 'yes' to enable Kamailio to leave a core file when it crashes
# or 'no' to disable this feature. This option is case sensitive and only
# accepts 'yes' and 'no' and only in lowercase letters.
# On some systems it is necessary to specify a directory for the core files
# to get a dump. Look into the kamailio init file for an example configuration.

Creamos el fichero pid, usuarios:

adduser --quiet --system --group --disabled-password --shell /bin/false --gecos "kamailio" --home /var/run/kamailio kamailio

Copiamos el init.d

cp /usr/src/kamailio-4.4.4/pkg/kamailio/deb/precise/kamailio.init /etc/init.d/kamailio
mkdir -p /var/run/kamailio
chmod 755 /etc/init.d/kamailio
chown kamailio:kamailio /var/run/kamailio

y ahora para que arranque con el systcl, añadimos el siguiente fichero /etc/systemd/system/kamailio.service

Description=Kamailio SIP Server

ExecStart=/usr/local/sbin/kamctl start
ExecRestart=/usr/local/sbin/kamctl restart
ExecStop=/usr/local/sbin/kamctl stop


Enjoy your kamailio server 😉

Deja una respuesta

Tu dirección de correo electrónico no será publicada.