34
kamailio sip servers everywhere Daniel-Constantin Mierla @miconda www.asipto.com www.kamailio.org AstriCon 2014 - Las Vegas, USA

Kamailio - SIP Servers Everywhere

Embed Size (px)

DESCRIPTION

Presentation done at AstriCon 2014, Las Vegas, USA - how relevant can be SIP signaling traffic in a Real Time Communications platform and where pure SIP signaling servers such as Kamailio can be used.

Citation preview

Page 1: Kamailio - SIP Servers Everywhere

kamailiosip servers everywhere

Daniel-Constantin Mierla@miconda

www.asipto.com www.kamailio.org

AstriCon 2014 - Las Vegas, USA

Page 2: Kamailio - SIP Servers Everywhere

WHOIS KAMAILIO

2

2002 Jun 2005 Jul 2008 Aug 2008 Nov 2008

SIP Express Router (SER)

OpenSER Kamailio

Other Forks...

Same application: Kamailio - SER

Oct 2009 Jan 2010

v3.0.0

Integration Completed

v1.5.0

Sep 2011Sep 2001

First Line Of

Code

Open Source !

GPL

FhG Fokus

Institute

rename

Awarded Best Open

Source Networking

Software 2009

By InfoWorld

10 Years

Jun 2012

v3.3.0

ITSPA UK

Award

Mar 2013

v4.0.0

Kamailio

v4.1.0

Dec 2013

………. v4.2.0

Oct 2014

Let's Speak SIP = E Kama'ilio SIP

Page 3: Kamailio - SIP Servers Everywhere

3

credits to @voicegal - theivrvoice.com

Page 4: Kamailio - SIP Servers Everywhere

!

SIP signalling routing

• fast

• reliable

• flexible

4

GROUND ZERO

In other words

• not initiating calls

• not answering calls

• no audio-video processing

Page 5: Kamailio - SIP Servers Everywhere

!

DON’T PANIC

5

Real Time Communications

multimedia notificationstelephony

video conferences

file transfer

desktop sharing

gaming

instant messaging

presence

alerts

monitoring

mobility

Page 6: Kamailio - SIP Servers Everywhere

!

INTER-NET-WORKING

6

Real Time Communications

multimedia notificationstelephony

video conferences

file transfer

desktop sharing

gaming

instant messaging

presence

alerts

monitoring

mobility

Internet of Humans Internet of (Every)Things

Page 7: Kamailio - SIP Servers Everywhere

!

THE INVISIBLE SIGNALLING

7

Real Time Communications

you get on the nettelephony

video conferences

file transfer

desktop sharing

gaming

• Registrations

• Authentication challenges

• NAT keepalives

• Servers monitoring

• Gateway hunting

• Re-routing

• Session updates

Page 8: Kamailio - SIP Servers Everywhere

!

8

THE IMPACT OF SIGNALLING

typical day for a person

morning at

home

work not at home

evening at

home

going out with friends is work duty

Page 9: Kamailio - SIP Servers Everywhere

!

9

THE IMPACT OF SIGNALLING

typical home phone activity

morning 3-5 calls

work 0-2 calls

evening 3-5 calls

no football game last evening

Page 10: Kamailio - SIP Servers Everywhere

10

SIP CALL SIGNALLING

INVITE

INVITE

INVITE

ACK

BYE

200 OK

200 OK

200 OK

200 OK

100

180

183

INVITE

407

Page 11: Kamailio - SIP Servers Everywhere

11

SIP REGISTRATION SIGNALLINGREGISTER

REGISTER

OPTIONS

200 OK

200 OK

401

OPTIONS

200 OK

REGISTER

NAT keepalive

!every 20 sec

ever

y 36

00 s

ec

Page 12: Kamailio - SIP Servers Everywhere

!

12

a day on the wire

user actions device actions

THE IMPACT OF SIGNALLING

12 msg x 10 (calls) 4 msg x 24 (regs) 6 msg x 60 x 24 (ka)

120 8736

8856

Page 13: Kamailio - SIP Servers Everywhere

