9
Most read
15
Most read
16
Most read
Kamailio on Docker
Stanley Wu (吳建澄)
skyeyester@gmail.com
Sep. 12, 2015
Outline
• Introduction to Kamailio
• Make Kamailio as Session Border Controller
(SBC) with B2BUA
• How to Configure Kamailio on Docker?
2
Introduction to Kamailio (1/3)
• Kamailio History
3
Source: http://www.kamailio.org/w/history/
Introduction to Kamailio (2/3)
• Kamailio is an Open-Source SIP Proxy (not
B2BUA)
• Kamailio can be configured as a Session
Border Controller (SBC)
– User authentication
– Blacklisting
– Brute-force attack protection
– Strip TLS
4
Introduction to Kamailio (3/3)
• Put Kamailio in front of a B2BUA farm(such as
FreeSWITCH), to perform load balancing, failure
routing and high availability.
• Containers (such as Docker) make Kamailio easy
to prototype and test, but many see them as a
way to scale on demand
5Ref: http://sip-router.org/history/
Make Kamailio as SBC with B2BUA (1/2)
• In this setup, the dialplan is detailed only for
inbound to outbound traffic, but it could be easily
extended for outbound to inbound traffic (or DID).
• The design is the following:
– FreeSWITCH is configured with an internal and an
external profile, each profile listening on a different
network interface.
– Kamailio is listening on the loopback interface, and is
not used by any other process than FreeSWITCH.
6
Make Kamailio as SBC with B2BUA (2/2)
• Separate the telephony core network from the
Internet to keep safety
7
Private Network
Internet
Kamailio
IVR
(FreeSWITCH)
RTP Gateway
(FreeSWITCH)
Database
PSTN Gateway
(FreeSWITCH)
IM/SMS
(Asterisk)
SIP User A SIP User B SIP User C SIP User D
How to Configure Kamailio on Docker?
• Docker Host System Environment
– CetOS 6.6 64bit
– 8GB RAM
– 10/100 NIC
– 512GB HardDisk
• Client
– Android/iOS Phone with Linphone APP
(Recommend)
– Other SIP phone software
8
How to Configure Kamailio on Docker?
• Install Docker (skip)
• Download the centos basic docker image
– $ docker pull delu2000/centos6.6:latest
• Run the centos in a new docker container with
port forwarding
– $ docker run -it -p 8888:22 -p 5060:5060/udp -p
5060:5060/tcp -p 16384-16394:16384-16394/udp -p
16384-16394:16384-16394/tcp -p 5080:5080/tcp -p
3478-3479:3478-3479/udp -p 7077:7077/udp -p
7077:7077/tcp delu2000/centos6.6:latest /bin/bash
9
How to Configure Kamailio on Docker?
• Prepare to Install Kamailio
– disable selinux
• # setenforce 0
– Install dependency
• # yum -y install gcc gcc-c++ gdb bison openssl-devel
libtermcap-devel ncurses-devel doxygen curl-devel
make newt-devel mlocate lynx tar wget nmap bzip2
unixODBC unixODBC-devel libtool-ltdl libtool-ltdl-devel
mysql-connector-odbc mysql mysql-devel mysql-server
flex libxml2 libxml2-devel pcre pcre-devel git which
10
How to Configure Kamailio on Docker?
• Install Kamailio by Source code
– Download source code
• # mkdir -p /usr/local/src/kamailio-4.0
• # cd /usr/local/src/kamailio-4.0
• # git clone --depth 1 git://git.sip-router.org/sip-router kamailio
• # cd kamailio
• # git checkout -b 4.0 origin/4.0
– Configure make
• # make cfg
– Modify modules.lst
• # vi modules.lst
• add db_mysql in the section that says include_modules
• include_modules= db_mysql
– Compile source code and install
• # make all
• # make install 11
How to Configure Kamailio on Docker?
• Start MySQL
– #service mysqld start
– #mysqladmin -u root password <your password>
• Configure Kamailio to use MySQL
– By default, Kamailio does not use MySQL. To change this
we need to edit one of Kamailio’s configuration files.
• # vi /usr/local/etc/kamailio/kamctlrc
– Uncomment the DBENGINE parameter by removing the
pound symbol and make sure the value equals MYSQL.
The parameter should look like this afterwards:
• DBENGINE=MYSQL
12
How to Configure Kamailio on Docker?
• Create the Kamailio Database Schema
– # /usr/sbin/kamdbctl create (say yes by default)
13
How to Configure Kamailio on Docker?
• Modify the Kamailio config file
– # vi /usr/local/etc/kamailio/kamailio.cfg
– Insert the following after the #!Kamailio line:
• #!define WITH_MYSQL
– mdoify IP #listen=udp:10.0.0.10:5060
• listen=udp:PRIVATE_IP:5060 advertise PUBLIC_IP:5060
• Start the Kamailio Server
– service kamailio start
14
How to Configure Kamailio on Docker?
• Test Kamailio
– Get Kamailio Error Log
• # kamailio -E -e –dd
– Creating SIP User Accounts
• # kamctl add <extension@domain> <password>
• e.g.=> kamctl add 1006@10.10.10.135 1234
– Registering a SIP Softphone
15
User ID: 1006
Domain: <Public_IP address of your Kamailio Server>
Password: 1234
Reference
• http://www.kamailio.org
• http://wiki.freeswitch.org/wiki/SBC_Setup
• https://github.com/alezzandro/docker-
kamailio
16

