Analysis of SIP Packets

Source: Internet
Author: User

Today the work encountered two devices between the SIP packet crawl and analysis, and then combined with the RFC3261 document description, recorded today understand.

1.SIP Protocol:
Detailed RFC documentation for SIP is visible: rfc3261
Session initiation, which allows you to use Internet endpoints (user agents) to find participants and allow you to create a shareable session description. SIP allows the creation of the underlying networkhosts (called a proxy server) and allows the end user to register, issue a session invitation, or make other requests. Can be used to create, modify, and terminate sessions, which operate independently of 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 more appropriate, and SIP should work with other protocols to provide complete service to end users. Although the functional components of the basic SIP protocol do not depend on these protocols.
SIP itself does not provide services. However, SIP provides a foundation that can be used to implement different services.

2.SIP implementation
Each SIP endpoint has a user name, which is the ID number that represents its identity, which can be called by its ID. For example, in IP phone A, you can use this ID to indicate the other device: sip: [email protected]. The front represents the phone number, is its IP address.
Of course, the form of the above ID is just a code of each other, you can use [email protected] to table
Display its ID.

SIP is a communication pattern that is based on a request response similar to an HTTP protocol. Each communication consists of a function
Request, and at least one response is required.
For example, IP phone a requires a request during the registration of a SIP server: Request:register
192.168.2.13 (Phone a-> server)
The SIP server must give an answer: status:200 OK (server, phone a)
Another example, phone a if you want to talk to phone B, first, phone A to the SIP server a request, request the server to help it connect to phone B, then this time a request.
Example: Request:invite sip: [email protected] (phone a-> server)
The server must also give it a response: status:100 Trying. (server, phone a) indicates service
The device is trying its best to get it connected.
At this time, the server found phone B, just give phone b a request, tell it, someone wants to find you. Are you free?
Request:invite SIP:[email protected](Server
Telephone b)
At this time, if phone B happens to have a free (non-call disconnection status), will answer the server, said, empty! Ask you
Go and ask him to come to me!
Phone B will give two answers to the server: status:100 trying/status:180 Ring
After the server receives the answer, it sends a reply to phone A. status:180 ring, this time call a
Indicates a ringing status.
When phone A is off, phone A and phone B have a call, and at this point, phone B gives the server a response,
Get him to call a.
status:200 OK
When all the preparations for the call were completed, only the RTP voice packet was sent between the two phones
Lose, of course, SIP packets will come out from time to time to mediate, to see if there is an abnormal state.
The last party hangs up, then the server makes a mediation work and sends a request to the other party:
Request:bye SIP:[email protected]
And the other one replies: Status:200 OK
Call Complete!

These SIP messages are attached to the UDP packet to complete the transmission, through the ethereal truncation tool, you can see its status in detail.
The following is a legend for a SIP package that requests connections:



As you can see, the SIP packet has three main parts: Request-line (which is the request information), the message header (SIP packet header), message body (SIP package).

Here are a few things to note: The via domain tells you where this request is sent and where it is answered, and thecontract domain tells you where the future requests will be sent. To and from indicate which host the package is next to, and where it comes from.
Call-id contains a global, unique flag used to uniquely flag this call, which is generated by a random string and Softphone's own name or IP boycott.
through to tag, the from tag and Call-id completely define the end-to-end sip relationship between the ends and indicate that this is a dialog-related relationship.

As for the subject of the message. It describes the type of media,codec, or sample rate.




3. A specific SIP packet issued by two phone calls before the official call.
Ethereal

Analysis of SIP Packets

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.