Search This Blog

Tuesday, 19 November 2019

SIP Overview

 SIP Protocol Overview


         
               SIP is signalling protocol used to Initiate,Modify and Tear down the Voice and Video sessions.

             SIP is and application layer protocol (also called Signalling/Text- based protocol). It is designed by IETF. Sip was initially focused on Voice Communication  and later expanded to Video, Instant messaging.....etc. SIP carries media transport through the RTP/ RTCP, SRTP. 

         
SIP MESSAGES

Sip Messages ae divided into two types:

  1. Sip Requests --> sent from client to sever.
  2. Sip Responses -->sent from server to client.

Message Syntax:

        Start line
        Message header
              CRLF- Carriage return line feed.
        Message body(SDP-Session Describestion Protocol ).

Message header:  It provides additional information, regarding requests and responses.

CRLF    : Empty line after header field.

Message body( SDP) : Normally describes the type of session to be established,including a description of media to be exchanged.


Start Line:
    Start line can be request line or status line. Sip Requests start line:
   Syntax: Method Sp Request URISp SIP version
     Ex:  Invite  sip:bob@billoxi.com  sip/2.0

Sip Response start line:
  Syntax:Sip version Sp Response code Sp       Responpharse
 Ex: sip/2.0  200   OK

Message header Syntax:
        
         Via
         To
         From
         Call Id
         C-seq
         Max-forward
         Contact

Message Body Syntax:

          V- Version SDP = 0
          O- Owner  = IPv4
          S- Session name = VOIP
          T- Time= Start and stop time
         M- Media =Audio/ Video
         A- Attributes =Send only/Recv only    
                

  • REQUESTS:   
  1.  Invite: It indicates client is invited to participate in call session.
  2. Ack: It confirms client has received final response to invite request.
  3. Bye: Terminates the call and can be sent by either caller or callee. 
  4. Cancel: Cancels any pending request.
  5. Options: Queries the capabilities of server.
  6. Register: Registers the address listed in to header field with a Sip server.
  7. Prack: Provisional Acknowledgement.
  8. Refer: Asks recipient to issue SIP request.
  9. Notify: Notify the subscriber of a new event.
  10. Subscribe:Subscribes for an event of notification from the notifier.
  11. Info : Sends mid-session information.
  12. Message:Transports instant messages using SIP.
  13. Update: Modifies the state of a session without changing.
  14. Publish: Publish an event to the server.  

  • RESPONSES:

        
       1XX  -  Information Responses
       2XX -   Successful Responses
       3XX  -  Redirection Responses
       4XX -   Client failure Responses
       5XX  -  Server failure Responses
       6XX  -  Global failure Responses

        Examples:
             
       100  -  Trying
       180  -  Ringing
       181  -  Call being forwarded
       183  -  Session in progress
       200  -  Ok
       202  -  Accepted
       301  -  Moved permanently
       302  -  Moved temporarily
       401  -  Unauthorized
       404  -  Not found
       483  -  Too Many Hops
       486  -  Busy here
       407  -  Proxy authentication required
       408  -  Request timeout
       487  -  Request terminated
       491  -  Request pending
       503  -  Service unavailable
             


EXPLANATION OF MESSAGE HEADER Fields:

VIA: It contains the address at which user is expecting to receive response to this  request. 
The Via header field value MUST contain a branch parameter

  • This parameter is used to identify the transaction created by that request.
  • It helps proxies to detect loops.
 The branch parameter value MUST be unique across space and time for all requests sent by the UA. The exceptions to this rule are CANCEL and ACK for non-2xx responses. As discussed below, a CANCEL request will have the same value of the branch parameter as the request it cancels.
* The branch ID inserted by an element always begin with the characters "z9hG4bK". These 7 characters are used as a "Magic cookie"

FROM :It contains display name and SIP URI that indicates the originator of the  request. The From field MUST contain a new "tag" parameter, chosen by the UAC.

TO : It contains the display name and SIP URI towards which request was originally directed. A request outside of a dialog MUST NOT contain a To tag; the tag in the To field of a request identifies the peer of the dialog. Since no dialog is established, no tag is present.

TAG : Tag in 'To' header are of no help since they are not known until response arrive. 
An initial request from a client will contain a From Tag and the subsequent provisional response to it from the server will contain a To Tag.  

  • Tags are used by the UAC to distinguish multiple final responses from different  UAS.

                               
CALL-ID: It contains a globally unique identifier for all requests and responses sent by either UA in a dialog,generated by the combination of random string and IPaddress.Note that when request are retried after certain failure, These retried requests are not considered new requests,and therefore do not need new Call-ID.

* Implementations MAY use the form "loclid@host".
* It provides some protection against session hijacking and reduces.

CALL LEG : The combination of to tag, From tag and call ID is called call leg/peer to  peer  connection.

C- SEQ :It contains an sequence number and method Name. The c-seq is incremented for  each new request.
* It is used to identify and order transactions.

CONTACT :It contains a SIP URI that represents the direct route to contact user.

MAX-FORWARD:It serves to limit the number of hops a request can make on the way to destination. If the Max-Forwards value reaches 0 before the request reaches its destination, it will be rejected with a 483(Too Many Hops) errors response.

CONTENT LENGTH :
It contains an octet(byte) count of the message body.

CALLER ID:It is provided by the From SIP header containing the caller's name and number.

RECORD ROUTE: Record route header is inserted into requests by proxies that want to be in the  path of subsequent request for the same call-id. It is then used by user agent to route subsequent requests.





  Difference between H.323&SIP

                                                                
1. H.323 :It is designed by ITU                        
    SIP     :It is designed by IETF.
                             
2.  H.323 : H.323 is limited to conferencing.It define the basic set of funtionality that all devices                                       must support.
     SIP    :  SIP was initially focused ib voice connection and then expanded to video,instant messaging..etc

3.  H.323 : Has defined a number of features to handle failures of N/W entities
     SIP     :  Has not defined for handling device failure. user agent has to send re-Invite.

 4.  H.323 : Encodes messages in a compact binary format.
      SIP     : Sip messages are encoded in ASCIT text format.

 5.  H.323 :  Media transport RTP/RTCP,SRTP.
       SIP     :  Media transport RTP/RTCP, SRTP.

  6. H.323 :  Addressing H.323 support these aliases:
                     * E.164 dialed digits
                     * Transport address
                     * Email address
                     * Party number
       SIP    :  SIP only understand URI- Style addresses.

  7. H.323 :  Call setup :  Setup Connect  Ack
      SIP      :  Call setup :  Invite 200Ok  Ack

  8.  H.323  :  H.323 fully support video and data conferencing.
       SIP      :  SIP has limited support for video and no support for data conferencing.

   9.  H.323 :  H.323 Support any codec standedized or propretory.
        SIP     :  SIP supports IANA registered codec.

  10.  H.323 : Most H.323 entities use a reliable transport for signalling.
         SIP     : Most SIP entities uses an unreliable transport for signalling.

  11.  H.323 : Routing gatekeepers can detect loops by looking at call identifier and destination address.
         SIP     : The via header facilitates detecting loops.

  12 . H.323 : Minimum ports for VOIP call 3  ( call signalling, RTP, RTCP )
         SIP     : Minimum ports for VOIP call 3  ( SIP, RTP, RTCP )


***************************<><><><><><><>***********************************


No comments:

Post a Comment

REST API

  API  is an application programming interface. It is a set of rules that allow programs to talk to each other. The developer creates the AP...