Top Banner
Introduction to SIP Introduction to SIP and and Open Source VoIP Open Source VoIP Implementations Implementations Ruwan Lakmal Silva Ruwan Lakmal Silva Lanka Communication Services Lanka Communication Services (Subsidiary Of Singtel) (Subsidiary Of Singtel) Sri Lanka Sri Lanka
108

Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Dec 16, 2015

Download

Documents

Fiona Wyche
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Introduction to SIPIntroduction to SIP and and

Open Source VoIP Open Source VoIP ImplementationsImplementations

Ruwan Lakmal SilvaRuwan Lakmal Silva

Lanka Communication Services Lanka Communication Services

(Subsidiary Of Singtel)(Subsidiary Of Singtel)

Sri LankaSri Lanka

Page 2: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Topics for the dayTopics for the day

Introduction to SIP ArchitectureIntroduction to SIP Architecture– SIP componentsSIP components– Message Headers and Message flowsMessage Headers and Message flows– NAT issues with SIPNAT issues with SIP

SIP Open source Implementations (LAB)SIP Open source Implementations (LAB)– SIP Express RouterSIP Express Router

Page 3: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

INTRODUCTION TO SIPINTRODUCTION TO SIP ARCHITECTURE ARCHITECTURE

Page 4: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

History

Session Initiation Protocol (SIP) is a Requests For Comments (RFC) of the Internet Engineering Task Force (IETF)

First standardized in March 1999 in RFC 2543 (Obsolete)

A second version in 2002 in RFC 3261 http://www.zvon.org/tmRFC/RFC3261/Output/index.html

Page 5: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

What is SIP anyway?

“Session Initiation Protocol (SIP),

an application-layer control (signaling) protocol for creating, modifying, and terminating sessions with one or more participants” (RFC 3261)

Page 6: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

WHAT IS A SESSION?

Internet telephone calls multimedia conferences Instant Messaging and PresenceHow ever it’s not limited to the above

Page 7: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Another VoIP Protocol? (1)

Simplifies access, interfaces, and applications allowing powerful new service combinations

Facilitating a platform which is of vendor independent

Critical enabler for Circuit to Packet convergence, delivering on the Service Intelligent Architecture vision

Page 8: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Another VoIP Protocol ? (2)

Growing interest in the industryMicrosoft adopted SIP as primary

communications protocol in Windows XPVarious standard bodies have incorporated

SIP into their plans:SIP will be used as the official 3G

Wireless multimedia protocol (by 3GPP)

Page 9: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Another VoIP Protocol (3)

Most competitors are incorporating SIP into product plans

Some are operating or planning commercially available SIP offerings for end users

Page 10: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Another VoIP Protocol (4)

Another SIP based IETF draft SIMPLE (SIP for Instant Messaging and Presence Leveraging Extensions) – a SIP based protocol for Instant Messaging

MSN / AOL already implemented (MSN 4.7)Yahoo to follow

Page 11: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Vendors

Page 12: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Overview (1)

ASCII based, signalling protocol Analogous to HTTP messages Works independent of the underlying network

transmission protocol and indifferent to media It provides mechanisms to:

Establish a sessionMaintain a sessionModify and Terminate a session

Page 13: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Overview (2)

Strength is it’s simplicity and basic assumptionsComponent reuse

A child of SMTP and HTTPSIP also uses MIME to carry extra informationUses URI Eg: sip:[email protected]

Page 14: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Overview (3)

Scalability Functionality such as proxying, redirection, location, or

registration can reside in different physical servers. Distributed functionality allows new processes to be added

without affecting other components.

Interoperability An open standard Can implement to communicate with other SIP

based products

Page 15: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Overview (4)

Mobility Supports user mobility by proxying and redirecting

requests to a user’s current location. The user can be using a PC at work, PC at home,

wireless phone, IP phone, or regular phone. Users must register their current location. Proxy servers will forward calls to the user’s current

location. Example mobility applications include presence and

call forking.

Page 16: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Integration with IETF Protocols

