SlideShare a Scribd company logo
1 of 42
A QUICK INTRODUCTION
TO KAMAILIO
Olle E. Johansson * oej@edvina.net * Twitter oej
Copyright Edvina AB, Sollentuna, Sweden 2013-205 .All rights reserved.V4.2
FIRST:
What is a proxy compared with a PBX?
A SIP PBX
You Me
PBX
Everyone talks with the PBX!
This is called a SIP b2bua
A SIP PROXY
You Me
SIP
We ļ¬nd each other usingā€Ø
the proxy.
Multimedia Communication is
peer2peer
Media
FINDINGYOU
You Me
SIP
DNS is used, like e-mail.
DNS
sip:alice@example.com
THE PROXY ANDTHE PBX
WORKS WELLTOGETHER.
You
Me
PBX
SIP
Services like	

IVR	

Conference
THE PROXY HAS MANY ROLES
SIP SIP SIP SIP
Proxy
Outbound proxy
Location server/registrar
Presence server
Call routing (LCR)
SIP
Application server
SIP
WHAT DOESNā€™T IT DO?
GW HOLD CONF REC
Gatewayā€Ø
to other protocols
Mix calls in a conference
Put calls on hold
Recordā€Ø
calls
Listen to DTMF
IVR
Handle media
RTP
INTRODUCING KAMAILIO
KAMAILIO
Open Source
SIP Server
Presence server
SIP Proxy
Application server
A lot of activity!
WebSocket SIP
server
THE KAMAILIO PROJECT
ā€¢ Project leader:ā€Ø
Daniel Constatin Mierla (Asipto)	

ā€¢ Management board with community members	

ā€¢ Many developers, active community	

ā€¢ Renamed to Kamailio in 2008	

ā€¢ Merged with the original ā€Ø
Sip Express Router for version 3 in 2008
kamailio.org
KAMAILIOTECHNOLOGY
ā€¢ Written in ANSI C and optimized for speed !
!
ā€¢ Modular design !
!
ā€¢ Flexible conļ¬guration and routing language !
!
ā€¢ Supports MySQL, PostgreSQL, LDAP, RADIUS, Sqlite , radius, UnixODBC!
!
ā€¢ Standard (RFC3261) compliant !
ā€¢ Web based administration interface: SIREMIS!
!
ā€¢ Management port (TCP, UDP, XML)!
!
ā€¢ Embedded HTTP server for Xcap (Presence)!
!
ā€¢ Python, Perl, LUA development interfaces!
!
ā€¢ NAT traversal capable !
!
ā€¢ Portable, runs on POSIX compliant systems
KAMAILIO PHILOSOPHY
ā€¢ Over 100 modules - build anything!	

ā€¢ Many modules overlap	

ā€¢ Especially in carrier-business-related stuff, like least cost routing	

ā€¢ As long as we have maintainers, weā€™re ļ¬ne with that.
KAMAILIO EVOLUTION
From http://sip-router.org/wiki/history/ser-9-years
Notice ā€Ø
That we merged!
KAMAILIO DEVELOPMENT
MODEL
ā€¢ Development base code is named ā€SIP-routerā€!
!
ā€¢ Licensed under GPL. Contributions may be under BSD.!
!
ā€¢ Currently about 20 developers !
!
ā€¢ Anyone can freely contribute extensions and modules !
!
ā€¢ Changes to existing modules are subject to approval
SIP-router.org
Kamailo releases SER releases Tekelec products
WHERETO GET IT?
Linux packagesā€Ø
http://www.kamailio.org/wiki/
packages/rpms
FreeBSD/OpenBSDā€Ø
Ports
Source codeā€Ø
www.kamailio.org Just download and run!
KAMAILIO FUNCTIONALITY
ā€¢ It is a SIP server originally designed as a SIP proxy
ā€¢ Can be conļ¬gured as an
ā€¢ SIP Outbound Proxy
ā€¢ Location server/registrar
ā€¢ Presence server
ā€¢ Application server
ā€¢ ā€¦and much more
ā€¢ Development API for SIP servlets and UserAgent
functionality
ā€¢ LUA, Java, Python module integration for
advanced functionality
ā€¢ Runs on many operating systems
SIP proxy
Presenceā€Ø
server
SIP applicationā€Ø
server
SIP loadā€Ø
balancer
SIP Session Border
Controller
ADDITIONAL FEATURES
ā€¢ IPv4-IPv6 gateway
ā€¢ UDP/TCP/SCTP/WS translator
ā€¢ NAT traversal support
ā€¢ anti-DOS functions (pike, blacklists)
ā€¢ Gateway to SMS, XMPP (Jabber)
ā€¢ Accounting
ā€¢ Interface to LUA, Python, Mono/C# and Perl
ā€¢ Database support MongoDB, Redis, Radius,
MySQL, PostgreSQL, UnixODBC, Berkeley DB
and Oracle
ā€¢ ...much more
IPv4/IPv6ā€Ø
UDP/TCP/SCTP/WSā€Ø
TLS	