More Related Content

PDF
Why is Kamailio so different? An introduction.
PDF
Kamailio with Docker and Kubernetes
ODP
Expanding Asterisk with Kamailio
PDF
rtpengine and kamailio - or how to simulate calls at scale
PDF
Kamailio :: A Quick Introduction
PDF
rtpengine - Media Relaying and Beyond
ODP
Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...
PDF
FreeSWITCH as a Microservice
Why is Kamailio so different? An introduction.
Kamailio with Docker and Kubernetes
Expanding Asterisk with Kamailio
rtpengine and kamailio - or how to simulate calls at scale
Kamailio :: A Quick Introduction
rtpengine - Media Relaying and Beyond
Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...
FreeSWITCH as a Microservice

What's hot (20)

PDF
SIP Attack Handling (Kamailio World 2021)
PDF
SIPREC RTPEngine Media Forking
PDF
Kamailio - API Based SIP Routing
PDF
Scaling FreeSWITCH Performance
PDF
Continuous Integration and Kamailio
PDF
Sipwise rtpengine
PDF
Kamailio - Large Unified Communication Platforms
PDF
Kamailio, FreeSWITCH, and You
PDF
FreeSWITCH on Docker
PDF
Kamailio - SIP Firewall for Carrier Grade Traffic
PDF
Astricon 10 (October 2013) - SIP over WebSocket on Kamailio
PDF
Kamailio - Load Balancing Load Balancers
PDF
SIP Testing with FreeSWITCH
PDF
Kamailio - Secure Communication
PPTX
Session Initiation Protocol
PDF
Hacking SIP Like a Boss!
DOC
Basic command to configure mikrotik
PDF
Scaling Asterisk with Kamailio
PPTX
Linux Network Stack
PDF
Real-Time Text and WebRTC @ Kamailio World 2023
SIP Attack Handling (Kamailio World 2021)
SIPREC RTPEngine Media Forking
Kamailio - API Based SIP Routing
Scaling FreeSWITCH Performance
Continuous Integration and Kamailio
Sipwise rtpengine
Kamailio - Large Unified Communication Platforms
Kamailio, FreeSWITCH, and You
FreeSWITCH on Docker
Kamailio - SIP Firewall for Carrier Grade Traffic
Astricon 10 (October 2013) - SIP over WebSocket on Kamailio
Kamailio - Load Balancing Load Balancers
SIP Testing with FreeSWITCH
Kamailio - Secure Communication
Session Initiation Protocol
Hacking SIP Like a Boss!
Basic command to configure mikrotik
Scaling Asterisk with Kamailio
Linux Network Stack
Real-Time Text and WebRTC @ Kamailio World 2023
Ad

Recently uploaded (20)

PPTX
Training Program for knowledge in solar cell and solar industry
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
Consumable AI The What, Why & How for Small Teams.pdf
PPTX
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
PDF
Enhancing plagiarism detection using data pre-processing and machine learning...
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
Comparative analysis of machine learning models for fake news detection in so...
PPTX
The various Industrial Revolutions .pptx
PDF
sbt 2.0: go big (Scala Days 2025 edition)
PPTX
Modernising the Digital Integration Hub
PDF
Credit Without Borders: AI and Financial Inclusion in Bangladesh
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
PDF
4 layer Arch & Reference Arch of IoT.pdf
PPTX
Custom Battery Pack Design Considerations for Performance and Safety
PDF
Improvisation in detection of pomegranate leaf disease using transfer learni...
DOCX
search engine optimization ppt fir known well about this
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
CloudStack 4.21: First Look Webinar slides
PDF
A proposed approach for plagiarism detection in Myanmar Unicode text
Training Program for knowledge in solar cell and solar industry
Final SEM Unit 1 for mit wpu at pune .pptx
Consumable AI The What, Why & How for Small Teams.pdf
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
Enhancing plagiarism detection using data pre-processing and machine learning...
Developing a website for English-speaking practice to English as a foreign la...
Comparative analysis of machine learning models for fake news detection in so...
The various Industrial Revolutions .pptx
sbt 2.0: go big (Scala Days 2025 edition)
Modernising the Digital Integration Hub
Credit Without Borders: AI and Financial Inclusion in Bangladesh
A review of recent deep learning applications in wood surface defect identifi...
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
4 layer Arch & Reference Arch of IoT.pdf
Custom Battery Pack Design Considerations for Performance and Safety
Improvisation in detection of pomegranate leaf disease using transfer learni...
search engine optimization ppt fir known well about this
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
CloudStack 4.21: First Look Webinar slides
A proposed approach for plagiarism detection in Myanmar Unicode text
Ad