SIP forms only part of an overall IP telephony systemOther IETF protocol standards are used to build a fully functioning VoIP system. example:RSVP - to reserve network resources.RTP (Real Time Transport Protocol) -to

transport real time data

Page 17: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Integration with IETF Protocols…

RTSP (Real Time Streaming Protocol) - for controlling delivery of streaming media.

SAP (Session Advertisement Protocol) - for advertising multimedia session via multicast.

Page 18: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Related Protocols

SIP

IPv4 / IPv6

TCP UDP

SDP

MGCP RTSP RTCP RTP RSVP

Signalling Gateway control QoS

Page 19: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Capabilities (1)

Determine location of target points – Support address resolution, name mapping, call redirection

Determine media capabilities – SIP uses Session Description Protocol (SDP) for this

Determine availability – returns a message why the remote party cannot be contacted

Page 20: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Capabilities (2)

Establish a session between end points – also support mid call changes, changes of media characteristics or codec

Handles termination of calls – transfer of calls

Permits interaction between devices via signalling messages

Page 21: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Capabilities (3)

SIP messages can:Register a user with a system Invite a users to join an interactive sessionNegotiating the terms and conditions of a

sessionEstablish a media stream between 2 or

more end pointsTerminate a session

Page 22: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Architecture

A distributed client server architecture Different servers to handle Hence load balancingRedundancy

Page 23: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Components

SIP User AgentsUser Agent Clients (UAC)User Agent Servers (UAS)

SIP ServersProxy serverLocation serverRedirect serverRegistrar server

Page 24: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

User Agents (1)

Consists of UAC part and a UAS part UAC - An entity that initiates a call UAS – An entity that receives a call UAC is the only SIP component that can

create an original request Phones – acts as UAC or UAS Implemented in Hardware or Software

Components Includes softphones, sip ip phones, gateways

Page 25: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

User Agents (2)

Gateways – provide call control, mainly translation function between SIP conferencing end points and other terminal types

Includes a translation between translation formats

Translation between codecs

Page 26: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

26

User Agents (3)

Examples of user SIP user agents:

Pingtel xpressa

PC with softphone application

Komodo ATA 182/186 Cisco 7960 SIP IP Phone

Page 27: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

User Agents (4)

Page 28: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Distributed Architecture

Redirect Server

Location Server

Registrar Server

User Agent

Proxy Server

Gateway

PSTN

SIP Components

Proxy Server

Page 29: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Proxy Server

Acts Both as a Server and a Client Receives SIP messages, forwards to next SIP

server Can perform functions such as Authentication,

Autherisation, network access control, routing Requests are serviced internally or by passing

them on, possibly after translation, to other servers.

Interprets, rewrites or translates a request message before forwarding it.

Page 30: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Redirect server

Provides information about next hop to the users

Maps address to zero or more real addresses

Does not accept or terminate callsDoes not initiate its own SIP requestGenerates SIP responses to locate other

entities

Page 31: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Registrar server

Accept registration requests from usersMaintains user’s whereabouts at a

Location ServerTypically co-located with a proxy server

or a redirect server and may offer location services

May also support authentication

Page 32: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Location Server

Used by a SIP redirect or proxy server to obtain information about a called party’s possible location (s)

Page 33: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Examples???

Page 34: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Similar Domain Communication

(1) Call user B

(7) RTP(2) User B?

(3) SIP URL of “B”

(4) Proxied call

(5) Response

(6) Response

SIP PhoneDomain A

SIP ProxySIP Registrar &

Location Server

Page 35: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Dissimilar Domains

(1) Call user B

(2) How to reach B? (5) Where’s B?

(4) Proxied call

(8) Response

(9) Response

(3) Addressof Dom B Proxy

(6) SIP URL of “B”

(7) Proxied Call

(10) Response

User Agent A

(11) RTP

Domain A Domain B

SIP Registrar &

Location Server

Domain A’s SIP Proxy

Redirect Server

Domain B’s SIP Proxy

SIP Registrar &

Location Server

Page 36: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Registering process

Registration links a user to their service provider

First a REGISTER message is sent looking for a registrar server