NAT	

!
Languages:
Java, Python, Lua, Perl,
Mono, C#	

!
Databases:
Mysql	

PostgreSQL	

UnixODBC	

Berkeley DB	

Oracleā€Ø
Redis, MongoDBā€Ø
Cassandra
A MODULAR ARCHITECTURE
SIP Server core
Modules Modules Modules Modules
MySQL Radius TM
NATā€Ø
Support
Core provides	

Transport managements	

Memory management	

Module interface	

Shared memory	

Locking	

Conļ¬guration
Modules provide	

Script functions	

Module parameters	

Special variables	

Management functions
ADDITIONAL HELPERS
KAMCTL
KAMDBCTL
KAMCMD
SIREMIS
Management interface (MI) functions	

Start/stop	

Shared variables	

Statistics	

Database installation helper	

!
RPC Interface and MI functions	

Statistics	

Select/Conļ¬g variables	

(Arrived from SER)	

!
Web application	

Statistics	

Database management	

Separate project	

!
KAMAILIO ISTHE HEART OFYOUR SIP NETWORK
Kamailio
RTP
relay
PSTNā€Ø
gw
DB
Adminā€Ø
(WEB)
Feature
server
3rd ā€Ø
party
IM/SMSā€Ø
gw
Internal network
Public network
Users
MULTIPROCESS, NOTTHREADS
UDP listen
TCP listen
TCP/TLS listen
STCP listen
Other worker processes
MANAGEMENT
RPC interface
XMLrpc Json Pipe
MIā€Ø
(deprecated)
KAMCMD KAMCTL
Unix command line
applications
MEMORY HANDLING
PKG - Kamailio memory manager
Unix memory
manager
Shared memoryā€Ø
(core)
Per process memory
4 MB per process64 MB per Kamailio
Allocated at start.
Transactions SIP message
Shared variables Script variables
ABOUT KEEPING STATE:
ā€¢ Kamailio keeps transaction, user
and location data in shared
memory (RAM) at runtime	

ā€¢ Some of this can be cached to
database, but in-memory is the
default	

ā€¢ This statelessness delivers
scalability and resilience in the
network
Stateless forwardingā€Ø
and responses
Transaction states
Dialog - ā€callā€ - states
GENERAL ADVICE:
ā€¢ Try to keep proxy processing as simple as possible
ā€¢ Be very careful on where you add states	

ā€¢ In larger networks, separate 	

ā€¢ Ingress/Egress proxys (Session Border Controllers)	

ā€¢ Registrar/location server	

ā€¢ Core proxy	

ā€¢ Feature proxy
Compare withā€Ø
IP routers!
CONFIGURATION
KAMAILIO IS ATOOLBOX
ā€¢ Kamailio is not a ready-made
application like Asterisk or
FreeSwitch	

ā€¢ There is a very powerful
conļ¬guration language where you
conļ¬gure handling of individual SIP
Messages	

ā€¢ You need understanding of the SIP
protocol to build your application
Load balancer
SBC
Trunk server
PBX
$avp(rtype)
if($rm ==
ā€INVITEā€) {}
route(ā€NATā€);
t_relay();
THE KAMAILIO SCRIPTS
ā€¢ C-like language	

ā€¢ IF/THEN,WHILE constructs	

ā€¢ Variables with different scopes (global, local,
transactions)	

ā€¢ Hash tables, database integration, memcached
and much more	

ā€¢ Loading a new module extends functionality,
like in Asterisk or Apache
?
WHEREā€™STHE DIAL PLAN?
ā€¢ Kamailio routes SIP messages, not calls	

ā€¢ There are many ways to route calls (consisting of at least an
INVITE and a BYE message)	

ā€¢ There is a module called ā€œDIALPLANā€ that can simplify building a
pbx-like call routing engine	