13

SIP SIGNALLINGtaking over facebook subscriber base

msgs/day 1 000 x 9 000 = 9 000 000

… 1 000 000 x 9 000 = 9 000 000 000

Page 14: Kamailio - SIP Servers Everywhere

14

SIP SIGNALLINGtaking over facebook subscriber base

estimated bandwidth / day 1000 phones: 9 000 000 x 1kB = ~ 9GB

… 1000000 phones: 9 000 000 000 x 1kB = ~9TB

Page 15: Kamailio - SIP Servers Everywhere

FORGETTING ANYONE?

15

Page 16: Kamailio - SIP Servers Everywhere

16

SIP SIGNALLINGyour friendly scanners

extra traffic 100 requests/seconds => 200 messages/second

200 x 60 x 60 x 24 = 17 280 000 msgs/day 17GB/day

Page 17: Kamailio - SIP Servers Everywhere

17

SIGNALLING REMARKS

can be a significant source of processing (both network and application layer)

!

can be a lot even with small subscriber base (your online friends don’t let you rest)

!

numbers estimated for very basic usage model (imagine instant messaging, presence, mwi, blf, …)

Page 18: Kamailio - SIP Servers Everywhere

SIP SERVERS EVERYWHERE

18

Page 19: Kamailio - SIP Servers Everywhere

!

TWO BASIC ARCHITECTURES

19

main signalling server edge signalling server

Page 20: Kamailio - SIP Servers Everywhere

!

dispatcher module • list of balancing nodes from file or database • monitoring of nodes (activate/inactivate

automatically) • re-route in case of failure • various algorithms: hashing, weight distribution, round

robin, call load distribution, priority routing • reload list of nodes without restart

20

LOAD BALANCER

# Dispatch requests route[DISPATCH] { # round robin dispatching on gateways group '1' if(!ds_select_dst("1", “4")) { send_reply("404", "No destination"); exit; } xdbg("--- SCRIPT: going to <$ru> via <$du>\n"); t_on_failure("RTF_DISPATCH"); route(RELAY); exit; } # Re-route in case of failure failure_route[RTF_DISPATCH] { if (t_is_canceled()) { exit; } # next node - only for 500 or local timeout if (t_check_status(“500") || (t_branch_timeout() && !t_branch_replied())) { if(ds_next_dst()) { t_on_failure("RTF_DISPATCH"); route(RELAY); exit; } } }

Page 21: Kamailio - SIP Servers Everywhere

!

plenty of options • lcr module • carrierroute module • prefix_route module • drouting module • combinations: mtree + dispatcher

LEAST COST OR DID ROUTING

21

route[LCR] { if (!load_gws("1")) { send_reply("503", "Error loading gateways"); exit; } if (!next_gw()) { send_reply("503", "No available gateways"); exit; } t_on_failure(“RTF_LCR"); route(RELAY); exit; } # Re-route in case of failure failure_route[RTF_LCR] { if (t_is_canceled()) { exit; } # next node - only for 500 or local timeout if (t_check_status(“500") || (t_branch_timeout() && !t_branch_replied())) { if(next_gw()) { t_on_failure("RTF_LCR"); route(RELAY); exit; } } }

pstn provider

pstn provider

pstn provider

lcr DID routing

Page 22: Kamailio - SIP Servers Everywhere

!

block DOS or dictionary attacks part of default kamailio.cfg • htable module • pike module • detect high volume of traffic from same source and

block it for a specific interval of itme

22

SIP FIREWALL

# ip ban htable with autoexpire after 5 minutes modparam("htable", "htable", “ipban=>size=8;autoexpire=300;") … route[SAFEGUARD] { # flood detection from same IP and traffic ban for a specific interval # be sure you exclude checking trusted peers, such as pstn gateways # - local host excluded (e.g., loop to self) if(src_ip!=myself) { if($sht(ipban=>$si)!=$null) { # ip is already blocked xdbg("request from blocked IP - $rm from $fu (IP:$si:$sp)\n"); exit; } if (!pike_check_req()) { xlog("ALERT: pike blocking $rm from $fu (IP:$si:$sp)\n"); $sht(ipban=>$si) = 1; exit; } } if($ua =~ "friendly-scanner") { sl_send_reply("200", "OK"); exit; } }