Registrar finds user ID with IPThese registrations are not permenantRegistrations expires within minutes but

continuously renewed

Page 37: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Inviting users

Need to be a registered user Send INVITE message to one or more

devices / usersINVITE has many forms of addressing :

E.164 phone numbersDirect dialed IP addressesSIP URLs

Page 38: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Negotiating terms and conditions

Need to pass type of session Carries this information as attachment Concern only with the delivery of message and

not the content To carry this information, SIP uses SDP

(Session Description Protocol) Upon receiving an INVITE message, a party

can either accept or reject the invitation

Page 39: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Establishing a media stream

After accepting invitation, inviting party see or hear an indication to indicate the called party has been located

This may be a ring tone or a graphical indication

Generally generated by the end users device In voice calls media stream uses RTP (Real

time Transmission Protocol RFC 1889)

Page 40: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Termination

Device hangs up first issues a BYE message to the other device

Tear down the media stream and make way both ends to create or receive future services

Page 41: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Messages – Methods and Responses

SIP Methods: INVITE – Initiates a call by inviting

user to participate in session. ACK - Confirms that the client has

received a final response to an INVITE request.

BYE - Indicates termination of the call.

CANCEL - Cancels a pending request.

REGISTER – Registers the user agent.

OPTIONS – Used to query the capabilities of a server.

INFO – Used to carry out-of-bound information, such as DTMF digits.

SIP Responses: 1xx - Informational Messages

180 ringing 2xx - Successful Responses

200 OK 3xx - Redirection Responses

302 Moved Temporarily 4xx - Request Failure Responses.

404 Not Found 5xx - Server Failure Responses.

503 Service Unavailable 6xx - Global Failures Responses.

600 Busy Everwhere

Page 42: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Responses (1)

Informational 100 Trying 180 Ringing 181 Call forwarded 182 Queued 183 Session Progres

Success 200 OK

Redirection 300 Multiple Choices 301 Moved Perm. 302 Moved Temp. 380 Alternative Serv.

Page 43: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Responses (2)

Request Failure 400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 405 Bad Method 415 Unsupp. Content 420 Bad Extensions 486 Busy Here

Server Failure 504 Timeout 503 Unavailable 501 Not Implemented 500 Server Error

Page 44: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Responses (3)

Global Failure600 Busy Everwhere603 Decline604 Doesn’t Exist606 Not Acceptable

Page 45: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Addressing

A SIP address is identified by a SIP URL These are globally accessible addresses Examples of SIP URLs:

Fully-Qualified Domain Namessip:lakmal.lankacom.net

SMTP-style Domain Names [RFC 2368]sip:[email protected]

E.164 style addresses [RFC 2806]sip:[email protected];

user=phoneuser=phone means this is a gatewayMixed addresses

sip:[email protected]; user=phonesip:[email protected]

Page 46: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

DNS SRV (RFC 2782) Resource Records

SIP clients need to reach SIP servers for purposes of registration and call control

Redundant servers to handle calls if primary SIP server is unavailable

Can meet these requirements by using DNS SRV Resource Records

Available in BIND 8.X and up releases

Page 47: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SRV Resource Records

Format _service._protocol SRV Priority Weight Port hostname

Example :

_sip._udp SRV 0 0 5060 gateway.mydomain.com _sip._tcp SRV 0 0 5060 sip-server.cs.columbia.edu.

SRV 1 0 5060 backup.ip-provider.net._sip._udp SRV 0 0 5060 sip-server.cs.columbia.edu.

SRV 1 0 5060 backup.ip-provider.net.allows priority (for back-up) and weight (for load

balancing)

Page 48: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Zone file configuration

; zone 'mydomain.com' last serial 2004071308

$ORIGIN com. mydomain 86400 IN SOA gateway.mydomain.com.

postmaster.mydomain.com. ( 2004111908 ; Serial 36000 ; Refresh 900 ; Retry 36000 ; Expire 28800 ); Minimum

IN NS gateway.mydomain.com.IN NS ns3.backupdomain.com. IN MX 1 gateway.mydomain.com. IN A 192.168.0.1

