SIP is an application-layer protocol for establishing multimedia sessions over IP networks. It can be used to initiate voice, video, and instant messaging communications. SIP works by having user agents (clients and servers) exchange SIP request and response messages. These messages contain information about session setup, modification, and termination. Some key SIP components include user agents, proxy servers, registrar servers, and redirect servers. SIP messages use a request-response transaction model and contain start lines, headers, and optional message bodies. Common request methods are INVITE, ACK, BYE, and REGISTER. Typical response codes include 100-199 (informational), 200-299 (success), 300-399 (redirection), 400-499
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
session initiation protocol - SIP
1. Session Initiation Protocol
SIP: Protocol Overview
Done by: Mahmoud M. Abudaqa 120101677
Asem saleem Al-Alami 120101715
Mr.Ehab Mortaja
Adviser
Islamic University - Gaza
Faculty of Information Technology
Department of Software Development
2. Outline
• What is SIP
• History of SIP
• SIP Design Concepts and Architectures
• SIP system components
• SIP messages and responses
• SIP call flows example
3. What is SIP
• The Session Initiation Protocol (SIP) is an application-
layer control protocol that can establish, modify and
terminate multimedia sessions or calls.
• Can be used for voice, video, instant messaging, gaming,
etc., etc., etc.
• Purpose of SIP: To establish, modify and terminate multimedia
sessions over the IP network
• SIP as a protocol is also very powerful and efficient in many
ways. Many organizations use SIP for their internal and
external communication.
4. Who Invented SIP?
• SIP is being developed by the SIP Working Group, within the
Internet Engineering Task Force (IETF). The protocol is
published as IETF RFC 2543 and currently has the status of a
proposed standard.
• The IETF Network Working Group published RFC 3261 - as of
2013 the latest version of the specification - in June 2002.
• Because of the open nature of the IETF standards process, the
fact that SIP is text based and shares many features with
existing specifications, it has been readily understood,
extended, and implemented.
5. What it does & what it doesn't
• SIP has five main functions:
• It locates the user and determines which end system will be
used in the proposed session.
• It establishes the session.
• It manages the session, handling call termination, call transfer,
changes to session parameters, and so forth.
• Call feature changes: SIP allows a user to change a call’s characteristics
during the call. For example, as a user, you may want to enable of
disable video, especially while a new user joins a session.
6. SIP Application Areas:
• Internet Telephony
• Multimedia Conferences
• Instant Messaging
• Control Applications
• Music and video on demand
7. Protocol design
• The SIP protocol is designed to be independent of the
underlying transport protocol, so SIP applications can run on
TCP, UDP, or other lower-layer networking protocols.
• SIP uses port 5060 both for UDP and TCP.
8. SIPDesignElements
What Did SIP Inherit?
• based on earlier protocols
• HTTP request/response transaction model
• client invokes server method/function
• receives at least one response
• using most header fields, encoding rules, and status codes of
HTTP
• DNS like recursive and iterative searches
• incorporates the use of a Session Description Protocol (SDP)
9. SIPDesignElements
What Did SIP Inherit?
• SIP works in roughly the same way as other common protocols
like HTTP or SMTP. It carries out the signaling by sending small
messages, consisting of a header and a body.
• Like HTTP and SMTP, SIP is an Internet standard, which means
that it specifies a set of instructions that are designed to be
combined into a message and sent via Internet protocols such
as TCP/UDP and IP. Unlike HTTP/SMTP however, it is a
signaling standard: it defines how and where two or more
endpoints can exchange a stream of data, but plays no part in
the ultimate sending and receiving of the actual media.
11. Sip Entities
• User Agents
• Clients – Make requests
• Servers – Accept requests
• Server types
• Redirect Server
• Proxy Server
• Registrar Server
12. SIP Architectureincludes several
components:
• The User agent (UA) resides at the terminal level (PC or a SIP phone). The
user agent has a part known as the client (UAC) which sends the
requests, and a part known as server (UAS) who answers the requests.
• The Proxy server (PS) or relay agent is a terminal that conveys the
received request of the client. Such a server can decode and modify
the messages which it receives before retransmitting them.
• The Redirect server (RS) provides the new destination address to the
client. Let ‘s note that a Redirect Server is accessed by the UAC like a
regular server and cannot send requests like the PS.
• The Registrar Server is a server which accepts REGISTER requests. Each
PS or RS is generally connected to a Registrar.
13. Addressing
sip:user@host[parameters][headers]
• SIP-addresses are like URLs, with prefix sip:
which gives schema
– sip:joe.smith@hut.fi
– sip:joe.smith@hut.fi?subject=Protocol
– sip:sales@hotel.xy;geo.position:=48.54_-123.84_120
• Address must include host, other parameters are optional
(username, port, etc…)
14. SIP Messages
• SIP a text based protocol, cf. HTTP
• have request messages
• first line a method name and request-URI
• have response messages
• first line a response code
15. SIP Requests definedbyRFC3261
Method Description
INVITE Used to set up an SIP session.
BYE Terminates an open session.
ACK
Confirms a success response to an
INVITE. The third part to a three-way-
handshake.
CANCEL
Cancels an open request. BYE should
be used to cancel (tear down) an
existing request.
OPTIONS Ask for server capabilities
REGISTER Sends user’s address to server
16. SIP Request Example
INVITE sip:bob@biloxi.com SIP/2.0
Via: SIP/2.0/UDP 12.26.17.91:5060
Max-Forwards: 70
To: Bob <sip:bob@biloxi.com>
From: Alice <sip:alice@atlanta.com>;tag=1928301774
Call-ID: a84b4c76e66710@12.26.17.91
CSeq: 314159 INVITE
Contact: <sip:alice@atlanta.com>
Content-Type: application/sdp
Content-Length: 142
17. SIP Response
• 1XX information msg 100 Trying
• 2XX Successful 200 OK
• 3XX Redirection 302 Moved Temporarily
• 4XX Client Error 404 Not Found
• 5XX Server Error 504 Server Time-out
• 6XX Global Failure 603 Decline
18. SIP Response Example
SIP/2.0 200 OK
Via: SIP/2.0/UDP server10.biloxi.com
Via: SIP/2.0/UDP bigbox3.site3.atlanta.com
Via: SIP/2.0/UDP 12.26.17.91:5060
To: Bob <sip:bob@biloxi.com>;tag=a6c85cf
From: Alice <sip:alice@atlanta.com>;tag=1928301774
Call-ID: a84b4c76e66710@12.26.17.91
CSeq: 314159 INVITE
Contact: <sip:bob@biloxi.com>
Content-Type: application/sdp
Content-Length: 131
19. Basic Message Format
• Each SIP message begins with a Start-Line, followed by a sequence
of headers, and separated from the message body by a carriage-
return line-feed sequence (CRLF).
• SIP Control messages are human readable clear text.
START LINE Request or Status response
HEADERS Fields Message attributes
General format <name>:<value>
• Separator Line: Separator between header and body.
Body: binary or textural payload.
• Remember –The Media is transported separately
20. Basic Message Format
• MESSAGE PARTS
SIP messages are composed of the following three parts:
21. Message -START LINE
Each SIP message begins with a Start Line
Conveys the message type and protocol version
Can be a Request or Status Line.
• Request Line includes a Request URL of the
destination user or service,
• Status Line includes the numeric Status-code
and its associated textural phrase
22. Message -HEADERS Fields
• Similar in syntax and semantics to HTTP header
fields
• To:, From:
• General format <field name> : <value>
• Headers can span multiple lines.
• Headers can appear multiple times in a message
• Via, Contact, Route and Request-Route
23. Message -BODY (CONTENT)
• Describes the session to be initiated, audio and video codec
types, sampling rates etc.
• Can appear both in request and in response messages
• Can contain any opaque information that relates to the
session .
Body session types
• SDP—see Session Description Protocol (SDP).
• Multipurpose Internet Mail Extensions (MIME).
• Others—to be defined in the IETF and in specific
implementations.
26. To and From header fields
• To: specifies the logical call destination
• From: specifies the logical call source
• Present in all SIP messages
27. Call-ID and CSeq header fields
• Call-ID: It helps to uniquely identify a particular SIP dialog
• or registration
– It helps to match requests and responses
– It helps to detect duplicated messages
• • CSeq: It is a number that uniquely identifies the transaction
in a call
• • Present in all SIP messages
28. SIP Call Flow -Direct
ACK
200 - OK
INVITE: sip:18.18.2.4
“Calls”
18.18.2.4
180 - Ringing Rings
200 - OK Answers
BYEHangs up
RTPTalking Talking
User
A
User
B
Example of Request and Response in SIP
29. SIP Flows – Via Proxy
INVITE: sip:dbaron@MIT.EDU
“Calls” dbaron
@MIT.EDU
INVITE: sip:dbaron@18.18.2.4
100 - Trying
180 - Ringing
Rings180 - Ringing
200 - OK Answers
200 - OK
ACK
BYEHangs up
200 - OK
User
A
User
BMIT.EDU
Proxy
Talking TalkingRTP
Editor's Notes
*Focused on but not limited to Multimedia -Voice, Video etc. *Written in clear text, human readable form -Easy to understand and implementIt is a Control Protocol not a media transport protocolDistributed architecture
-One of the most active working groups in the IETF-80 active Internet drafts related to SIP
It is a Control Protocol not a media transport protocolSIP FunctionsSIP is an enabler-protocol for VoIP and Telephony in general, due to the following features it has:Name Translation and User Location: SIP translates an address to a name and thus reaches the called party at any location. It does a mapping of session description to location, and ensures support for details of the nature of the call.Feature negotiation: Not all communicating parties (which may be more than two) have the necessary features. For example, not everyone may have video support. SIP allows the group the negotiate for the features.Call participant management: SIP allows a participant to make or cancel connections to other users during a call. Users can also be transferred or placed on hold.Call feature changes: SIP allows a user to change a call’s characteristics during the call. For example, as a user, you may want to enable of disable video, especially while a new user joins a session.
How can SIP be used? IP Telephony –Voice & VideoInstant MessagingMusic and video on demandInteractive gamingCalendars, meetings, conf callsFull service web ConferencingLocation based services
SIP employs design elements developed for earlier protocols. SIP is based on an HTTP-like request/response transaction model. Each transaction consists of a client request that invokes a particular method, or function, on the server and at least one response. SIP uses most of the header fields, encoding rules, and status codes of HTTP. This provides a readable text-based format for displaying information. SIP also uses concepts similar to the recursive and iterative searches of DNS. SIP incorporates the use of a Session Description Protocol (SDP), which defines session content using a set of types similar to those used in MIME.
An SIP network can be viewed of consisting of components defined on two dimensions: client/server and individual network elements. A client is any network element that sends SIP requests and receives SIP responses. A server is a network element that receives requests in order to service them and sends back responses to those requests. Stallings DCC8e Figure 24.7 shows how some of the SIP components relate to one another and the protocols that are employed. These include:• User Agent: Resides in every SIP end station. • Redirect Server: Used during session initiation to determine the address of the called device, which it returns to the calling device, directing the UAC to contact an alternate URI. This is analogous to iterative searches in DNS.• Proxy Server: An intermediary entity that acts as both a server and a client for the purpose of making requests on behalf of other clients. A proxy server primarily ensures that a request is sent to another entity closer to the targeted user. Proxies are also useful for enforcing policy. A proxy interprets, and, if necessary, rewrites specific parts of a request message before forwarding it. • Registrar: accepts REGISTER requests and places the information it receives in those requests into the location service for the domain it handles.
SIP forking refers to the process of "forking" a single SIP call to multiple SIP endpoints. This is a very powerful feature of SIP. A single call can ring many endpoints at the same time.User Agents– Can act as client and as server• Servers:– Redirect Servers• Send back alternative location of the user (similar as HTTP servers)– Proxy servers• Act on behalf of client (forwards requests)• Forking proxies– Registrars• Accepts registrations
A resource within a SIP network is identified by a Uniform Resource Identifier (URI). Examples of communications resources include the following: A user of an online service; An appearance on a multiline phone; A mailbox on a messaging system; A telephone number at a gateway service; A group (such as "sales" or "helpdesk") in an organization.SIP URIs have a format based on email address formats, namely user@domain. There are two common schemes. An ordinary SIP URI is of the form:sip:bob@biloxi.comThe URI may also include a password, port number, and related parameters. If secure transmission is required, "sip:" is replaced by "sips:". In the latter case, SIP messages are transported over TLS.
As was mentioned, SIP is a text-based protocol with a syntax similar to that of HTTP. There are two different types of SIP messages, requests and responses. The format difference between the two types of messages is seen in the first line. The first line of a request has a method, defining the nature of the request and a Request-URI, indicating where the request should be sent. The first line of a response has a response code. All messages include a header, consisting of a number of lines, each line beginning with a header label. A message can also contain a body, such as an SDP media description.
SIP Request – sent from client to server - is considered a 'verb‘ --RFC3261 defines six methods Description INVITEinitiate a session between two participants INVITE Requests a sessionACK Final response to the INVITEOPTIONS Ask for server capabilitiesCANCEL Cancels a pending requestBYE Terminates a sessionREGISTER Sends user’s address to server
For example, the header of message (1) in Stallings DCC8e Figure 24.11 (previous slide) might look as shown. The first line contains the method name (INVITE), a SIP URI, and the version number of SIP that is used. The Via headers show the path the request has taken in the SIP network and is used to route responses back along the same path. It contains the IP address (12.26.17.91), port number (5060), and transport protocol (UDP) that Alice wants Bob to use in his response. Subsequent proxies add additional headers.Max-Forwardslimist the number of hops a request can make on the way to its destination. It consists of an integer that is decremented by one by each proxy that forwards the request. If it reaches 0 before the request reaches its destination, it will be rejected with a 483 (Too Many Hops) error response.To contains a display name (Bob) and a SIP/SIPS URI toward which the request was originally directed. From also contains a display name (Alice) and a SIP/SIPS URI that indicate the originator of the request. It also has a tag with a random string added to the URI by the UAC to identify the session.Call-ID contains a globally unique identifier for this call, generated by the combination of a random string and the host name or IP address. CSeq or Command Sequence contains an integer and a method name. The CSeq is used to distinguish a retransmission from a new request.The Contact header contains a SIP URI for direct comms between UAs. The Content-Type indicates the type of the message body. Content-Length gives the length in octets of the message body.
Response: sent from server to a client, and provides the status of that request.SIP responses are classified by first digitStatus Codes1XX –information messages (100 –trying, 180 –ringing, 183 –progress) 2XX –successful request completion (200 –OK) 3XX –call forwarding, redirection (302 –temporarily moved, 305 –use proxy) 4XX –client error, request failure (403 –forbidden) 5XX –server error (500 –Server Internal Error, 501 –not implemented) 6XX –global failure, busy, refused, not available (606 –Not Acceptable)
For example, the header of message (11) in Stallings DCC8e Figure 24.11 (previous slide) might look as shown.The first line contains the version number of SIP that is used and the response code and name. The lines that follow are a list of header fields. The Via, To, From, Call-ID, and CSeq header fields are copied from the INVITE request. (There are three Via header field values - one added by Alice's SIP UAC, one added by the atlanta.com proxy, and one added by the biloxi.com proxy.) Bob's SIP phone has added a tag parameter to the To header field. This tag will be incorporated by both endpoints into the dialog and will be included in all future requests and responses in this call.
SIP header fields are used to convey message attributes and to modify messagemeaning. They are similar in syntax and semantics to HTTP header fields (infact some headers are borrowed from HTTP) and thus always take the format:Headers can span multiple lines. Some SIP headers such as Via, Contact, Routeand Request-Route can appear multiple times in a message or, alternatively, cantake multiple comma-separated values in a single header occurrence
START-LINE– SIP version used– In requests: address andmethod used– In responses: status code• HEADERS– Information about call• BODY (payload)– Usually SDP messageViacontains the address at which the originator is expecting to receive responses to this request. MandatoryTo contains a display name and a SIP URI towards which the request was originally directed. MandatoryDisplay names are described in RFC 2822From also contains a display name and a SIP URI that indicate the originator of the request. The From also contains a tag parameter which is used for identification purposes. MandatoryCall-ID contains a globally unique identifier for this call. MandatoryCSeq or Command Sequence contains an integer and a method name. The CSeq number is incremented for each new request within a dialog and is a traditional sequence number. MandatoryContact contains a SIP URI that represents a direct route to the originator usually composed of a username at a fully qualified domain name (FQDN). While an FQDN is preferred, many end systems do not have registered domain names, so IP addresses are permitted. The Contact header field tells other elements where to send future requests.Max-Forwards serves to limit the number of hops a request can make on the way to its destination. It consists of an integer that is decremented by one at each hop. Content-Type contains a description of the message body. MandatoryContent-Length contains an octet (byte) count of the message body.
VIA header indicates path takenby the request so farMax-Forwards field must be used with anySIP method• It limits the number for proxies or gatewayson the way of SIP message to the destination.Content-Type and Content-Lengthheader fields• Content-Type: It describes the media type ofthe message body• Content-Length: The number of octets in themessage body– It is mandatory in all SIP messages.
The call flow for SIP sessions depends upon whether the SIP session is established directly between SIP user agents or whether a SIP server (proxy, registrar, or redirect) is located between SIP user agents.Session SetupAlice's UA sends an INVITE message to Bob's SIP address (i.e., 'sip:bob@897s.aarhus.com'). The message content is a Session Description Protocol message describing the expected media exchange.Bob's UA receives the INVITE and responds with a 100 Trying message.The UA then attempts to attract the attention of Bob, and simultaneously sends a 180 Ringing message to Alice.Bob respond and his UA sends a 200 OK message. The 200 OK contains the SDP message Bob is agreeing to.Finally, Alice's UA acknowledges receipt of the OK with an ACK request.Media streams are established directly between Alice and Bob.
The proxy server is a communication midpoint, functioning as both a user server and as a user agent. When acting as a user server the proxy receives the SIP requests and forwards them on to the destination user agent and vice versa when acting as a user agent.