Kamailio on Docker

  • 1. Kamailio on Docker Stanley Wu (吳建澄) [email protected] Sep. 12, 2015
  • 2. Outline • Introduction to Kamailio • Make Kamailio as Session Border Controller (SBC) with B2BUA • How to Configure Kamailio on Docker? 2
  • 3. Introduction to Kamailio (1/3) • Kamailio History 3 Source: http://www.kamailio.org/w/history/
  • 4. Introduction to Kamailio (2/3) • Kamailio is an Open-Source SIP Proxy (not B2BUA) • Kamailio can be configured as a Session Border Controller (SBC) – User authentication – Blacklisting – Brute-force attack protection – Strip TLS 4
  • 5. Introduction to Kamailio (3/3) • Put Kamailio in front of a B2BUA farm(such as FreeSWITCH), to perform load balancing, failure routing and high availability. • Containers (such as Docker) make Kamailio easy to prototype and test, but many see them as a way to scale on demand 5Ref: http://sip-router.org/history/
  • 6. Make Kamailio as SBC with B2BUA (1/2) • In this setup, the dialplan is detailed only for inbound to outbound traffic, but it could be easily extended for outbound to inbound traffic (or DID). • The design is the following: – FreeSWITCH is configured with an internal and an external profile, each profile listening on a different network interface. – Kamailio is listening on the loopback interface, and is not used by any other process than FreeSWITCH. 6
  • 7. Make Kamailio as SBC with B2BUA (2/2) • Separate the telephony core network from the Internet to keep safety 7 Private Network Internet Kamailio IVR (FreeSWITCH) RTP Gateway (FreeSWITCH) Database PSTN Gateway (FreeSWITCH) IM/SMS (Asterisk) SIP User A SIP User B SIP User C SIP User D
  • 8. How to Configure Kamailio on Docker? • Docker Host System Environment – CetOS 6.6 64bit – 8GB RAM – 10/100 NIC – 512GB HardDisk • Client – Android/iOS Phone with Linphone APP (Recommend) – Other SIP phone software 8
  • 9. How to Configure Kamailio on Docker? • Install Docker (skip) • Download the centos basic docker image – $ docker pull delu2000/centos6.6:latest • Run the centos in a new docker container with port forwarding – $ docker run -it -p 8888:22 -p 5060:5060/udp -p 5060:5060/tcp -p 16384-16394:16384-16394/udp -p 16384-16394:16384-16394/tcp -p 5080:5080/tcp -p 3478-3479:3478-3479/udp -p 7077:7077/udp -p 7077:7077/tcp delu2000/centos6.6:latest /bin/bash 9
  • 10. How to Configure Kamailio on Docker? • Prepare to Install Kamailio – disable selinux • # setenforce 0 – Install dependency • # yum -y install gcc gcc-c++ gdb bison openssl-devel libtermcap-devel ncurses-devel doxygen curl-devel make newt-devel mlocate lynx tar wget nmap bzip2 unixODBC unixODBC-devel libtool-ltdl libtool-ltdl-devel mysql-connector-odbc mysql mysql-devel mysql-server flex libxml2 libxml2-devel pcre pcre-devel git which 10
  • 11. How to Configure Kamailio on Docker? • Install Kamailio by Source code – Download source code • # mkdir -p /usr/local/src/kamailio-4.0 • # cd /usr/local/src/kamailio-4.0 • # git clone --depth 1 git://git.sip-router.org/sip-router kamailio • # cd kamailio • # git checkout -b 4.0 origin/4.0 – Configure make • # make cfg – Modify modules.lst • # vi modules.lst • add db_mysql in the section that says include_modules • include_modules= db_mysql – Compile source code and install • # make all • # make install 11
  • 12. How to Configure Kamailio on Docker? • Start MySQL – #service mysqld start – #mysqladmin -u root password <your password> • Configure Kamailio to use MySQL – By default, Kamailio does not use MySQL. To change this we need to edit one of Kamailio’s configuration files. • # vi /usr/local/etc/kamailio/kamctlrc – Uncomment the DBENGINE parameter by removing the pound symbol and make sure the value equals MYSQL. The parameter should look like this afterwards: • DBENGINE=MYSQL 12
  • 13. How to Configure Kamailio on Docker? • Create the Kamailio Database Schema – # /usr/sbin/kamdbctl create (say yes by default) 13
  • 14. How to Configure Kamailio on Docker? • Modify the Kamailio config file – # vi /usr/local/etc/kamailio/kamailio.cfg – Insert the following after the #!Kamailio line: • #!define WITH_MYSQL – mdoify IP #listen=udp:10.0.0.10:5060 • listen=udp:PRIVATE_IP:5060 advertise PUBLIC_IP:5060 • Start the Kamailio Server – service kamailio start 14
  • 15. How to Configure Kamailio on Docker? • Test Kamailio – Get Kamailio Error Log • # kamailio -E -e –dd – Creating SIP User Accounts • # kamctl add <extension@domain> <password> • e.g.=> kamctl add [email protected] 1234 – Registering a SIP Softphone 15 User ID: 1006 Domain: <Public_IP address of your Kamailio Server> Password: 1234