;If we place the SRV record above the next line it fails to load $ORIGIN fitawi.com. _sip._udp SRV 0 0 5060 gateway.mydomain.com. gateway IN A 192.168.0.1 www IN CNAME gateway.mydomain.com.

Page 49: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

DNS Quarrying

dig -t SRV _sip._udp.mydomain.comExample SRVrecords

#dig -t srv _sip._udp.columbia.edu #host –v –t srv sip.tcp.columbia.edu #host -v -t srv sip.udp.columbia.edu #host -v -t srv _sip._udp.columbia.edu

Page 50: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Headers (1)

Much of the syntax and semantics are borrowed from HTTP.

Looks more like HTTP message – message formatting, header and MIME support

Page 51: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Headers (2)

Example SIP INVITE header:

INVITE sip:[email protected] SIP/2.0

Via: SIP/2.0/UDP 192.168.6.21:5060

From: sip:[email protected]

To: <sip:[email protected]>

Call-ID: [email protected]

CSeq: 1 INVITE

Expires: 180

User-Agent: Cisco IP Phone/ Rev. 1/ SIP enabled

Accept: application/sdp

Contact: sip:[email protected]:5060

Content-Type: application/sdp

Page 52: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Breakdown of header (1)

INVITE :message typeAddress of called partySIP version used by callerSemicolon indicates start of URI parametersEg:- user=phone indicates call is for a

phone number and not a SIP IP address INVITE sip:[email protected] SIP/2.0

Page 53: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Breakdown of header (2)

Via:History of message’s path through

network(s)Helps to prevent looping and ensures

replies route back to originator Indicates the used transport protocol, ip

address and port of sender Via: SIP/2.0/UDP 192.168.6.21:5060

Page 54: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Breakdown of header (3)

From:A field required in all requests and response

messagesProvides identity of request’s initiator From: sip:[email protected]

Page 55: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Breakdown of header (4)

To:Provides identity of the intended recipient

of the request To: <sip:[email protected]>

Page 56: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Breakdown of header (5)

Call-ID:Provides a globally unique identifier to

distinguish specific invitations or multiple registrations of the same user

Typically uses a 32-bit cryptographically random numbers

Call-ID: [email protected]

Page 57: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Breakdown of header (6)

CSeq or command sequence:Needed in both request messages as well

as response messagesNeed to increment this when a user with the

same Call-ID wants to send different SIP methods or content

When sending responses to requests, CSeq should be the same

CSeq: 1 INVITE

Page 58: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Breakdown of header (7)

Content-Type :Provides information about media type of

message body Content-Type: application/sdp

Page 59: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SDP (RFC 3550) Messages

Describes components of communication channel under negotiation

Includes information about : Codecs Ports Streaming protocols

Usually sent with INVITE and 200 OK in SIP based devices

Describes how data stream is going to be support via Real Time Transport Protocol (RTP, RFC 1889)

Page 60: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SDP Header

INVITE sip:[email protected]:6060;user=phone SIP/2.0

……

Content-Type: application/sdp

Content-Length: 168

v=0

o= - 123467777 123467777 IN IPV4 192.168.0.2

s=VOVIDA Session

c=IN IPV4 192.168.0.2

t=1253886592 0

m=audio 23456 RTP/AVP 0

a=rtpmap:0 PCMU/8000

A=ptime:20

Page 61: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Breakdown of header (1)

v: Vesrion number Also indicates start of SDP content

o: Session origin and owner’s name Format:

o=<username><session ID><version><net type><address type><address>

If user is unknown, session ID is set to Network Time Protocol (NTP, RFC 1305) time stamp of start time

<address> - the address of the machine of the user initiating the session

o= - 123467777 123467777 IN IPV4 192.168.0.2

Page 62: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Breakdown of header (2)

s:Session NameJust an identifier

c:connection information ip address of the sessionVery critical when communicating with

clients behind NATs Example of an IPV4 address session

c=IN IPV4 192.168.0.2

Page 63: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Breakdown of header (3)