Page 23: Kamailio - SIP Servers Everywhere

!

core and tm module • set transport in R-URI or outbound proxy address • force transport via dedicated function

23

TRANSPORT LAYER GATEWAY

# Force UDP route[TOUDP] { # round robin dispatching on gateways group '1' record_route(); $du = “sip:nexthop.com:5060;transport=udp”; force_send_socket(“udp:10.1.1.10:5080”); route(RELAY); exit; }

tls

web socket

udp

udp udp

IPv6

bridging networks • public to private networks and back • IPv4 to IPv6 and back • any transport layer to another one and back

Page 24: Kamailio - SIP Servers Everywhere

!

edge proxy • authentication • nat traversal • parallel forking • serial forking • call forwarding • call blocking • white/black listing • DNS handling

24

OFFLOAD SIGNALLING PROCESSING

Page 25: Kamailio - SIP Servers Everywhere

25

DESIGNED FOR SCALABILITY

forking

replication

Page 26: Kamailio - SIP Servers Everywhere

!

plenty at signalling layer • instant messaging • presence • gaming • notifications

26

EXTRA FEATURES

extensibility • define your new request types • flexibility in handling unknown requests, headers, etc.

additional functions • embedded XCAP server • embedded MSRP relay • IMS

INVITE

NOTIFY

MESSAGE

TICTACTOE

PUBLISHTURNRIGHT

Page 27: Kamailio - SIP Servers Everywhere

TO CONCLUDE

27

Page 28: Kamailio - SIP Servers Everywhere

SUITABLE FOR

28

lot of subscribers !

lot of traffic (good or bad) !

innovation !

personal usage

Page 29: Kamailio - SIP Servers Everywhere

29

FEATURESIPv4

IPv6 (since 2002!) UDP/TCP/TLS/SCTP

SCTP multi-homing

multi-streaming, statistics UDP Raw Sockets

DNS NAPTR & SRV

Plug-in Module Interface (about 200) !

Scripting Config Language !Embedded Interpreters

Lua, Perl Mono (C# and the rest)

Python, Java

Load Balancing Least Cost Routing

DID - Prefix Routing Aliases

Ring Groups Speed Dial

ENUM Routing

Presence Services Instant Messaging

Embedded XCAP Sever Embedded HTTP Client & Server

Embedded MSRP Relay

Asynchronous Processing TCP - TLS

SIP Request Processing Config Route Block Execution

Suspend-Resume Transactions

NoSQL Backends Memcached

Redis Cassandra MongoDB

SQL Backends MySQL

PostgreSQL SQLite

UNIXODBC ORACLE Text Files

WebSocket (WebRTC)

!IMS

OMA

Control API !

XMLRPC JSONRPC Event API

Focus !Stability

High Performances Strong Security

Innovation

Page 30: Kamailio - SIP Servers Everywhere

30

2014 HIGHLIGHTSevapidb_mongodb

core tm

dispatcher uac

rtpengine

dialog enhancements

tsilo

kazoo

jsonrpc-s

debugger (per module debug) (log pv assignment)

usrloc - dmq - imsuuid

nosipndb_mongodb

http://www.kamailio.org/wiki/features/new-in-4.2.xV4.2.0 released on Oct 16, 2014

Page 31: Kamailio - SIP Servers Everywhere

SIREMIS WEB INTERFACE

31

Page 32: Kamailio - SIP Servers Everywhere

OUT OF THE BOX

• sip:provider CE

• Elastix 3.0

• Kazoo

• Plivo

32

open source options

Page 33: Kamailio - SIP Servers Everywhere

33

www.kamailioworld.com

Page 34: Kamailio - SIP Servers Everywhere

34

Thank You! !

Questions?

Daniel-Constantin Mierla@miconda

www.asipto.com www.kamailio.org