presentacion kamailio uvigo_09262011

48
Laboratorio de Conmutación 12/13: Kamailio By Antón Román 09/27/2011

Upload: quobis

Post on 12-Jun-2015

1.167 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Presentacion kamailio uvigo_09262011

Laboratorio de Conmutación 12/13: Kamailio

By Antón Román 09/27/2011

Page 2: Presentacion kamailio uvigo_09262011

Presentation

2

Quobis, who we are: www.quobis.com

● Quobis is a Engineering company focused on VoIP technologies.

● Founded in 2006 by Teleco Uvigo alumnus.

● Premises at O Porriño.

● 90% engineers.

● Main customers: operators, call centers and enterprises

● Partnerships: AcmePacket, Aheeva, SIPWise and Iptego.

● Own products: MTRP, SecVoID, MCU,...

● R&D activities. Currently involved in Avanza and FP7 projects.

Page 3: Presentacion kamailio uvigo_09262011

Motivation

Quobis Networks SLUTodos los derechos reservados 3

Why are we doing this?

● We strongly believe University must be linked to real world.

● Part of our contribution to Kamailio Open Source Project.

● Professionals with qualified VoIP skills are demanded.

● Close cooperation with university in R&D projects.

Page 4: Presentacion kamailio uvigo_09262011

Quobis Networks SLUTodos los derechos reservados 4

1 st Part

Biref introduction to telephony

Basics of IP Telephony (ToIP)

Page 5: Presentacion kamailio uvigo_09262011

Quobis Networks SLUTodos los derechos reservados 5

Introduction to telephony.

Page 6: Presentacion kamailio uvigo_09262011

Quobis Networks SLUTodos los derechos reservados 6

Introduction to telephony.

● 1833 Samuel Morse invents telegraph

● 1871 Antonio Meuci invents telephone

● 1876 Alexander Graham Bell patents telephone

● 1877 First telephone call in Spain

Page 7: Presentacion kamailio uvigo_09262011

Quobis Networks SLUTodos los derechos reservados 7

Introduction to telephony.

● Fix line between two endpoints

● Manual conmutation

● Automatic conmutation (relay-based)

● Computer-controlled automatic conmutation

● Digital conmutation only electronic

● IP Conmutation!!

1870

2010

Page 8: Presentacion kamailio uvigo_09262011

Introduction to telephony.

Circuit conmutation paradigm (ends of 70s)

Page 9: Presentacion kamailio uvigo_09262011

Introduction to telephony.

Digital conmutation (ISDN) (begining of 90s)

Page 10: Presentacion kamailio uvigo_09262011

Introduction to telephony.

Packet conmutation paradigm (IP) (nowadays)

Page 11: Presentacion kamailio uvigo_09262011

Quobis Networks SLUTodos los derechos reservados 11

Introduction to telephony.

What advantages does ToIP offer?:

● TDM and ISDN conmutation technologies were a monopoly of big corporations: operators and makers.

● It allows to re-use knowhow and infrastructure → high speed evolution

● It allows to re-use generic hardware → reduces coste.

● Open Source ToIP projects are born.

Page 12: Presentacion kamailio uvigo_09262011

Quobis Networks SLUTodos los derechos reservados 12

Introduction to telephony.

What about mobile telephony?:

● Maybe the most important milestone in history of telephony.

● It was born as a circuit-oriented technology (GSM)

● It will be an all-IP network (4G→LTE) in a few years.

● ToIP concepts can be applied to Mobile telephony → convergence!

1970

2010

Page 13: Presentacion kamailio uvigo_09262011

Quobis Networks SLUTodos los derechos reservados 13

Basics of IP telephony

Page 14: Presentacion kamailio uvigo_09262011

Quobis Networks SLUTodos los derechos reservados 14

1. Basics of IP telephony

VoIP (Voice over IP) technologies allow multimedia data transmission (voice, video, IM... ) over IP networks.

ToIP (Telephony over IP) means telephony systems implemented with VoIP technology.

Page 15: Presentacion kamailio uvigo_09262011

15

2. Basics of IP telephony

VoIP = Signaling Protocols (SIP) + Voice transport protocols (RTP/RTCP)

There are more signaling protocols besides SIP: H323, Skype(*), MGCP, IAX, Skinny... however SIP is and will be the most used in short and middle term.

(*) closed protocol

Page 16: Presentacion kamailio uvigo_09262011

16

4. Basics of IP telephony

Normally signaling and voice are sent separately (different protocols and ports).

This gives flexibility to protocols and allows them to be adapted to new codecs and future multimedia requirements:

● H323 → TDM signaling over IP