m: media name and transport address Describe type of media Format :

<media><port><no. of ports><transport><fmt list>

m=audio 23456 RTP/AVP 0

When RTP/AVP is used for port, fmt list is list of integers that specify the codec that can be used

Page 64: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

CODECS, the bandwidth manager

Identifier Codec Bandwidth0 G.711ULaw 64 Kbps

2 G.726-32 32 Kbps

3 GSM 13 Kbps 4 G.723.1 5.3 / 6.3 Kbps8 G.711aLaw 64 Kbps9 CD-quality audio

15 G.728 16 Kbps

Full list is in RFC 3551

Page 65: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Simplified SIP Call Setup and Teardown

302 (Moved Temporarily)

INVITE

200 (OK)200 (OK)

ACK

INVITE

180 (Ringing)180 (Ringing)180 (Ringing)

200 (OK)

ACKACK ACK

RTP MEDIA PATH

BYEBYE BYE

200 (OK)200 (OK) 200 (OK)Call Teardown

MediaPath

Call Setup

INVITE

Location/Redirect ServerProxy Server Proxy Server User AgentUser AgentINVITE

100 Trying

100 Trying

Page 66: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Feature Creation

A SIP based system supports rapid feature and service creations

Tools Call Processing Language (CPL) – XML based Common Gateway Interface (CGI) SIP-CGI Servlets and Applets JAIN API

Enable rapid development of telecommunication products and services for the Java platform.

Page 67: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Call Processing Language

Allow users to create simple Internet telephony services

Features:Creatable and editable by simple graphical

tools Independent of signalling protocol Safe to run in serversXML like tags

Page 68: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

CPL Example

<cpl><incoming>

<address-switch field="origin" subfield="host"> <address subdomain-of=“myself.com">

<location url="sip:[email protected]"><proxy> <busy> <sub ref="voicemail" /> </busy> <noanswer> <sub ref="voicemail" /> </noanswer> <failure> <sub ref="voicemail" /> </failure></proxy>

</location> </address> <otherwise>

<sub ref="voicemail" /> </otherwise></address-switch>

</incoming></cpl>

Page 69: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

NAT issues with SIPNAT issues with SIP

Page 70: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Types of NATs

1. Full Cone

2. Restricted Cone

3. Port Restricted Cone

4. Symmetric

Page 71: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Full Cone

ClientIP:192.168.0.1Port : 9000

Computer AIP : 203.143.66.1Port : 10000

Computer BIP : 203.143.88.2Port : 20000

SourceIP : 202.123.4.15Port : 4567

NAT Gateway

Page 72: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Restricted Cone

External IP:port pair is only opened, once the internal computer sends out a packet to a specific destination IP(Eg. From client to Computer A)

Then the external computer can sends packets back (From Computer A to client, but packets from Computer B are blocked)

Page 73: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Port Restricted Cone

Almost identical to restricted coneBlocks packets from outside, unless the

client had not sent a packet to the particular IP and port, where the packets are coming from

If client has sent a packet to ip 203.143.88.2 and port 20000, NAT will only allow packets from that ip and port only

Page 74: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Symmetric

ClientIP: 192.168.0.1Port: 9000

NAT Gateway Computer AIP: 203.143.66.1Port: 10000

Computer BIP: 203.143.88.2Port: 20000

SourceIP: 202.123.4.15Port: 4567

SourceIP: 202.123.4.15Port: 1234

Page 75: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

NAT issues with SIP

Two parts in a SIP based call Signalling Media stream

Signalling SIP signaling messages can easily traverse NAT

SIP proxy needs to return SIP packets on the same port it received from the client

Special tags in SIP message header to achieve this ( the received tag and rport)

Page 76: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Example header

INVITE sip:[email protected] SIP/2.0

Via: SIP/2.0/UDP 203.143.0.121:5060;branch-a43u4h42-507c77f2

Via: SIP/2.0/UDP 192.168.0.1:5060;reveived=202.124.211.25;rport=10000

From: <sip: 1001@ 203.143.0.121>tag=108bcd14

