SlideShare une entreprise Scribd logo
1  sur  16
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

Tendances (20)

Kamailio - API Based SIP Routing
Kamailio - API Based SIP RoutingKamailio - API Based SIP Routing
Kamailio - API Based SIP Routing
 
Expanding Asterisk with Kamailio
Expanding Asterisk with KamailioExpanding Asterisk with Kamailio
Expanding Asterisk with Kamailio
 
Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...
Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...
Using Asterisk and Kamailio for Reliable, Scalable and Secure Communication S...
 
SIPREC RTPEngine Media Forking
SIPREC RTPEngine Media ForkingSIPREC RTPEngine Media Forking
SIPREC RTPEngine Media Forking
 
FreeSWITCH on Docker
FreeSWITCH on DockerFreeSWITCH on Docker
FreeSWITCH on Docker
 
FreeSWITCH as a Kickass SBC
FreeSWITCH as a Kickass SBCFreeSWITCH as a Kickass SBC
FreeSWITCH as a Kickass SBC
 
Three Ways Kamailio Can Help Your FreeSWITCH Deployment
Three Ways Kamailio Can Help Your FreeSWITCH DeploymentThree Ways Kamailio Can Help Your FreeSWITCH Deployment
Three Ways Kamailio Can Help Your FreeSWITCH Deployment
 
Kamailio - SIP Routing in Lua
Kamailio - SIP Routing in LuaKamailio - SIP Routing in Lua
Kamailio - SIP Routing in Lua
 
Kamailio, FreeSWITCH, and You
Kamailio, FreeSWITCH, and YouKamailio, FreeSWITCH, and You
Kamailio, FreeSWITCH, and You
 
FreeSWITCH as a Microservice
FreeSWITCH as a MicroserviceFreeSWITCH as a Microservice
FreeSWITCH as a Microservice
 
Kamailio - Secure Communication
Kamailio - Secure CommunicationKamailio - Secure Communication
Kamailio - Secure Communication
 
Media Handling in FreeSWITCH
Media Handling in FreeSWITCHMedia Handling in FreeSWITCH
Media Handling in FreeSWITCH
 
Kamailio - SIP Firewall for Carrier Grade Traffic
Kamailio - SIP Firewall for Carrier Grade TrafficKamailio - SIP Firewall for Carrier Grade Traffic
Kamailio - SIP Firewall for Carrier Grade Traffic
 
Scaling FreeSWITCH Performance
Scaling FreeSWITCH PerformanceScaling FreeSWITCH Performance
Scaling FreeSWITCH Performance
 
Asterisk High Availability Design Guide
Asterisk High Availability Design GuideAsterisk High Availability Design Guide
Asterisk High Availability Design Guide
 
Getting started with SIP Express Media Server SIP app server and SBC - workshop
Getting started with SIP Express Media Server SIP app server and SBC - workshopGetting started with SIP Express Media Server SIP app server and SBC - workshop
Getting started with SIP Express Media Server SIP app server and SBC - workshop
 
Astricon 10 (October 2013) - SIP over WebSocket on Kamailio
Astricon 10 (October 2013) - SIP over WebSocket on KamailioAstricon 10 (October 2013) - SIP over WebSocket on Kamailio
Astricon 10 (October 2013) - SIP over WebSocket on Kamailio
 
Homer - Workshop at Kamailio World 2017
Homer - Workshop at Kamailio World 2017Homer - Workshop at Kamailio World 2017
Homer - Workshop at Kamailio World 2017
 
Kamailio - Load Balancing Load Balancers
Kamailio - Load Balancing Load BalancersKamailio - Load Balancing Load Balancers
Kamailio - Load Balancing Load Balancers
 
SIP Attack Handling (Kamailio World 2021)
SIP Attack Handling (Kamailio World 2021)SIP Attack Handling (Kamailio World 2021)
SIP Attack Handling (Kamailio World 2021)
 

Similaire à Kamailio on Docker

Docking your services_with_docker
Docking your services_with_dockerDocking your services_with_docker
Docking your services_with_docker
Tikal Knowledge
 

Similaire à Kamailio on Docker (20)

FreeSWITCH on Docker
FreeSWITCH on DockerFreeSWITCH on Docker
FreeSWITCH on Docker
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 
Docker and IBM Integration Bus
Docker and IBM Integration BusDocker and IBM Integration Bus
Docker and IBM Integration Bus
 
Installing Component Pack 6.0.0.6
Installing Component Pack 6.0.0.6Installing Component Pack 6.0.0.6
Installing Component Pack 6.0.0.6
 
Kamailio World 2018 - Workshop: kamailio-tests
Kamailio World 2018 - Workshop: kamailio-testsKamailio World 2018 - Workshop: kamailio-tests
Kamailio World 2018 - Workshop: kamailio-tests
 
Running .NET on Docker
Running .NET on DockerRunning .NET on Docker
Running .NET on Docker
 
Kubernetes on Bare Metal at the Kitchener-Waterloo Kubernetes and Cloud Nativ...
Kubernetes on Bare Metal at the Kitchener-Waterloo Kubernetes and Cloud Nativ...Kubernetes on Bare Metal at the Kitchener-Waterloo Kubernetes and Cloud Nativ...
Kubernetes on Bare Metal at the Kitchener-Waterloo Kubernetes and Cloud Nativ...
 
[KubeCon NA 2020] containerd: Rootless Containers 2020
[KubeCon NA 2020] containerd: Rootless Containers 2020[KubeCon NA 2020] containerd: Rootless Containers 2020
[KubeCon NA 2020] containerd: Rootless Containers 2020
 
kubernetes for beginners
kubernetes for beginnerskubernetes for beginners
kubernetes for beginners
 
JUDCon 2010 Boston : BoxGrinder
JUDCon 2010 Boston : BoxGrinderJUDCon 2010 Boston : BoxGrinder
JUDCon 2010 Boston : BoxGrinder
 
CCCEU15 run cloudstack in docker
CCCEU15 run cloudstack in dockerCCCEU15 run cloudstack in docker
CCCEU15 run cloudstack in docker
 
CloudStack Collab Conference 2015 Run CloudStack in Docker
CloudStack Collab Conference 2015 Run CloudStack in DockerCloudStack Collab Conference 2015 Run CloudStack in Docker
CloudStack Collab Conference 2015 Run CloudStack in Docker
 
Docker Clustering - Batteries Included
Docker Clustering - Batteries IncludedDocker Clustering - Batteries Included
Docker Clustering - Batteries Included
 
DCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker CaptainsDCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker Captains
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container Service
 
Docking your services_with_docker
Docking your services_with_dockerDocking your services_with_docker
Docking your services_with_docker
 
AtlasCamp 2015: The age of orchestration: From Docker basics to cluster manag...
AtlasCamp 2015: The age of orchestration: From Docker basics to cluster manag...AtlasCamp 2015: The age of orchestration: From Docker basics to cluster manag...
AtlasCamp 2015: The age of orchestration: From Docker basics to cluster manag...
 
Docker - From Walking To Running
Docker - From Walking To RunningDocker - From Walking To Running
Docker - From Walking To Running
 
Cloud RPI4 tomcat ARM64
Cloud RPI4 tomcat ARM64Cloud RPI4 tomcat ARM64
Cloud RPI4 tomcat ARM64
 

Dernier

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Dernier (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Kamailio on Docker

  • 1. Kamailio on Docker Stanley Wu (吳建澄) skyeyester@gmail.com 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 1006@10.10.10.135 1234 – Registering a SIP Softphone 15 User ID: 1006 Domain: <Public_IP address of your Kamailio Server> Password: 1234