Kamailio Version IMS
Kamailio Version IMS
Step 1: Prerequisites:
To be able to follow the guidelines from this document you need 'root' access.
The following packages are required before proceeding to the next steps.
# apt-get install git-core vim gcc flex bison libmysqlclient-dev make libssl-dev libcurl4-openssl-dev
libxml2-dev libpcre3-dev dpkg dpkg-dev debhelper iptables-dev libcurl4-openssl-dev libpcre3-dev
libxmlrpc-core-c3-dev markdown libavcodec-dev libavfilter-dev libavformat-dev libevent-dev libglib2.0-
dev libhiredis-dev libjson-glib-dev libpcap0.8-dev libbencode-perl libcrypt-rijndael-perl libdigest-hmac-
perl libio-socket-inet6-perl libsocket6-perl gedit bind9 dkms
First of all Clone the RTPengine project from GitHub. To clone the RTPengine use below command.
# cd /usr/local/src
Then enter into rtpengine directory and run ./debian/flavors/no_ngcp in order to remove any NGCP dependencies
# cd rtpengine/
# ./debian/flavors/no_ngcp
Then we need to run the dpkg-buildpackage command. But I got lot of dependencies.. here is the list.
# dpkg-buildpackage
# cd /usr/local/src
# dpkg -i ngcp-rtpengine-daemon_5.4.0.0+0~mr5.4.0.0_amd64.deb
# dpkg -i ngcp-rtpengine-iptables_5.4.0.0+0~mr5.4.0.0_amd64.deb
# dpkg -i ngcp-rtpengine-dbg_5.4.0.0+0~mr5.4.0.0_amd64.deb
# dpkg -i ngcp-rtpengine-recording-daemon_5.5.3.0+0~mr5.5.3.0_amd64.deb
# dpkg -i ngcp-rtpengine-kernel-source_5.5.3.0+0~mr5.5.3.0_all.deb
# dpkg -i ngcp-rtpengine-kernel-dkms_5.5.3.0+0~mr5.5.3.0_all.deb
# dpkg -i ngcp-rtpengine-utils_5.5.3.0+0~mr5.5.3.0_all.deb
Now Installation is completed need to run the rtp engine. We need to edit the /etc/rtpengine/rtpengine.conf
# cp rtpengine.sample.conf rtpengine.conf
# nano /etc/rtpengine/rtpengine.conf
# modprobe xt_RTPENGINE
Replace bind-address in /etc/mysql/my.cnf to your ip-address address (instead of 127.0.0.1) to enable remote access
Restart mysql and check via command "tail -F /var/log/syslog" for errors
# /etc/init.d/mysql stop
# /etc/init.d/mysql start
Step 4: Kamailio-5.0.4:
First of all, you have to create a directory on the file system where the sources will be stored.
# mkdir -p /usr/local/src/kamailio-5.0
# cd /usr/local/src/kamailio-5.0
git source of kamailio download link: https://www.kamailio.org/pub/kamailio/5.0.4/
# mv kamailio-5.0.4 kamailio
(OR)
# cd usr/local/src/kamailio-5.0
# cd kamailio/
# git clone --depth 1 --no-single-branch git://git.kamailio.org/kamailio kamailio
Tuning Makefiles:
# make cfg
To set include_modules variable to the extra modules to be included for compilation when building Makefile cfg:
# make includeinclude_modules=”db_mysql ims_usrloc_pcscf ims_registrar_pcscf ims_auth ims_charging
ims_icscf ims_isc ims_qos ims_registrar_scscf ims_usrloc_scscf ims_dialog cdp cdp_avp pua outbound rr
ctl jsonrpcs presence xmlrpc evapi json” cfg
Compile Kamailio:
Once you added the mysql module to the list of enabled modules, you can compile Kamailio:
# make all
if any sctp errors : apt-get install libsctp-dev lksctp-tools
Install Kamailio:
# make install
What And Where Was Installed
The binaries and executable scripts were installed in:
/usr/local/sbin
These are:
kamailio - Kamailio SIP server
kamdbctl - script to create and manage the Databases
kamctl - script to manage and control Kamailio SIP server
kamcmd - 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:
# PATH=$PATH:/usr/local/sbin
# export PATH
# mkdir -p /var/run/kamailio_pcscf/
# mkdir -p /var/run/kamailio_icscf/
# mkdir -p /var/run/kamailio_scscf/
Default setting is to run Kamailio as user kamailio and group kamailio. For that you need to create the user:
Step 5: Creating Mysql Database for PCSCF, ICSCF and SCSCF following commands below:
# mysql -u root -p
CREATE DATABASE `pcscf`;
CREATE DATABASE `icscf`;
CREATE DATABASE `scscf`;
To create the MySQL database, you have to use the database setup script. First edit following below files to set the
database server type:
# nano /usr/local/src/kamailio-5.0/kamailio/utils/kamctl/mysql/ims_usrloc_pcscf-create.sql
modifications are:
add at the top: USE pcscf;
change: INSERT INTO to REPLACE INTO
insert before CREATE TABLE `location`;
DROP TABLE IF EXISTS `location`;
# nano /usr/local/src/kamailio-5.0/kamailio/utils/kamctl/mysql/ims_usrloc_scscf-create.sql
modifications are:
add at the top: USE scscf;
Ex. change: INSERT INTO to REPLACE INTO
◦ insert before CREATE TABLE `contact`;
◦ DROP TABLE IF EXISTS `contact`; Similar changes to all tables.
# cp /usr/local/src/kamailio-5.0/kamailio/misc/examples/icscf/icscf.sql /usr/local/src/kamailio-
5.0/kamailio/utils/kamctl/mysql/
# nano /usr/local/src/kamailio-5.0/kamailio/utils/kamctl/mysql/icscf.sql
▪ add at the top: USE icscf;
# nano /usr/local/src/kamailio-5.0/kamailio/utils/kamctl/mysql/presence-create.sql
▪ add at the top: USE scscf;
# mysql -u root -p < /usr/local/src/kamailio-5.0/kamailio/utils/kamctl/mysql/presence-create.sql
# nano /usr/local/src/kamailio-5.0/kamailio/utils/kamctl/mysql/icscf.sql
▪ add at the top: USE icscf;
# mysql -u root -p < /usr/local/src/kamailio-5.0/kamailio/utils/kamctl/mysql/icscf.mysql.sql
Download FHoSS
# apt-get install subversion
Download:
# svn checkout svn://svn.code.sf.net/p/openimscore/code/FHoSS/trunk
compile:
# cd FHoSS
# ant compile deploy
directory: /opt/OpenIMSCore/FHoSS/scripts
cd ../scripts; cp ../deploy/configurator.sh .; ./configurator.sh
# chmod +x configurator.sh
# ./configurator.sh
Domain Name:koffee-ims.in
IP Address:10.0.0.9(your ip address)
File to change ["all" for everything, "exit" to quit]:all
changing: hss_db_migrate_dsai.sql hss_db.sql userdata.sql
directory: /opt/OpenIMSCore/FHoSS/config
cd ../scripts; cp ../deploy/configurator.sh .; ./configurator.sh
# chmod +x configurator.sh
# ./configurator.sh
Domain Name:koffee-ims.in
IP Address:10.0.0.9(your ip address)
File to change ["all" for everything, "exit" to quit]:all
changing: hss_db_migrate_dsai.sql hss_db.sql userdata.sql
Modify mysql access rights at first time installation (not covered by configurator):
# mysql -u root -p
grant delete,insert,select,update on hss_db.* to [email protected] identified by 'hss';
check database with MySQL Workbench if domain names are okay in various entries and privileges
(or)
manually: e.g.
show databases;
use hss_db;
select * from impu;
P-CSCF:
-------
- use modified files: pcscf.cfg, kamailio.cfg, distpacher.list, and pcscf.xml with Ip addresses and domain name.
Example: In pcscf.cfg file:
listen=udp:115.98.3.93:5060
alias=pcscf.koffee-ims.in
#!define PCSCF_URL "sip:pcscf.koffee-ims.in"
#!subst "/NETWORKNAME/koffee-ims.in/"
#!subst "/HOSTNAME/pcscf.koffee-ims.in/"
#!define DB_URL "con1=>mysql://pcscf:[email protected]/pcscf"
#!define SQLOPS_DBURL "pcscf=>mysql://pcscf:[email protected]/pcscf"
In pcscf.xml file:
FQDN="pcscf.koffee-ims.in"
Realm="koffee-ims.in"
<Peer FQDN="pcrf.kofee-ims.in" Realm="koffee-ims.in" port="3868"/>
<Acceptor port="3871" bind="115.98.3.93"/>
<DefaultRoute FQDN="pcrf.koffee-ims.in" metric="10"/>
In distpatcher.list file:
1 sip:115.98.3.93:6060
In kamailio.cfg file:
modparam("ims_usrloc_pcscf", "db_url", "mysql://root:[email protected]/pcscf")
modparam("pua", "db_url", "mysql://scscf:[email protected]/scscf")
mpath="/usr/local/src/kamailio-5.0/kamailio/src/modules/"
I-CSCF:
-------
- use modified files: icscf.cfg, icscf.xml and kamailio.cfg with Ip addresses and domain name.
Example: In icscf.cfg file:
listen=udp:115.98.3.93:4060
alias=icscf.koffee-ims.in
#!define NETWORKNAME "koffee-ims.in"
#!define HOSTNAME "icscf.koffee-ims.in"
#!define DB_URL "mysql://icscf:[email protected]/icscf"
In icscf.xml file;
FQDN="icscf.koffee-ims.in"
Realm="koffee-ims.in"
<Peer FQDN="hss.koffee-ims.in" Realm="koffee-ims.in" port="3868"/>
<Acceptor port="3869" bind="115.98.3.93"/>
<DefaultRoute FQDN="hss.koffee-ims.in" metric="10"/>
In kamailio.cfg file:
listen=tcp:115.98.3.93:4060
mpath="/usr/local/src/kamailio-5.0/kamailio/src/modules/"
S-CSCF
------
- use modified files: scscf.cfg , scscf.xml, distpacher.list, and kamailio.cfg with Ip addresses and domain name.
Example: In scscf.cfg file:
listen=udp:115.98.3.93:6060
#!define NETWORKNAME "koffee-ims.in"
#!define HOSTNAME "scscf.koffee-ims.in"
#!define URI "sip:scscf.koffee-ims.in"
alias=scscf.koffee-ims.in
alias=koffee-ims.in
#!define ENUM_SUFFIX "koffee-ims.in."
#!define DB_URL "mysql://scscf:[email protected]/scscf"
In scscf.xml file:
FQDN="scscf.koffee-ims.in"
Realm="koffee-ims.in"
<Peer FQDN="hss.koffee-ims.in" Realm="koffee-ims.in" port="3868"/>
<Acceptor port="3870" bind="115.98.3.93"/>
<DefaultRoute FQDN="hss.koffee-ims.in" metric="10"/>
In kamailio.cfg file:
mpath="/usr/local/src/kamailio-5.0/kamailio/src/modules/"