To: sip: [email protected]

.

.

V=0

o=123467777 123467777 IN IPV4 192.168.0.2

s=VOVIDA Session

c=IN IPV4 192.168.0.1

t=1253886592 0

m=audio 23456 RTP/AVP 4

a=rtpmap:0 PCMU/8000

A=ptime:20

Page 77: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Solutions to NAT

2 main methods for determining mapping information

1. Ask from the NAT device

2. Ask someone outside the NAT device

Page 78: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

UPnP

UPnP (Universal Plug and Play)Mainly pushed by MicrosoftClient queries the NAT device via UPnP NAT device responds with the IP:port on

the public internetCannot use with cascading NATs

Page 79: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

External Query

Used when it’s not possible to communicate with NAT device

Ask a server, outside the NAT on the internet how it sees the source packets

A server is listening (NAT probing) Server replies from the same port of the received

packet, containing IP:port as the server sees Then client can determine

1. If it’s behind the NAT

2. Public IP:port that should be used in SDP message

Page 80: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

External Query

IP:192.168.0.1Port:8000

End point

NAT probe

Public Internet

IP: 203.143.78.3Port: 5642

Page 81: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

STUN

Simple Traversal of UDP Through NAT A protocol which helps in determining the

type of NAT Clients need to be developed with STUN

awareness so that they can set their SDP messages

Clients can determine if it is:1. On the open internet2. Behind a firewall that blocks UDP3. Behind a NAT, and the type of NAT

Page 82: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

RTP relay

STUN and UPnP works only with the first 3 types of NATs

If connection oriented media is used in Symmetric NAT, the problem is solved

One possible solution is to have :an RTP relay between the RTP flowA NAT proxy between the SIP flow

Page 83: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Solution for Symmetric NAT

UA NAT Gateway

NAT Proxy

RTP Relay

Voice Gateway

1 INVITE

2 3 Assigns Ports

4 SDP modified INVITE

5 OK with own SDP

6 IP:PORT of gateway

7 Upstream RTP port

8 forwarded response

With modified SDP

9 RTP

10 forwards RTP

11 RTP12 RTP

V V

Page 84: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Open Source VoIP Open Source VoIP (SIP) Implementations(SIP) Implementations

Page 85: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Express RouterSIP Express Router

Page 86: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

iptel.org

iptel.org is another SIP deployment organization Unique open-source SIP server with premium service

creation flexibility and performance iptel.org spun off from Germany’s national

research labs,Fraunhofer, home of MP3 and very first implementations ever of mobile IP and IPv6 applications

– www.fokus.fhg.de. iptel.org provides software, consultancy and

technical support to both operators and vendors in the SIP area.

Page 87: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Express Router (1)

The server is built for operation in huge networks

Already powering large public SIP networks such as FWD.

Server supports cryptographic standard protocols (TLS, OSP) to achieve secure multi- domain peering and granular service access control mechanisms

Page 88: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP Express Router (2)

Can handle any SIP client devices behind NAT routers

Feature flexibility that allows operators to attract customers with a variety of charging plans

Page 89: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SIP/SER Model

Page 90: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SER Features (1)

SIP: Registrar, proxy, redirect Web- based provisioning with SERweb

(missed calls, voicemail, IM paging) Application builder: user provisioning, click-

to- dial Gateways: SMS, Jabber Accounting, Authorization, Authentication

(syslog, RADIUS, SQL, LDAP) Voicemail2Email, Announcements

Page 91: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SER Features (2)

RADIUS/ CLID integration Presence Agent NAT- Traversal Helper Multidomain Hosting DB integration: MySQL, LDAP,

Postgress TLS security

Page 92: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SER Features (3)

Extensibility: new plug- ins can extend feature set. Standard compliancy: Interoperability tested and

proven in SIPITs. Flexibility through routing language Small footprint (a few hundreds of Kilobytes) Application building through Application Scripting

Interface Support for both IPv4 and IPv6 Written in Plain C Superior performance

Page 93: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Effectiveness of ApplicationBuilding