● SIP → native IP protocol → easily readable!

Page 17: Presentacion kamailio uvigo_09262011

17

5. Basics of IP telephony

Multimedia  sessions(1)

Audio and video: RTP/UDP + RTCP (for QoS, optional)

Codecs: G711a (64Kbps), G711u (64Kbps), G729 (8 or 13 Kbps, licensed), GSM (13 Kbps)...

Multimedia session params are agreed during SIP call establishment  through SDP (Session Description Protocol).

SDP message are  attached to SIP messages (2 protocols, 1 text message).

Page 18: Presentacion kamailio uvigo_09262011

18

5. Basics of IP telephony

Multimedia sessions (2)

RTP (Real Time Protocol) designed to transmit real time data→ not only voice or video

It can be used to transmit desktop sessions, medical monitoring data, share prices...

Page 19: Presentacion kamailio uvigo_09262011

19

2nd Part

SIP

Page 20: Presentacion kamailio uvigo_09262011

20

1. SIP

SIP (Session Initiation Protocol)

Protocol defined in RFC3261.

RFC(Request For Comments) are published by IETF (Internet Engineering Task Force) and define Internet standards. Many actors are involved (academia, makers, operators...).

Page 21: Presentacion kamailio uvigo_09262011

21

2. SIP

Since it is based on RFC3261, many others RFCs add new functionality: presence, IM...

