sip header msg format

40
SIP Protocol Protocol format and headers

Upload: rupesh-kumar

Post on 09-Dec-2015

14 views

Category:

Documents


0 download

DESCRIPTION

SIP Header Msg Format

TRANSCRIPT

Page 1: SIP Header Msg Format

SIP Protocol

Protocol format and headers

Page 2: SIP Header Msg Format

Contents

• SIP Protocol generally• SIP addressing, SIP URIs• SIP responses• SIP methods• SIP message format

– Headers– Body

Page 3: SIP Header Msg Format

SIP Protocol generally

• SIP is a text based• Similar to HTTP• SIP transaction / Call Leg

– Client sends a Request– Server replies with one or more Responses– Identified by To, From and Call-ID headers

• UDP or TCP is used as a transmission protocol

Page 4: SIP Header Msg Format

SIP Protocol generally

• Three way handshake in INVITE

Page 5: SIP Header Msg Format

SIP Addressing

• SIP URIs are usedsip:user:password@host:port;url-parameters?headers

• Several SIP headers use URI format– Request line– From– To– Contact …

Page 6: SIP Header Msg Format

SIP Addressing (cont.)

• SIP URIs, url-parameters– user: used to determine if username is a

telephone number (user=phone)– method: indicates the method to be used– ttl: time to live– maddr: multicast address where request should

be directed• Headers, for example subject=Hey

Page 7: SIP Header Msg Format

SIP Addressing (cont.)

• tags: cryptographically random number, added to To and From headers – identifies a call-leg

Page 8: SIP Header Msg Format

SIP Responses

• 1xx – Informational• 2xx – Success• 3xx – Redirection• 4xx – Client Error – resubmit after

modification• 5xx – Server error – Message OK but cannot be

prosessed in this server• 6xx – Global Failure

Page 9: SIP Header Msg Format

SIP Responses, 1xx (Informational)

• 100 Trying– hop-by-hop response– ”100 Trying ” is never forwarded– generated by a Proxy server or an User agent

• 180 Ringing– Indicates that the INVITE has been received by the

called User agent– Ringtone can be conveyd in the message body from

UAS to UAC

Page 10: SIP Header Msg Format

SIP Responses, 2xx (Success)

• 200 OK– Currently only Success-class response defined

in SIP– Indicates acceptance of INVITE (includes

media properties of the called UAS)

Page 11: SIP Header Msg Format

SIP Responses, 3xx (Redirection)

• 300 Multiple Choices– Request is responded with multiple Contact choices,

which should be used in that order in re-request• 301 Moved Permanently

– Response contains a permanent Contact header of the called party – address can be saved and used later

• 302 Moved Temporarily– Response contains a temporary Contact header of the

requested party – should not be cached unless Expires header is present

Page 12: SIP Header Msg Format

SIP Responses, 3xx (Redirection)

• 305 Use Proxy– Response includes an address for a proxy, to

which the request should be sent• 380 Alternative Service

– Indicates the type of service that the called party would like – for example voice mail or redirect server

Page 13: SIP Header Msg Format

SIP Responses, 4xx (Client error)

• 400 Bad Request– Not understood by the server (missing required

header? or multiple INVITEs for same Call-ID)• 401 Unauthorized

– Indicates, that the user is required to perform Authentication

– Sent By ”User Agent” or ”Registrar”

Page 14: SIP Header Msg Format

SIP Responses, 4xx (Client error)

• 404 Not Found– SIP URL can not be located by the server

• 407 Proxy Authentication Required– Indicates, that UAC must authenticate itself to

the proxy• 408 Request Timeout

– INVITE has not been forwarded before request has expired (Expires header)

Page 15: SIP Header Msg Format

SIP Responses, 4xx (Client error)

• 480 Temporary unavailable– Called party is not available for some reason

• 482 Loop Detected– Request has been routed back to the proxy that

previously forwarded the request• 483 Too Many Hops

– Request has been forwarded the maximum number of times set by “Max-Forwards”

Page 16: SIP Header Msg Format

SIP Responses,5xx (Server error)

• 500 Server internal error• 501 Not Implemented• 503 Service unavailable

• Actual message was correct and may be sent to some other server

Page 17: SIP Header Msg Format

SIP Responses,6xx (Global error)

• Should not be sent anywhere – it fails everywhere

• 600 Busy everywhere• 606 Not Acceptable

Page 18: SIP Header Msg Format

SIP Methods• INVITE

– Invite to participate in a session or change parameters of an existing session

– Includes usually message body with media information of caller

• ACK– Acknowledge a received final response (200-699)– May contain message body with media information – Invite (A-B) – 200 OK (B-A) – ACK (A-B)

• BYE– Terminate an established media session

Page 19: SIP Header Msg Format

SIP Methods, example1

Page 20: SIP Header Msg Format

SIP Methods, example2

Page 21: SIP Header Msg Format

SIP Methods (cont.)

• REGISTER– register current locations to registrar server,

redirect/proxy requests to current location– remove existing registrations (Expires = 0)

• CANCEL– Request to cancel pending request– Also sent by forking proxies after succesful

response to one of the branched requests

Page 22: SIP Header Msg Format

SIP Methods, example3REGISTER sip:feanor.pc.lut.fi SIP/2.0Via: SIP/2.0/UDP 157.24.25.137:5060From: athamala <sip:[email protected]>To: athamala <sip:[email protected]>Call-ID: 123456789@aradanCSeq: 1 REGISTERContact: <sip:[email protected]>Content-Length: 0