Development overhead for SER- based applications claims to be fairly low: Click- to- dial: ~ 150 lines of code (LOC) in shell T- storm alerts (experimental application for a

household) Web phonebook (part of SER’s web front- end): ~

230 LOC + 120 for click- to- dial in PHP SIP- layer Ping utilitity: ~ 10 LOC (Perl)

Page 94: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Example: Web Integration, MissedCalls/Click Calls/Click-to to-Dial

Page 95: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

More Examples: FWD on-line Status

Pulver’s Free World Dialup site allows to display online status in users’ webpages and email attachements

http://www.fwd.pulver.com/

Overhead: 30 lines in PHP

Page 96: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Application Agent (AA)

SIP server for rapid service creation Minimize Time To Market

Hide signaling complexity by high call-level abstraction Reduce Lines Of Code by using AA’s built in functions Bet on effective programming environment: Python

Improve Quality Of Service Underlying libraries take care of proper call state processing

and protocol communication transparently AA leverages proven SER’s features, performance,

stability and interoperability

Page 97: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Interoperability Matters

SER has been extensively tested in SIP Interoperability Tests (SIPIT) in past years.

iptel.Org has set up an interoperability lab in which SER has been tested against existing SIP devices (3Com, Ahead Software, Avaya, AudioCodes, Allied Telesyn, Cisco, GrandStream, HotSIP, Intertex, Microsoft, Mitel, net. com, Pingtel, Siemens, Snom, Vegastream, XTen, etc.)

Page 98: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

SER Installation GuideSER Installation Guide

Page 99: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Supported architectures

Linux/i386 (RedHat, Mandrake etc..)Linux/armv4l FreeBSD/i386 OpenBSD/i386 Solaris/sparc64 NetBSD/sparc64

Page 100: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Requirements (1)

gcc or icc : gcc >= 2.9x; >=3.1 recommended bison or yacc (Berkley yacc) flex GNU make (on Linux the standard "make", on

FreeBSD and Solaris, "gmake") sed and tr (used in the make files) GNU tar ("gtar" on Solaris) and gzip

Page 101: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Requirements (2)

GNU install or BSD install (on Solaris "ginstall")

Mysql if MySQL support is needed Apache (httpd) for serweb support PHP, MySQL-PHP for serweb support libmysqlclient & libz (zlib) want mysql

support is needed (the mysql module)

Page 102: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Install the package

Latest Stable as of this date is ser-0.9.4 From source #make all

builds everything #make install

Installs the compiled binaries in /usr/local/sbin Configuration files in /usr/local/etc/ser

Page 103: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Controlling SER (1)

Start the server #/usr/local/sbin/ser #/usr/local/sbin/ser start #/usr/local/sbin/ser restart

watch server's health with serctl utility first set the environment variable SIP_DOMAIN Eg :#exportSIP_DOMAIN="myserver.mydomain.com”

Page 104: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Controlling SER (2)

Run the serctl utility #/usr/sbin/serctl monitor #/usr/local/sbin/serctl monitor

Page 105: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

MySQL setup

Once you have MySQL installed and started, execute #/usr/sbin/ser_mysql.sh

Verify that the database has been created Mysql> select * from user; mysql> connect ser; Connection id: 294 Current database: ser

mysql> show tables; Configure SER

/usr/local/etc/ser/ser.cfg

Page 106: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

Summary

SIP is gaining acceptance in the industry Open Source projects are taking the lead in

SIP implementations New generation of services are already being

offered SIP based VoIP services can even be more

attractive if the NAT issues are addressed As ISPs in the region, how are you going to

take advantage of this new protocol??

Page 107: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

References

http://www.vovida.orghttp://www.iptel.orghttp://www.asterisk.orghttp://www.cs.columbia.edu/sip/

Page 108: Introduction to SIP and Open Source VoIP Implementations Ruwan Lakmal Silva Lanka Communication Services (Subsidiary Of Singtel) Sri Lanka.

That’s it!!!That’s it!!!Thank youThank you

Lakmal SilvaLakmal [email protected]@lankacom.net

[email protected][email protected]