ā€¢ Remember, Kamailio does not handle media. Companion products
like RTPengine, RTPproxy, Asterisk and FreeSwitch handles media.
??
SOLUTIONS WITH KAMAILIO
SMALL CARRIER
SIP
Kamailioā€Ø
Session Borderā€Ø
controller
SIP
Kamailioā€Ø
Core proxy
SIP
Kamailio Registrar/Location server
Asterisk
PSTN Gateway
Asterisk
Voicemail Server
Asterisk
Feature/IVR Server
UNIVERSITY IPTRANSITION
.com
Session Borderā€Ø
controllerā€Ø
(commercial product)
SIP
Kamailioā€Ø
Core proxy
Asterisk
PBX
Asterisk
Old PBX
Media gateway ISDN
FAILOVER
SIP
Core Kamailioā€Ø
proxys
FreeSwitch
PBX
FreeSwitch
PBX backup
SIP
MULTI-FEATURE SERVICE
SIP
Asterisk
IVR, Queues, prompts
SIP
Audio
Video
Chat
Presence
Telephony
Core Kamailioā€Ø
proxys
WHAT ABOUT WEBRTC?
KAMAILIO 4 COMES WITH
SIP OVER WEBSOCKETS
WWWyou
Me
SIP
WS
sip/websockets
sip/tcp
Javascriptā€Ø
app
Media over SRTP
KAMAILIO AND ASTERISK WITH
SIP OVER WEBSOCKETS
WWWyou
Me
SIP
WS
sip/websockets
Javascriptā€Ø
SIP app
Media over SRTP
AST
RTP
JSSIP: OPEN SOURCE SIPSTACK
IN JAVASCRIPT
ā€¢ Available for download at jssip.net	

ā€¢ Written by the authors of IETF RFC 7118 on SIP over
websockets	

ā€¢ Reference implementation	

ā€¢ MIT license
COMPONENTS NEEDED
ā€¢ SIP over WS servers: Kamailio, OverSIP, Asterisk, FreeSwitch	

ā€¢ Audio media server RTP gateway: Asterisk, FreeSwitch,
RTPengine	

ā€¢ SIP/Javascript: SIPml5, JSSIP
EDVINATRAINING CLASSES
ā€¢ Kamailio from start	

ā€¢ The SIP Protocol	

ā€¢ RTP, RTCP and QoS	

ā€¢ SIP Security	

ā€¢ Scalability	

ā€¢ Many Kamailio labs
CUSTOMā€Ø
INHOUSEā€Ø
TRAININGS
ā€¢ SIP,Asterisk, Kamailio
and much more	

ā€¢ Done at your site,
customized for your
project	

ā€¢ Cost effective when
more than four
students	

Find more details at http://edvina.net
ā€¢ Advanced Kamailio	

ā€¢ SIP trunking	

ā€¢ NAT handling	

ā€¢ WebRTC/SIP	

ā€¢ Testing, debugging	

ā€¢ Scalability	

ā€¢ Many Kamailio labs
THATā€™S ALL FOLKS.
Twitter @kamailioproject	

!
Like us on Facebook too!
Download on www.kamailio.org

More Related Content

What's hot

The linux networking architecture
The linux networking architectureThe linux networking architecture
The linux networking architecture
hugo lu
Ā 

What's hot (20)

