You are on page 1of 40

Next Generation Networks

Lectures 6, 7, 8
Session Initiation Protocol (SIP)
Session Initiation Protocol (SIP)
• An application layer signaling protocol that
– Initiation
– Modification and
– Termination
of interactive, multimedia communication sessions
between users.
Session Initiation Protocol (SIP) (cont.)
• The architecture of SIP is similar to that of HTTP (client-server

• Requests are generated by the client (caller’s phone) and sent to

the server (called phone).

• The server processes the requests and then sends a response to the

• A request and the responses for that request make a transaction.

• SIP has INVITE and ACK messages which define

– the process of opening a reliable channel over which call control
messages may be passed.
Session Initiation Protocol (SIP) (cont.)
• The services that SIP provide include:
– User Location: determination of the end system to
be used for communication
– Call Setup: ringing and establishing call
parameters at both called and calling party
– User Availability: determination of the willingness
of the called party to engage in communications
– User Capabilities: determination of the media and
media parameters to be used
– Call handling: the transfer and termination of calls
Components of SIP
• The SIP System consists of two components

1. User Agents:
– A user agent is an end system acting on behalf of a user.
– An endpoint can initiate, modify, or terminate a session.
– It could be a softphone, a mobile, or a laptop.

There are two parts to it: a client and a server.

• The client portion is called the User Agent Client (UAC)

• while the server portion is called User Agent Server (UAS).
• SIP Phones act both as UAS and UAC.
– Softphones (PCs that have phone capabilities installed) and SIP
phones can initiate SIP requests and respond to requests.
Components of SIP (cont.)
• The SIP System consists of two components

2. Network Servers:
There are 3 types of servers within a network.

• A registration server (Registrar)

• A proxy server

• A redirect server
User Agents
User Agent Client (UAC)
• End systems
• Send SIP request
• An entity that initiates a call

User Agent Server (UAS)

• Listen for call requests
• Prompts user or execute program to determine response
• An entity that receives a call

Both UAC and UAS can terminate a call

Proxy Server
• It is the network element that takes a request
from a user agent and forwards it to another
– Basically the role of a proxy server is much like a
– It has some intelligence to understand a SIP request
and send it ahead with the help of URI.
– A proxy server sits in between two user agents.
– There can be a maximum of 70 proxy servers in
between a source and a destination.
Registrar Server
• The registrar server accepts registration
requests from user agents.

• It helps users to authenticate themselves

within the network.

• It stores the URI and the location of users in a

database to help other SIP servers within the
same domain.
Registrar Server (cont.)
• For example,
– A caller wants to register with any domain.
– It needs to send REGISTER request to that
domain’s Registrar server and
– the server returns a 200 OK response as it
authorized the client.
Redirect Server
• The redirect server
– Accepts a SIP request
– looks up the intended recipient of the request in
the location database created by the registrar.
– Returns the addresses to the client.

• The redirect server uses the database for

getting location information and
– responds with Redirect response to the user.
Location Server

• A location server is used by:

– Redirect Server or
– Proxy Server

• To obtain information about a called party’s

possible location(s).
Establishing a Session
• The figure depicts the roles played by each of
the network elements in establishing a
Basic Call Flow
• Figure shows the basic call flow of a SIP
Basic Call Flow (cont.)
• An INVITE request that is sent to a proxy server is responsible for initiating
a session.

• The proxy server sends a 100 Trying response immediately to the caller
(Alice) to stop the re-transmissions of the INVITE request.

• The proxy server searches the address of Bob in the location server. After
getting the address, it forwards the INVITE request further.

• Thereafter, 180 Ringing (Provisional responses) generated by Bob is

returned back to Alice.

• A 200 OK response is generated soon after Bob picks the phone up.

• Bob receives an ACK from the Alice, once it gets 200 OK.
Basic Call Flow (cont.)
• At the same time, the session gets established and RTP packets
(conversations) start flowing from both ends.

• After the conversation, any participant (Alice or Bob) can send

a BYE request to terminate the session.

• BYE reaches directly from Alice to Bob bypassing the proxy server.

• Finally, Bob sends a 200 OK response to confirm the BYE and the
session is terminated.

• The complete call (from INVITE to 200 OK) is known as a Dialog.

Messages (Methods)
• SIP messages are of two types − requests and responses.

• INVITE is used to initiate a session with a user agent.

• In other words, an INVITE method is used to establish a media

session between the user agents.

• INVITE can contain the media information of the caller in the

message body.

• A session is considered established if an INVITE has received a

success response(2xx) or an ACK has been sent.
Messages (Methods) (cont.)
• BYE is the method used to terminate an established session.

• This is a SIP request that can be sent by either the caller or the
callee to end a session.

• It cannot be sent by a proxy server.

• BYE request normally routes end to end, bypassing the proxy server.

• BYE cannot be sent to a pending an INVITE or an unestablished

Messages (Methods) (cont.)
• REGISTER request performs the registration of a user
agent. This request is sent by a user agent to a registrar

• CANCEL is used to terminate a session which is not
established. User agents use this request to cancel a
pending call attempt initiated earlier.

• It can be sent either by a user agent or a proxy server.

Messages (Methods) (cont.)
• ACK is used to acknowledge the final responses to an INVITE method.

• An ACK always goes in the direction of INVITE.

• OPTIONS method is used to query a user agent or a proxy server about its
capabilities and discover its current availability.

• The response to a request lists the capabilities of the user agent or server.

• A proxy never generates an OPTIONS request.

• Used to carry DTMF (Dual tone multi-frequency) signaling
Messages – Response Codes
• A SIP response is a message generated by UAS or SIP server
to reply a request generated by a client.
– It could be a formal ack to prevent retransmission of requests by
a UAC.

• A response may contain some additional header fields of

info needed by a UAC.

• SIP has six responses.

– 1xx to 5xx has been borrowed from HTTP and 6xx is introduced
in SIP.
– 1xx is considered as a provisional response and the rest
are final responses.
Messages – Response Codes (cont.)

S.No. Function and Description

1xx: Provisional/Informational Responses
Informational responses are used to indicate call progress.
Normally the responses are end to end (except 100 Trying).
2xx: Success Responses
This class of responses is meant for indicating that a request has
been accepted.
3xx: Redirect Responses
Generally these class responses are sent by redirect servers in
response to INVITE.
They are also known as redirect class responses.
Messages – Response Codes (cont.)
S.No. Function and Description
4xx: Client Failure Responses
Client error responses indicate that the request cannot be fulfilled
as some errors are identified from the UAC side.
400-Bad Request, 401-Unauthorized
5xx: Server Failure Response
This class response is used to indicate that the request cannot be
processed because of an error with the server.
500-Server internal error, 502-bad gateway
6xx: Global Failure Response
This response class indicates that the server knows that the
request will fail wherever it is tried.
As a result, the request should not be sent to other locations.
600-Busy everywhere, 604-Doest not exist anywhere
SIP Messages
Methods and Responses
SIP Devices in a SIP Network
• Introduce the 12 key components
– Start with basic SIP call
– Highlight needs
– Introduce devices that satisfy needs
Need 1: Users need to communicate
over an IP network
• Two users need to communicate over an IP
• What tool do they use?
• User Agents
– Endpoint devices through which sessions are managed
– Signaling exchange
– Media exchange
• UA on one side capture & encode media, send it over the IP
– On the other side: UA decodes and represents it to the user
Need 2: UAs discover each other’s IP
• Like all IP devices, UAs sends IP packets to IP
address of the called user.
– BUT what if the UA does not have the called UA IP

• How it is done?
– With these 4 SIP entities
• Registrar services
• Location services
• SIP Registry (DB)
• Proxy Server
Need 2: UAs discover each other’s IP
addresses (cont.)
• As the other user B logs in, his UA sends its IP
address (sip:
– along with his Public Dial Address (Address-of-record), to the Registrar server which
stores them in the SIP registry (DB).

• Then when user A sends an invitation signal, not

to user B’s phone but to user A’s provider’s
Location server.
– It then queries the SIP registry (DB) to retrieve the
dialed party’s (user B) IP address and proxies the
INVITE signal to UA B.
Need 2: UAs discover each other’s IP
addresses (cont.)
Need 3: Features that enhance the
communication experience
• How do we get these extra features?
– Through feature servers

• For example, Call Forwarding: Out of office today. Forward

my calls to cellphone.

• Call forwarding can be simply done by Proxy Server,

– but the architecture of SIP is distributed (not dependent on a
single device for everything).

• For this reason, the application logic has been moved to a

separate device (Feature Server) and
– The routing logic is maintained in the Proxy Server.
Need 3: Features that enhance the
communication experience (cont.)
• That way we can add as many feature servers as we want. It gives
– Complete Flexibility
• Easy to upgrade
• Easy to add new features
– No dependency on a single vendor for features

• So in case of call forwarding, when the INVITE message arrives at

the proxy server, the proxy server checks the routing rules and this
time routes the INVITE to call forwarding feature server.

• The feature server after using its logic and checking the callee’s
profile, modifies the destination address inside the INVITE message,
and routes the call to the cellphone through the Proxy server.
Need 4: Calls between users on
different domains
• So far, caller and callee belong to same domain,
i.e. and
– Both registered with same registrar
– Both IP addresses stored in the same registry
– Both use same location server
– Feature routing applied by the same proxy server

• But what if we want to call someone on a

different domain?
Need 4: Calls between users on
different domains (cont.)
• The reality is that there will be many many
different domains,
– Each with their own Proxy server, Registrar and
location services, Registry, and most probably with
their own Feature and Media servers.
Need 4: Calls between users on
different domains (cont.)
• Now like before the caller’s INVITE message
arrives the Proxy,
– But this time instead of checking the Registry, the
Proxy task is now to find the other domain’s Proxy
server and route this message downstream.

• How?
– The same way all IP devices locate another
domain with a lookup into the Internet standard
Domain Name System (DNS).
Need 4: Calls between users on
different domains (cont.)
• After a quick DNS lookup,
– The INVITE is proxied to the
domain’s Proxy server,
– where just like before its SIP location server
retrieves the IP address from the Registry,
– and Proxies the INVITE onto the phone.
Need 5: Provide forwarding
• Now there might be times when the callee has
perhaps moved to another domain and the call
arrives for that moved user.

• The proxy server of the previous domain might

want to provide the forwarding address but
without getting involved in call signaling.

• In fact, that’s need 5

– The ability for proxy server to provide forwarding
Need 5: Provide forwarding
information/addresses (cont.)
• How?
– Through the Redirect server.

• Having received INVITE for someone who has

moved from the domain,
– The Redirect server simply passes back upstream,
the called party’s forwarding address
– Allowing the upstream device to re-route to that
Need 6: Communication with non-SIP
• Finally, what about a need for a SIP user to
communicate with a non-SIP user, perhaps a
traditional user on a good old PSTN?

• How?
– Signaling Gateway
– Media Gateway
Need 6: Communication with non-SIP
users (cont.)
• Signaling Gateway
– Signaling protocol translator
– SIP & SS7
• Takes SIP INVITE message on one side and constructs
equivalent SS7 IAM message on the other side
• When SS7 ACM/AMN message comes back, it translates
them back into equivalent SIP responses before sending
them through the SIP network
Need 6: Communication with non-SIP
users (cont.)
• Media Gateway
– Different networks use different codes to encode
their media?
– Incompatible?
– It transcodes media