SIP/2.0 200 OKVia: SIP/2.0/UDP feanor.pc.lut.fi:5060From: athamala <sip:[email protected]>To: athamala <sip:[email protected]>Call-ID: 123456789@aradanCSeq: 1 REGISTERContact: <sip:[email protected]>;expires=3600Content-Length: 0

UA REGISTRAR

UA REGISTRAR

Page 23: SIP Header Msg Format

SIP Methods, example4

Page 24: SIP Header Msg Format

SIP Methods (cont.)

• INFO– used to send call signalling information to

another user agent– it doesn’t change anything – for example in SIP<->PSTN to transfer DTMF

signals• OPTIONS

– Query server or user agent about its capabilities

Page 25: SIP Header Msg Format

SIP Methods (cont.)

• SUBSCRIBE– To query presence information of other user

• NOTIFY– To inform other users about state of presentity

• MESSAGE– To send instant message body

Page 26: SIP Header Msg Format

SIP Methods (cont.)

• PRACK– To acknowledge informational (1xx) messages– Not very widely used

• COMET– Allows UAS to indicate, that QOS

preconditions have been met• REFER

– To initiate a third-party call control

Page 27: SIP Header Msg Format

SIP Message format

1.a) Request URL in Request (contains next hop in the path)

– INVITE [email protected] SIP/2.01.b) Status line in responses

– SIP/2.0 200 OK or similar2) Headers (From, To, Via, ...)3) Empty line4) Message body

Page 28: SIP Header Msg Format

SIP Message, request exampleINVITE sip:[email protected] SIP/2.0Via: SIP/2.0/UDP 157.24.25.137:5060From: Arto <sip:[email protected]>To: Jari <sip:[email protected]>Call-ID: 123456789@aradanCSeq: 1 INVITEContact: <sip:[email protected]>Content-Type: application/sdpContent-Length: 147

v=0 o=athamala 2890844526 2890844526 IN IP4 aradan.pc.lut.fis=Session SDP c=IN IP4 157.24.25.137 t=0 0 m=audio 49172 RTP/AVP 0 a=rtpmap:0 PCMU/8000

Page 29: SIP Header Msg Format

SIP Message, response exampleSIP/2.0 200 OKVia: SIP/2.0/UDP 157.24.25.137:5060From: Arto <sip:[email protected]>To: Jari <sip:[email protected]>;tag=314152 Call-ID: 123456789@aradanCSeq: 1 INVITEContact: <sip:[email protected]>Content-Type: application/sdp Content-Length: 149

v=0 o=jarsku 2890844527 2890844527 IN IP4 haldir.pc.lut.fis=Session SDPc=IN IP4 157.24.25.139 t=0 0 m=audio 3456 RTP/AVP 0 a=rtpmap:0 PCMU/8000

Page 30: SIP Header Msg Format

SIP Message format, headers

• From– Contains the initiator of the request (SIP URI),

required in all SIP messages• To

– Contains the recipient of the request (SIP URI),required in all SIP messages

Page 31: SIP Header Msg Format

SIP Message format, headers

• Call-ID– Unique identification code for Call, mandatory

in all SIP requests and responses– Call-ID: [email protected]

• CSeq– Sequence number for requests, UAS decide if

the request is a retransmission (same CSeq) or new request

– Cseq: 1 INVITE

Page 32: SIP Header Msg Format

SIP Message format, headers

• Contact– URL, which identifies the requested resource or the

request originator, mandatory in “INVITE” and “200 OK” responses to invitations.

– Contact: “Arto Hamalainen” <sip:[email protected]>

• Via– To store addresses of all the proxies which handle the

request, helps in loop detection and routing, required– Via: SIP/2.0/UDP feanor.pc.lut.fi:5060

Page 33: SIP Header Msg Format

SIP Message format, via processing

Page 34: SIP Header Msg Format

SIP Message format, headers

• WWW-Authenticate / Proxy-Authenticate– in ”401 Unauthorized” or ”407 Proxy

authentication required”• Authorization / Proxy Authorization

– in reply to 401 or 407, includes user credentials• Content-Length• Content-Type (for example application/sdp)

Page 35: SIP Header Msg Format

SIP Message format, headers

• Record-Route– Record Route header is used by proxies to force

that future requests in the same call will be forwarded through this route

• Route– In future requests Record-route is copied as a

Route –header which forces request to go through the proxy which inserted Record-route in the previous request

Page 36: SIP Header Msg Format
Page 37: SIP Header Msg Format

SIP Message format, body

• Some SIP messages have also message body. It can be for example– SDP/XML media description– Instant message data (in MESSAGE)

• Body type and length explained in Content-Type and Content-Length headers

Page 38: SIP Header Msg Format

SIP Message format, body (SDP)

...Content-Type: application/sdpContent-Length: 147

v=0o=athamala 2890844526 2890844526 IN IP4 here.com s=Session SDP c=IN IP4 100.101.102.103 t=0 0 m=audio 49172 RTP/AVP 0 a=rtpmap:0 PCMU/8000

Page 39: SIP Header Msg Format

SIP Protocol format

• SIP is text-based signalling protocol• Client sends Requests– Server responds

with a Response• Request methods: INVITE, REGISTER,

CANCEL, BYE, INFO, OPTIONS, ACK• Response codes: 1xx-6xx

Page 40: SIP Header Msg Format

SIP Protocol format

• Headers: From, To, Via, Call-ID, CSeq, Contact, ...

• Payload usually SDP Description, can be something else (XML, ...)