SIP Attack Handling (Kamailio World 2021)
SIP Attack Handling (Kamailio World 2021)SIP Attack Handling (Kamailio World 2021)
SIP Attack Handling (Kamailio World 2021)
Ā 
Kamailio - SIP Routing in Lua
Kamailio - SIP Routing in LuaKamailio - SIP Routing in Lua
Kamailio - SIP Routing in Lua
Ā 
Kamailio with Docker and Kubernetes
Kamailio with Docker and KubernetesKamailio with Docker and Kubernetes
Kamailio with Docker and Kubernetes
Ā 
Scaling Asterisk with Kamailio
Scaling Asterisk with KamailioScaling Asterisk with Kamailio
Scaling Asterisk with Kamailio
Ā 
SIP & TLS - Security in a peer to peer world
SIP & TLS - Security in a peer to peer worldSIP & TLS - Security in a peer to peer world
SIP & TLS - Security in a peer to peer world
Ā 
Continuous Integration and Kamailio
Continuous Integration and KamailioContinuous Integration and Kamailio
Continuous Integration and Kamailio
Ā 
Sipwise rtpengine
Sipwise rtpengineSipwise rtpengine
Sipwise rtpengine
Ā 
Kamailio on Docker
Kamailio on DockerKamailio on Docker
Kamailio on Docker
Ā 
Why is Kamailio so different? An introduction.
Why is Kamailio so different? An introduction.Why is Kamailio so different? An introduction.
Why is Kamailio so different? An introduction.
Ā 
Kamailio - Large Unified Communication Platforms
Kamailio - Large Unified Communication PlatformsKamailio - Large Unified Communication Platforms
Kamailio - Large Unified Communication Platforms
Ā 
rtpengine and kamailio - or how to simulate calls at scale
rtpengine and kamailio - or how to simulate calls at scalertpengine and kamailio - or how to simulate calls at scale
rtpengine and kamailio - or how to simulate calls at scale
Ā 
Kamailio World 2014 - Kamailio - The Platform for Interoperable WebRTC
Kamailio World 2014 - Kamailio - The Platform for Interoperable WebRTCKamailio World 2014 - Kamailio - The Platform for Interoperable WebRTC
Kamailio World 2014 - Kamailio - The Platform for Interoperable WebRTC
Ā 
Introduction to FreeSWITCH
Introduction to FreeSWITCHIntroduction to FreeSWITCH
Introduction to FreeSWITCH
Ā 
FreeSWITCH as a Kickass SBC
FreeSWITCH as a Kickass SBCFreeSWITCH as a Kickass SBC
FreeSWITCH as a Kickass SBC
Ā 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux Kernel
Ā 
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
Ā 
SIP and DNS - federation, failover, load balancing and more
SIP and DNS - federation, failover, load balancing and moreSIP and DNS - federation, failover, load balancing and more
SIP and DNS - federation, failover, load balancing and more
Ā 
The linux networking architecture
The linux networking architectureThe linux networking architecture
The linux networking architecture
Ā 
Kamailio - Load Balancing Load Balancers
Kamailio - Load Balancing Load BalancersKamailio - Load Balancing Load Balancers
Kamailio - Load Balancing Load Balancers
Ā 
Media Handling in FreeSWITCH
Media Handling in FreeSWITCHMedia Handling in FreeSWITCH
Media Handling in FreeSWITCH
Ā 

Similar to Kamailio :: A Quick Introduction

FutureComm 2010: SIP Server Applications on Embedded Platforms
FutureComm 2010: SIP Server Applications on Embedded PlatformsFutureComm 2010: SIP Server Applications on Embedded Platforms
FutureComm 2010: SIP Server Applications on Embedded Platforms
RADVISION Ltd.
Ā 
The sscaĀ® sip training program course outline
The sscaĀ® sip training program   course outlineThe sscaĀ® sip training program   course outline
The sscaĀ® sip training program course outline
swap3731
Ā 
Introduction to IP Telephony
Introduction to IP TelephonyIntroduction to IP Telephony
Introduction to IP Telephony
Videoguy
Ā 
SIP info
SIP infoSIP info
SIP info
Wino Line
Ā 
Solo Telco Gateway
Solo Telco GatewaySolo Telco Gateway
Solo Telco Gateway
SOLO Gateway
Ā 

Similar to Kamailio :: A Quick Introduction (20)