SIP uses clear text messages (like HTTP, actually it's based on it).

Designed to establish any type of multimedia session (voice, videocall, videostreaming, electrocardiogram values... ).

Page 22: Presentacion kamailio uvigo_09262011

22

3. SIP

SIP functions:

1.­ User location: users register themselves to say the IP/port pair where they are listening to SIP traffic.

2.­ Multimedia parameter negotiation: it allows to negotiate session parameters (codecs, packetization time, ports...).

3.­ User availability: it allows to publish and notify info about user availability, and subscribe to user status.

Page 23: Presentacion kamailio uvigo_09262011

23

4. SIP 

SIP functions (cont.):

4.­ Call establishment (multimedia sessions).

5.­ Call management: call transfers, param re­negotiation...

Page 24: Presentacion kamailio uvigo_09262011

24

5. SIP 

SIP Roles

User Agent ­  examples: a SIP phone or a Media Server. It can play two roles: 

User Agent Client (UAC) – User Agent which sends a request  User Agent Server (UAS) ­ User Agent which answers a request 

Redirect Server ­ User Agent Server which redirect requests Proxy – sends request on behalf of users. It is what users 'see' of a SIP network .Registrar ­ accepts  REGISTER messages and stores user location in a Database.

Page 25: Presentacion kamailio uvigo_09262011

25

6. SIP SIP transport

SIP messages can be sent over TCP (port 5060) and UDP (port 5060). Normally UDP is used.

It can also be transported over TLS.

SIP URI: identifies and locates a user.

sip:[email protected] → sip:1234@<ip-server>sips:[email protected]

Domain is resolved by DNS. Three types of DNS records involved: SRV (protocol and port), NAPTR (protocols available) and A.

Page 26: Presentacion kamailio uvigo_09262011

Page 26Copyright Quobis Networks 2010 – All rights reserved

7. SIP

SIP messages

Requests:

● REGISTER: register users● INVITE: session establishment ● BYE: end of session● ACK: acknowledge (INVITE, 407,...)● SUBSCRIBE: event subscription● INFO: transmit info during a call (DTMF)

Page 27: Presentacion kamailio uvigo_09262011

Page 27Copyright Quobis Networks 2010 – All rights reserved

8. SIP

SIP responses:

Provisional (1xx):  100 Trying 

180 Ringing

Successful (2xx): 200 OK

             202 OK

Redirection (3xx): 302 Moved Temporaly

Request failure (4xx): 401 Unauthorized

  404 Not found  407 Proxy Authentication Required

  408 Request Timeout

Page 28: Presentacion kamailio uvigo_09262011

Page 28Copyright Quobis Networks 2010 – All rights reserved

SIP trapezoid

9. SIP

Page 29: Presentacion kamailio uvigo_09262011

Page 29Copyright Quobis Networks 2010 – All rights reserved

10. SIP

A Kamailio B

(Registrar local services)

……...... ……......

Register

200 Ok

Invite

100 Trying

Invite

100 Trying

180 Ringing 180 Ringing

200 Ok200 Ok

Ack

Media Session

Bye

200 Ok

Register + Call

Page 30: Presentacion kamailio uvigo_09262011

Page 30Copyright Quobis Networks 2010 – All rights reserved

11. SIP

REGISTER sip:10.1.20.245 SIP/2.0Via: SIP/2.0/UDP 10.1.3.15:5060;branch=z9hG4bK-83dafcc6From: "1234" <sip:[email protected]>;tag=a75abbe5b6e4cc6o1To: "1234" <sip:[email protected]>Call-ID: [email protected]: 33037 REGISTERMax-Forwards: 70Authorization: Digest username="1234",realm="10.1.20.245",nonce="4a389a3a000000984df34ebaabed674b40c0b27d8b354c1d",uri="sip:10.1.20.245",algorithm=MD5,response="216509e17700c67fb1b346675e0f46b2"Contact: "1234" <sip:[email protected]:5060>;expires=60User-Agent: Linksys/SPA941-5.1.5Content-Length: 0Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFERSupported: replaces

Initial REGISTER: endpoint->Kamailio

Page 31: Presentacion kamailio uvigo_09262011

Page 31Copyright Quobis Networks 2010 – All rights reserved

12. SIP

SIP/2.0 401 UnauthorizedVia: SIP/2.0/UDP 10.1.3.15:5060;branch=z9hG4bK-83dafcc6From: "1234" <sip:[email protected]>;tag=a75abbe5b6e4cc6o1To: "1234" <sip:[email protected]>;tag=f8f2ab2c1295e90ed7dbb499b30f44b2.c168Call-ID: [email protected]: 33037 REGISTERWWW-Authenticate: Digest realm="10.1.20.245", nonce="4a389a750000009c100b4538aaabc0db79e49a68db0e7dba", stale=trueServer: Kamailio (1.5.0-notls (i386/linux))Content-Length: 0

401: Kamailio->endpoint

Page 32: Presentacion kamailio uvigo_09262011

Page 32Copyright Quobis Networks 2010 – All rights reserved

13. SIP

REGISTER sip:10.1.20.245 SIP/2.0Via: SIP/2.0/UDP 10.1.3.15:5060;branch=z9hG4bK-67a1ce3From: "1234" <sip:[email protected]>;tag=a75abbe5b6e4cc6o1To: "1234" <sip:[email protected]>Call-ID: [email protected]: 33038 REGISTERMax-Forwards: 70Authorization: Digest username="1234",realm="10.1.20.245",nonce="4a389a750000009c100b4538aaabc0db79e49a68db0e7dba",uri="sip:10.1.20.245",algorithm=MD5,response="34d004dc426d7b56d9d742dbc69aeb4c"Contact: "1234" <sip:[email protected]:5060>;expires=60User-Agent: Linksys/SPA941-5.1.5Content-Length: 0Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFERSupported: replaces

Authentiqued REGISTER: endpoint->Kamailio

Page 33: Presentacion kamailio uvigo_09262011

Page 33Copyright Quobis Networks 2010 – All rights reserved

14. SIP

SIP/2.0 200 OKVia: SIP/2.0/UDP 10.1.3.15:5060;branch=z9hG4bK-67a1ce3From: "1234" <sip:[email protected]>;tag=a75abbe5b6e4cc6o1To: "1234" <sip:[email protected]>;tag=f8f2ab2c1295e90ed7dbb499b30f44b2.4319Call-ID: [email protected]: 33038 REGISTERContact: <sip:[email protected]:5060>;expires=60Server: Kamailio (1.5.0-notls (i386/linux))Content-Length: 0

200: Kamailio->endpoint

Page 34: Presentacion kamailio uvigo_09262011

34

3rd Part

Kamailio

Page 35: Presentacion kamailio uvigo_09262011

35

Open Source ToIP projects.

✔ Clients: Ekiga, Twinkle, Jitsi.

✔ IP­PBX: Asterisk (and derived projects), Freeswitch. 

✔ Softswitch: Kamailio­SIP Router, OpenSIPS.

✔ MediaServer: SEMS, Asterisk, FreeSwitch.

✔ Gateway: (Asterisk || FreeSwitch) + hardware card 

SIP Open Source projects.

Page 36: Presentacion kamailio uvigo_09262011

Page 36Copyright Quobis Networks 2010 – All rights reserved

Kamailio (formerly known as OpenSER): is a SIP softswitch. It can peform every SIP role (for us it will be Proxy and Registar).

It is a high performance and robust software. It is used by VoIP providers: Voztelecom (Spain) and 1&1 (Germany).

Kamailio is released under GPL license. Several companies offer professional support. Now it is part of the SIP Router project.

1. Kamailio

Page 37: Presentacion kamailio uvigo_09262011

Page 37Copyright Quobis Networks 2010 – All rights reserved

Kamailio can be installed on any Linux distribution.

Real test: 150 calls/s. Virtual machine with 512MB RAM and 1,4GHz.

A dedicated server with 4GB RAM could provide service to 300,000 users → Vigo!

2. Kamailio

Page 38: Presentacion kamailio uvigo_09262011

Page 38Copyright Quobis Networks 2010 – All rights reserved

Kamailio can be used in different scenarios:

● NAT Traversal: mediaproxy, rtpproxy, nathelper

● Presence server: presence, presence_xml

● Load balancer: dispatcher, path

● Instant Messaging: imc, xmpp

3. Kamailio

Page 39: Presentacion kamailio uvigo_09262011

Page 39Copyright Quobis Networks 2010 – All rights reserved

● Kamailio is based on modules with a kernel which performs following tasks: memory management, parsing and transport message.

● Kamailio's funcionality can be enriched with modules (dynamic libraries, .so) included in the configuration.

● Configuration is just a file: /etc/kamailio/kamailio.cfg

● Modules param and users are provisioned in Database (MySQL, Postgres, Oracle).

4. Kamailio

Page 40: Presentacion kamailio uvigo_09262011

Page 40Copyright Quobis Networks 2010 – All rights reserved

Image got from www.kamailio.orgNote: in 3.x versions Database and MI API are not in the kernel.

5. Kamailio

Page 41: Presentacion kamailio uvigo_09262011

Page 41Copyright Quobis Networks 2010 – All rights reserved

Configuration

● Routing behaviour is configured in kamailio.cfg.

● Kamailio must be restarted to apply in changes kamailio.cfg.

● Variable params are configured in Database and can be reloaded in execution time: user provision, ACL, LCR...

6. Kamailio. Configuration (1)

Page 42: Presentacion kamailio uvigo_09262011

Page 42Copyright Quobis Networks 2010 – All rights reserved

Configuration file has several parts:

1. General parameter setup : port, protocol...

2. Module load and module param setup:

loadmodule “permissions.so”               ...modparam(“permissions”, “db_mode”, 1)

loadmodule “permissions.so”               ...modparam(“permissions”, “db_mode”, 1)

3. Main route: every request that reaches Kamailio is executed in the main route.

7. Kamailio. Configuration (2)

route{...route[TO_KAMAILIO2]...

}

route{...route[TO_KAMAILIO2]...

}

Page 43: Presentacion kamailio uvigo_09262011

Page 43Copyright Quobis Networks 2010 – All rights reserved

4. Secondary routes (route[x]()): accesed from the main route (route()).

route[TO_KAMAILIO2]{         ...

t_on_failure(“1”)…

t_on_reply(“3”)}

route[TO_KAMAILIO2]{         ...

t_on_failure(“1”)…

t_on_reply(“3”)}

5. Error route route{}: executed when Kamailio receives an error reply to a sent request.

failure_route[1]{...

}

failure_route[1]{...

}

8. Kamailio. Configuration (3)

Page 44: Presentacion kamailio uvigo_09262011

Page 44Copyright Quobis Networks 2010 – All rights reserved

6. Reply routes (onreply_route[x]()): executed when a 2xx reply to a sent request is received.

onreply_route[1]{         ...}

onreply_route[1]{         ...}

10. Kamailio. Configuration (4)

7. Branch routes (branch_route[x]()): executed to create a parallel route to send request to another server

branch_route[1]{         ...}

branch_route[1]{         ...}

Page 45: Presentacion kamailio uvigo_09262011

Page 45Copyright Quobis Networks 2010 – All rights reserved

Fuente: Asipto

11. kamailio. Configuration (5)

Image got from www.kamailio.org

Page 46: Presentacion kamailio uvigo_09262011

Page 46Copyright Quobis Networks 2010 – All rights reserved

Fuente: Asipto

12. Kamailio. Configuration (6)

Image got from www.kamailio.org

Page 47: Presentacion kamailio uvigo_09262011

Page 47Copyright Quobis Networks 2010 – All rights reserved

13. Kamailio. Init.d and kamctl

How to launch Kamailio:

/etc/init.d/kamailio start/stop/restart/status

Kamctl: tool to control and monitor kamailio

● Check main stats: kamctl monitor

● Check uptime: kamctl fifo uptime

● Add user to Kamailio DB: kamctl add 101 secret101

Page 48: Presentacion kamailio uvigo_09262011

QUOBIS NETWORKS

Pol. A Granxa P.26036400 Porriño (Spain)Tlf. +34 902 999 465Sip://sip.quobis.com

www.quobis.com

Creative Commons Attribution-NonCommercial 3.0 Unported License