What’s SIP

Introduction

Session Initiation Protocol is used to (set up and terminate voice or video calls of course) establish two-party (unicast) or multiparty (multicast) sessions. It also allows modification of existing calls. The modification can involve changing addresses or ports, inviting more participants, and adding or deleting media streams. SIP has also found applications in messaging applications, such as instant messaging, and event subscription and notification.

SIP works in concert with several other protocols to specify the media format and coding like Session Description Protocol, Real-time Transport Protocol and Secure Real-time Transport Protocol.

They are many network elements that use the protocol called SIP user agents. Each user agent performs the function of a user agent client (UAC) when it is requesting a service function, and that of a user agent server (UAS) when responding to a request. Thus, any two SIP endpoints may in principle operate without any intervening SIP infrastructure. However, for network operational reasons, for provisioning public services to users, and for directory services, SIP defines several specific types of network server elements. Each of these service elements also communicates within the client-server model implemented in user agent clients and servers.

User agent

A user agent is a logical network end-point used to create or receive SIP messages. The user agent manages SIP sessions. As a client (UAC), it sends SIP requests, and as a server (UAS) it receives requests and returns a SIP response. Unlike other network protocols that fix the roles of client and server, e.g., in HTTP, in which a web browser only acts as a client, and never as a server, SIP requires both peers to implement both roles. The roles of UAC and UAS only last for the duration of a SIP transaction.
A SIP phone is an IP phone that implements client and server functions of a SIP user agent and provides the traditional call functions of a telephone, such as dial, answer, reject, call hold, and call transfer.(1) (2) SIP phones may be implemented as a hardware device or as a softphone. As vendors increasingly implement SIP as a standard telephony platform, the distinction between hardware-based and software-based SIP phones is blurred and SIP elements are implemented in the basic firmware functions of many IP-capable devices.
In SIP, as in HTTP, the user agent may identify itself using a message header field (User-Agent), containing a text description of the software, hardware, or the product name. The user agent field is sent in request messages, which means that the receiving SIP server can evaluate this information to perform device-specific configuration or feature activation. Operators of SIP network elements sometimes store this information in customer account portals,(3) where it can be useful in diagnosing SIP compatibility problems or display of service status.

Proxy server

A proxy server is a network server with UAC and UAS components that functions as an intermediary entity to perform requests on behalf of other network elements. A proxy server primarily plays the role of routing, meaning that its job is to ensure that a request is sent to another entity closer to the targeted user. Proxies are also useful for enforcing policy, such as for determining whether a user is allowed to make a call. A proxy interprets, and, if necessary, rewrites specific parts of a request message before forwarding it.

Registrar

A registrar is a SIP endpoint that provides a location service. It accepts REGISTER requests, recording the address and other parameters from the user agent. For subsequent requests it provides an essential means to locate possible communication peers on the network. The location service links one or more IP addresses to the SIP URI of the registering agent. Multiple user agents may register for the same URI, with the result that all registered user agents receive the calls to the URI.
SIP registrars are logical elements and are often co-located with SIP proxies. To improve network scalability, location services may instead be located with a redirect server.

Redirect server

A redirect server is a user agent server that generates 3xx (redirection) responses to requests it receives, directing the client to contact an alternate set of URIs. A redirect server allows proxy servers to direct SIP session invitations to external domains.

Session border controller

Session border controllers serve as middle boxes between UA and SIP servers for various types of functions, including network topology hiding and assistance in NAT traversal.

Gateway

Gateways can be used to interconnect a SIP network to other networks, such as the public switched telephone network, which uses different protocols or technologies.

SIP Messages

There are two different types of SIP messages: requests and responses. 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.(4) The first line of a response has a response code.

Requests

Main article: List of SIP request methods
Requests initiate a SIP transaction between two SIP entities for establishing, controlling, and terminating sessions. Critical methods include the following.

  • INVITE: Used to establish a dialog with media exchange between user agents.
  • BYE: Terminates an existing session.
  • REGISTER: The method implements a location service for user agents, which indicate their address information to the server.

Responses

Responses are sent by the user agent server indicating the result of a received request. Several classes of responses are recognized, determined by the numerical range of result codes:

  • 1xx: Provisional responses to requests indicate the request was valid and is being processed.
  • 2xx: 200-level responses indicate a successful completion of the request. As a response to an INVITE, it indicates a call is established.
  • 3xx: This group indicates a redirection is needed for completion of the request. The request has to be completed with a new destination.
  • 4xx: The request contained bad syntax or cannot be fulfilled at the server.
  • 5xx: The server failed to fulfill an apparently valid request.
  • 6xx: This is a global failure, as the request cannot be fulfilled at any server.

That’s how it looks like:

SIP trunking

If you already fluent in networking it looks similar to a DHCP protocol (CSMA/CD etc.)

SIP Signaling

User1’s UAC uses an invite client transaction to send the initial INVITE (1) message. If no response is received after a timer controlled wait period the UAC may choose to terminate the transaction or retransmit the INVITE. Once a response is received, User1 is confident the INVITE was delivered reliably. User1’s UAC must then acknowledge the response. On delivery of the ACK (2), both sides of the transaction are complete. In this case, a dialog may have been established. (from SIP Introduction).

Conclusion

So, SIP looks very interesting and surely the future of business telephone services, using the internet is impressive and with the time it will be more and more stable with time.
For now, it’s a bit dangerous not because of the security (it’s encrypted) but of the stability.

Example:
We have a telephone and a PC in a house.
The PC is connected to the internet.
At the same time the telephone ring! And the incoming call is taken.
The call will be perfect but the PC will have a lot of packages loss (the call will have the priority).

Thank you for your attention it took hours and it’s my first article!
If something isn’t clear let me know and I will try to explain it as soon as possible.