FOSS Sthlm: Realtime Communication Update
FOSS Sthlm: Realtime Communication UpdateFOSS Sthlm: Realtime Communication Update
FOSS Sthlm: Realtime Communication Update
Ā 
Introduction to Kamailio (TADSummit 2020 Asia)
Introduction to Kamailio (TADSummit 2020 Asia)Introduction to Kamailio (TADSummit 2020 Asia)
Introduction to Kamailio (TADSummit 2020 Asia)
Ā 
SIP servers on embedded systems: Powering SoHo communications
SIP servers on embedded systems: Powering SoHo communicationsSIP servers on embedded systems: Powering SoHo communications
SIP servers on embedded systems: Powering SoHo communications
Ā 
Astricon 2010: Scaling Asterisk installations
Astricon 2010: Scaling Asterisk installationsAstricon 2010: Scaling Asterisk installations
Astricon 2010: Scaling Asterisk installations
Ā 
Uip Sip Implementation Best Practices060409
Uip Sip Implementation Best Practices060409Uip Sip Implementation Best Practices060409
Uip Sip Implementation Best Practices060409
Ā 
SIP Router Project
SIP Router ProjectSIP Router Project
SIP Router Project
Ā 
Vo ip sip
Vo ip sipVo ip sip
Vo ip sip
Ā 
FutureComm 2010: SIP Server Applications on Embedded Platforms
FutureComm 2010: SIP Server Applications on Embedded PlatformsFutureComm 2010: SIP Server Applications on Embedded Platforms
FutureComm 2010: SIP Server Applications on Embedded Platforms
Ā 
Kamailio - Unifying SIP and Web Worlds with Lua
Kamailio - Unifying SIP and Web Worlds with LuaKamailio - Unifying SIP and Web Worlds with Lua
Kamailio - Unifying SIP and Web Worlds with Lua
Ā 
Sangoma SBC Training Presentation
Sangoma SBC Training PresentationSangoma SBC Training Presentation
Sangoma SBC Training Presentation
Ā 
The sscaĀ® sip training program course outline
The sscaĀ® sip training program   course outlineThe sscaĀ® sip training program   course outline
The sscaĀ® sip training program course outline
Ā 
Introduction to IP Telephony
Introduction to IP TelephonyIntroduction to IP Telephony
Introduction to IP Telephony
Ā 
Introduction into SIP protocol
Introduction into SIP protocolIntroduction into SIP protocol
Introduction into SIP protocol
Ā 
SIP info
SIP infoSIP info
SIP info
Ā 
Kamailio - The Story for Asterisk
Kamailio - The Story for AsteriskKamailio - The Story for Asterisk
Kamailio - The Story for Asterisk
Ā 
ITSPA May 2013 - WebRTC, TURN, and WebSocket
ITSPA May 2013 - WebRTC, TURN, and WebSocketITSPA May 2013 - WebRTC, TURN, and WebSocket
ITSPA May 2013 - WebRTC, TURN, and WebSocket
Ā 
FOSDEM 2013 - SIP and MSRP over WebSocket in Kamailio
FOSDEM 2013 - SIP and MSRP over WebSocket in KamailioFOSDEM 2013 - SIP and MSRP over WebSocket in Kamailio
FOSDEM 2013 - SIP and MSRP over WebSocket in Kamailio
Ā 
AN OVERVIEW OF VOICE OVER INTERNET PROTOCOL (VOIP
AN OVERVIEW OF VOICE OVER INTERNET PROTOCOL (VOIPAN OVERVIEW OF VOICE OVER INTERNET PROTOCOL (VOIP
AN OVERVIEW OF VOICE OVER INTERNET PROTOCOL (VOIP
Ā 
Modern VoIP in modern infrastructures
Modern VoIP in modern infrastructuresModern VoIP in modern infrastructures
Modern VoIP in modern infrastructures
Ā 
Solo Telco Gateway
Solo Telco GatewaySolo Telco Gateway
Solo Telco Gateway
Ā 

More from Olle E Johansson

More from Olle E Johansson (20)

Cybernode.se: Securing the software supply chain (CRA)
Cybernode.se: Securing the software supply chain (CRA)Cybernode.se: Securing the software supply chain (CRA)
Cybernode.se: Securing the software supply chain (CRA)
Ā 
CRA - overview of vulnerability handling
CRA - overview of vulnerability handlingCRA - overview of vulnerability handling
CRA - overview of vulnerability handling
Ā 
Introduction to the proposed EU cyber resilience act (CRA)
Introduction to the proposed EU cyber resilience act (CRA)Introduction to the proposed EU cyber resilience act (CRA)
Introduction to the proposed EU cyber resilience act (CRA)
Ā 
The birth and death of PSTN
The birth and death of PSTNThe birth and death of PSTN
The birth and death of PSTN
Ā 
WebRTC and Janus intro for FOSS Stockholm January 2019
WebRTC and Janus intro for FOSS Stockholm January 2019WebRTC and Janus intro for FOSS Stockholm January 2019
WebRTC and Janus intro for FOSS Stockholm January 2019
Ā 
Kamailio World 2018: Having fun with new stuff
Kamailio World 2018: Having fun with new stuffKamailio World 2018: Having fun with new stuff
Kamailio World 2018: Having fun with new stuff
Ā 
Kamailio on air
Kamailio on airKamailio on air
Kamailio on air
Ā 
Webrtc overview
Webrtc overviewWebrtc overview
Webrtc overview
Ā 
Realtime communication over a dual stack network
Realtime communication over a dual stack networkRealtime communication over a dual stack network
Realtime communication over a dual stack network
Ā 
The Realtime Story - part 2
The Realtime Story - part 2The Realtime Story - part 2
The Realtime Story - part 2
Ā 
Sip2016 - a talk at VOIP2DAY 2016
Sip2016 - a talk at VOIP2DAY 2016Sip2016 - a talk at VOIP2DAY 2016
Sip2016 - a talk at VOIP2DAY 2016
Ā 
Sips must die, die, die - about TLS usage in the SIP protocol
Sips must die, die, die - about TLS usage in the SIP protocolSips must die, die, die - about TLS usage in the SIP protocol
Sips must die, die, die - about TLS usage in the SIP protocol
Ā 
SIP :: Half outbound (random notes)
SIP :: Half outbound (random notes)SIP :: Half outbound (random notes)
SIP :: Half outbound (random notes)
Ā 
Kamailio World 2016: Update your SIP!
Kamailio World 2016: Update your SIP!Kamailio World 2016: Update your SIP!
Kamailio World 2016: Update your SIP!
Ā 
Tio tester av TLS - Transport Layer Security (TLS-O-MATIC.COM)
Tio tester av TLS - Transport Layer Security (TLS-O-MATIC.COM)Tio tester av TLS - Transport Layer Security (TLS-O-MATIC.COM)
Tio tester av TLS - Transport Layer Security (TLS-O-MATIC.COM)
Ā 
2015 update: SIP and IPv6 issues - staying Happy in SIP
2015 update: SIP and IPv6 issues - staying Happy in SIP2015 update: SIP and IPv6 issues - staying Happy in SIP
2015 update: SIP and IPv6 issues - staying Happy in SIP
Ā 
TCP/IP Geeks Stockholm :: Introduction to IPv6
TCP/IP Geeks Stockholm :: Introduction to IPv6TCP/IP Geeks Stockholm :: Introduction to IPv6
TCP/IP Geeks Stockholm :: Introduction to IPv6
Ā 
RFC 7435 - Opportunistic security - Some protection most of the time
RFC 7435 - Opportunistic security - Some protection most of the timeRFC 7435 - Opportunistic security - Some protection most of the time
RFC 7435 - Opportunistic security - Some protection most of the time
Ā 
TCP/IP geeks Stockholm :: Manifesto
TCP/IP geeks Stockholm :: ManifestoTCP/IP geeks Stockholm :: Manifesto
TCP/IP geeks Stockholm :: Manifesto
Ā 
#Morecrypto (with tis) - version 2.2
#Morecrypto (with tis) - version 2.2#Morecrypto (with tis) - version 2.2
#Morecrypto (with tis) - version 2.2
Ā 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
Ā 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
Christopher Logan Kennedy
Ā 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
Ā 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
Ā 

Recently uploaded (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Ā 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
Ā 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Ā 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
Ā 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
Ā 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Ā 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Ā 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
Ā 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
Ā 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
Ā 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
Ā 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
Ā 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Ā 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
Ā 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
Ā 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
Ā 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Ā 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
Ā 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Ā 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Ā 

Kamailio :: A Quick Introduction

  • 1. A QUICK INTRODUCTION TO KAMAILIO Olle E. Johansson * oej@edvina.net * Twitter oej Copyright Edvina AB, Sollentuna, Sweden 2013-205 .All rights reserved.V4.2
  • 2. FIRST: What is a proxy compared with a PBX?
  • 3. A SIP PBX You Me PBX Everyone talks with the PBX! This is called a SIP b2bua
  • 4. A SIP PROXY You Me SIP We ļ¬nd each other usingā€Ø the proxy. Multimedia Communication is peer2peer Media
  • 5. FINDINGYOU You Me SIP DNS is used, like e-mail. DNS sip:alice@example.com
  • 6. THE PROXY ANDTHE PBX WORKS WELLTOGETHER. You Me PBX SIP Services like IVR Conference
  • 7. THE PROXY HAS MANY ROLES SIP SIP SIP SIP Proxy Outbound proxy Location server/registrar Presence server Call routing (LCR) SIP Application server SIP
  • 8. WHAT DOESNā€™T IT DO? GW HOLD CONF REC Gatewayā€Ø to other protocols Mix calls in a conference Put calls on hold Recordā€Ø calls Listen to DTMF IVR Handle media RTP
  • 10. KAMAILIO Open Source SIP Server Presence server SIP Proxy Application server A lot of activity! WebSocket SIP server
  • 11. THE KAMAILIO PROJECT ā€¢ Project leader:ā€Ø Daniel Constatin Mierla (Asipto) ā€¢ Management board with community members ā€¢ Many developers, active community ā€¢ Renamed to Kamailio in 2008 ā€¢ Merged with the original ā€Ø Sip Express Router for version 3 in 2008 kamailio.org
  • 12. KAMAILIOTECHNOLOGY ā€¢ Written in ANSI C and optimized for speed ! ! ā€¢ Modular design ! ! ā€¢ Flexible conļ¬guration and routing language ! ! ā€¢ Supports MySQL, PostgreSQL, LDAP, RADIUS, Sqlite , radius, UnixODBC! ! ā€¢ Standard (RFC3261) compliant ! ā€¢ Web based administration interface: SIREMIS! ! ā€¢ Management port (TCP, UDP, XML)! ! ā€¢ Embedded HTTP server for Xcap (Presence)! ! ā€¢ Python, Perl, LUA development interfaces! ! ā€¢ NAT traversal capable ! ! ā€¢ Portable, runs on POSIX compliant systems
  • 13. KAMAILIO PHILOSOPHY ā€¢ Over 100 modules - build anything! ā€¢ Many modules overlap ā€¢ Especially in carrier-business-related stuff, like least cost routing ā€¢ As long as we have maintainers, weā€™re ļ¬ne with that.
  • 15. KAMAILIO DEVELOPMENT MODEL ā€¢ Development base code is named ā€SIP-routerā€! ! ā€¢ Licensed under GPL. Contributions may be under BSD.! ! ā€¢ Currently about 20 developers ! ! ā€¢ Anyone can freely contribute extensions and modules ! ! ā€¢ Changes to existing modules are subject to approval SIP-router.org Kamailo releases SER releases Tekelec products
  • 16. WHERETO GET IT? Linux packagesā€Ø http://www.kamailio.org/wiki/ packages/rpms FreeBSD/OpenBSDā€Ø Ports Source codeā€Ø www.kamailio.org Just download and run!
  • 17. KAMAILIO FUNCTIONALITY ā€¢ It is a SIP server originally designed as a SIP proxy ā€¢ Can be conļ¬gured as an ā€¢ SIP Outbound Proxy ā€¢ Location server/registrar ā€¢ Presence server ā€¢ Application server ā€¢ ā€¦and much more ā€¢ Development API for SIP servlets and UserAgent functionality ā€¢ LUA, Java, Python module integration for advanced functionality ā€¢ Runs on many operating systems SIP proxy Presenceā€Ø server SIP applicationā€Ø server SIP loadā€Ø balancer SIP Session Border Controller
  • 18. ADDITIONAL FEATURES ā€¢ IPv4-IPv6 gateway ā€¢ UDP/TCP/SCTP/WS translator ā€¢ NAT traversal support ā€¢ anti-DOS functions (pike, blacklists) ā€¢ Gateway to SMS, XMPP (Jabber) ā€¢ Accounting ā€¢ Interface to LUA, Python, Mono/C# and Perl ā€¢ Database support MongoDB, Redis, Radius, MySQL, PostgreSQL, UnixODBC, Berkeley DB and Oracle ā€¢ ...much more IPv4/IPv6ā€Ø UDP/TCP/SCTP/WSā€Ø TLS NAT ! Languages: Java, Python, Lua, Perl, Mono, C# ! Databases: Mysql PostgreSQL UnixODBC Berkeley DB Oracleā€Ø Redis, MongoDBā€Ø Cassandra
  • 19. A MODULAR ARCHITECTURE SIP Server core Modules Modules Modules Modules MySQL Radius TM NATā€Ø Support Core provides Transport managements Memory management Module interface Shared memory Locking Conļ¬guration Modules provide Script functions Module parameters Special variables Management functions
  • 20. ADDITIONAL HELPERS KAMCTL KAMDBCTL KAMCMD SIREMIS Management interface (MI) functions Start/stop Shared variables Statistics Database installation helper ! RPC Interface and MI functions Statistics Select/Conļ¬g variables (Arrived from SER) ! Web application Statistics Database management Separate project !
  • 21. KAMAILIO ISTHE HEART OFYOUR SIP NETWORK Kamailio RTP relay PSTNā€Ø gw DB Adminā€Ø (WEB) Feature server 3rd ā€Ø party IM/SMSā€Ø gw Internal network Public network Users
  • 22. MULTIPROCESS, NOTTHREADS UDP listen TCP listen TCP/TLS listen STCP listen Other worker processes
  • 23. MANAGEMENT RPC interface XMLrpc Json Pipe MIā€Ø (deprecated) KAMCMD KAMCTL Unix command line applications
  • 24. MEMORY HANDLING PKG - Kamailio memory manager Unix memory manager Shared memoryā€Ø (core) Per process memory 4 MB per process64 MB per Kamailio Allocated at start. Transactions SIP message Shared variables Script variables
  • 25. ABOUT KEEPING STATE: ā€¢ Kamailio keeps transaction, user and location data in shared memory (RAM) at runtime ā€¢ Some of this can be cached to database, but in-memory is the default ā€¢ This statelessness delivers scalability and resilience in the network Stateless forwardingā€Ø and responses Transaction states Dialog - ā€callā€ - states
  • 26. GENERAL ADVICE: ā€¢ Try to keep proxy processing as simple as possible ā€¢ Be very careful on where you add states ā€¢ In larger networks, separate ā€¢ Ingress/Egress proxys (Session Border Controllers) ā€¢ Registrar/location server ā€¢ Core proxy ā€¢ Feature proxy Compare withā€Ø IP routers!
  • 28. KAMAILIO IS ATOOLBOX ā€¢ Kamailio is not a ready-made application like Asterisk or FreeSwitch ā€¢ There is a very powerful conļ¬guration language where you conļ¬gure handling of individual SIP Messages ā€¢ You need understanding of the SIP protocol to build your application Load balancer SBC Trunk server PBX
  • 29. $avp(rtype) if($rm == ā€INVITEā€) {} route(ā€NATā€); t_relay(); THE KAMAILIO SCRIPTS ā€¢ C-like language ā€¢ IF/THEN,WHILE constructs ā€¢ Variables with different scopes (global, local, transactions) ā€¢ Hash tables, database integration, memcached and much more ā€¢ Loading a new module extends functionality, like in Asterisk or Apache
  • 30. ? WHEREā€™STHE DIAL PLAN? ā€¢ Kamailio routes SIP messages, not calls ā€¢ There are many ways to route calls (consisting of at least an INVITE and a BYE message) ā€¢ There is a module called ā€œDIALPLANā€ that can simplify building a pbx-like call routing engine ā€¢ Remember, Kamailio does not handle media. Companion products like RTPengine, RTPproxy, Asterisk and FreeSwitch handles media. ??
  • 32. SMALL CARRIER SIP Kamailioā€Ø Session Borderā€Ø controller SIP Kamailioā€Ø Core proxy SIP Kamailio Registrar/Location server Asterisk PSTN Gateway Asterisk Voicemail Server Asterisk Feature/IVR Server
  • 33. UNIVERSITY IPTRANSITION .com Session Borderā€Ø controllerā€Ø (commercial product) SIP Kamailioā€Ø Core proxy Asterisk PBX Asterisk Old PBX Media gateway ISDN
  • 35. MULTI-FEATURE SERVICE SIP Asterisk IVR, Queues, prompts SIP Audio Video Chat Presence Telephony Core Kamailioā€Ø proxys
  • 37. KAMAILIO 4 COMES WITH SIP OVER WEBSOCKETS WWWyou Me SIP WS sip/websockets sip/tcp Javascriptā€Ø app Media over SRTP
  • 38. KAMAILIO AND ASTERISK WITH SIP OVER WEBSOCKETS WWWyou Me SIP WS sip/websockets Javascriptā€Ø SIP app Media over SRTP AST RTP
  • 39. JSSIP: OPEN SOURCE SIPSTACK IN JAVASCRIPT ā€¢ Available for download at jssip.net ā€¢ Written by the authors of IETF RFC 7118 on SIP over websockets ā€¢ Reference implementation ā€¢ MIT license
  • 40. COMPONENTS NEEDED ā€¢ SIP over WS servers: Kamailio, OverSIP, Asterisk, FreeSwitch ā€¢ Audio media server RTP gateway: Asterisk, FreeSwitch, RTPengine ā€¢ SIP/Javascript: SIPml5, JSSIP
  • 41. EDVINATRAINING CLASSES ā€¢ Kamailio from start ā€¢ The SIP Protocol ā€¢ RTP, RTCP and QoS ā€¢ SIP Security ā€¢ Scalability ā€¢ Many Kamailio labs CUSTOMā€Ø INHOUSEā€Ø TRAININGS ā€¢ SIP,Asterisk, Kamailio and much more ā€¢ Done at your site, customized for your project ā€¢ Cost effective when more than four students Find more details at http://edvina.net ā€¢ Advanced Kamailio ā€¢ SIP trunking ā€¢ NAT handling ā€¢ WebRTC/SIP ā€¢ Testing, debugging ā€¢ Scalability ā€¢ Many Kamailio labs
  • 42. THATā€™S ALL FOLKS. Twitter @kamailioproject ! Like us on Facebook too! Download on www.kamailio.org