Kamailio is the leading Open Source SIP Server - a SIP proxy, registrar, location server, presence server, IMS server and much more. Find out more by viewing this quick presentation! (Updated June 2014)
Scanning the Internet for External Cloud Exposures via SSL Certs
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
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
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 configuration 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 fine 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 configured 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
Configuration
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/Config 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
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
configuration language where you
configure 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.
??
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