Analysis of SIP packages

Source: Internet
Author: User

Today, I encountered the capture and analysis of the SIP packets between the two devices. Then, combined with the instructions in rfc3261 documents, I recorded what I understood today.

1. SIP protocol:
The detailed RFC documentation for SIP can be found at: rfc3261
Session Initiation (Session Initiation Protocol) allows the use of internet endpoints (User proxies) to find participants and allow the creation of a shared session description. SIP allows you to create a basic networkhosts (called a proxy server), and allows end users to register, Send Session invitations, or send other requests. It can be used to create, modify, and terminate a session. It operates independently under the communication protocol and
Does not depend on the established session type.
SIP is not a vertically integrated communication system. SIP may be called a part. It is more appropriate that sip should work with other protocols to provide complete services for end users. Although basic sip functional components do not depend on these protocols.
SIP itself does not provide services. However, SIP provides a basis for implementing different services.

2. SIP implementation
Each sip endpoint has a user name, that is, the ID number indicating its identity. Through its ID, you can call the other party. for example, in IP phone A, you can use this ID to represent the other device: SIP: 0502004@192.168.2.30. the phone number, followed by the IP address.
Of course, the above ID form is just a codename defined by each other, you can use shi@web.com to table
Indicates its ID.

SIP is a communication mode based on HTTP-like request response. Each communication includes a
Successful request, and at least one response is required.
for example, IP Phone a requires a request: Request: register
192.168.2.13 (phone a-> server) When registering the SIP server)
the SIP server must give a response: Status: 200 OK (server-> phone a)
for example, if phone a wants to communicate with phone B, first, call a sends a request to the SIP server and requests the server to connect the server to call B. Then, another request is required.
For example: Request: Invite SIP: 0502004@192.168.2.13 (phone a-> server)
the server must also give it a response: Status: 100 trying. (server-> phone a) indicates that the server
is trying to contact it.
at this time, the server finds phone B and sends a request to phone B to tell it that someone is looking for you. are you free?
request: Invite SIP: 015B0081587310007000D0000C578@192.168.2.40 (server
-> phone B)
at this time, if phone B happens to be empty (non-disconnected ), the server will be answered, saying, null! Please
ask him to come to me!
call B will give two responses to the server: Status: 100 trying/status: 180 ring
after the server receives the response, it will send a response to call. status: 180 ring. At this time, the status of phone a
indicates that the bell rings.
When phone a is disconnected, there is a call between phone A and phone B. At this time, phone B sends a response to the server.
send the call to phone.
Status: 200 OK
at this time, all the preparations for the call are completed, and only the RTP voice package is transferred between two phones.
enter, the SIP package will also come out from time to time for mediation to see if there is any abnormal status.
when the last party hangs up, the server initiates another mediation and sends a request to the other Party:
request: Bye SIP: 015B0081587310007000D0000C578@192.168.2.40
and the other side returns a response: Status: 200 OK
the call is complete!

All these SIP messages are attached to the UDP packet for transmission. The ethereal packet capture tool shows the status in detail.
The following is an example of a request to connect to a SIP package:

We can see that the SIP package has three main parts: Request-line (request information), message header (message header of the SIP package ), message Body (Message Body of the SIP package ).

Note the following: Via The domain tells you where the request is sent and where it is responded, Contract The domain tells you where future requests will be sent. To and from indicate the host to which the package is next and where the request comes from.
Call-IDContains a globally unique identifier used to uniquely identify a call. Softphone Or IP Resist mixed production.
Pass To tag, from tag And Call-ID Complete definition Both Ends Between end-to-end SIP Link, which indicates a conversational relationship.

As for the message body. media type, codec Or the sampling rate.

3. A specific sip package sent by the first two phones in the formal call.
Ethereal:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.