Sip invite Process

Source: Internet
Author: User

We know that the SIP session process is very important in the SIP Protocol process. Let's take a closer look at the content of requests and replies. We will explain the meanings of some fields sent through the sip invite.

SIP INVITE

The caller Tesla first initiates the INVITE message to the called party Marconi. The INVITE message contains the session type and some call parameters. The session type may be pure speech, multimedia videos used for network meetings, or game sessions. The following is a message body example. We will analyze the meaning of each field in detail.

INVITE sip: marconi@radio.org SIP/2.0
<= Request method, Request address Request-URI), and SIP version number are all SIP/2.0)
<= The request address is generally the called address, which is similar to the e-mail address of a friend in MSN.

Via: SIP/2.0/UDP lab.high-voltage.org: 5060; branch = z9hG4bKfw19b
<= SIP version 2.0), transmission UDP), call address,
<= Branch is a random code, which is considered as a transport identifier.
<= The address in the Via field is the device address of the message sender or proxy forwarder, which generally consists of the host address and port number.
<= The transmission type can be UDP, TCP, TLS, or SCTP.

Max-Forwards: 70
<= Maximum number of hops, that is, the number of hops that pass through the SIP server, mainly to prevent cyclic hops
<= This integer minus one for each Proxy Server

To: G. Marconi <sip: Marconi@radio.org>
From: Nikola Tesla <sip: n.tesla@high-voltage.org>; tag = 76341
<= Indicates the sender and target of the Request Message
<= If there is a user name label in it, the address must be enclosed in angle brackets.
<= For INVITE messages, you can include tags in the From field, which is also a random code.

Call-ID: 123456789@lab.high-voltage.org
<= The call ID is generated by a local device and is globally unique. This value is unique for each call.
<= If the user agent sends an INVITE message, a globally unique From tag and Call-ID code is generated locally, and the called Agent generates a globally unique To tag code. These three random codes are used as the dialog mark dialog indentifier in the entire conversation.

CSeq: 1 SIP INVITE
<= CSeq, also called Command queue Seqence). Each time a new request is sent, this number is automatically increased by 1.
* The preceding fields are required for all SIP Message bodies. Other header fields are optional, and some are required for specific requests.

Subject: About That Power Outage...
Contact: <sip: n.tesla@lab.high-voltage.org>
<= Contact is required for INVITE messages and is used to route to the called device address, also known as the user agent UA)
Content-Type: application/sdp
Content-Length: 158
<= The last two affiliated fields indicate the message body type and field length.

V = 0 <= SDP version number, which is currently 0
O = Tesla 2890844526 2890844526 IN IP4 lab.high-voltage.org <= source address, type, etc.
S = Phone Call <= topic
C = IN IP4 100.101.102.103 <= connection
T = 0 0 <= Timestamp
M = audio 49170 RTP/AVP 0 <= Media
A = rtpmap: 0 PCMU/8000 <= media attributes

<= We can obtain the following information from the above SDP message body:
<= Connection IP Address: 100.101.102.103
<= Media Format: audio
<= Port: 49170
<= Media transfer type: RTP
<= Media Encoding: PCM u Law
<= Sampling rate: 8000Hz

180 Ringing

After the called party receives the sip invite request message, it will reply to 180 Ringing. As the name suggests, it is to send a return tone, prompting that the caller's phone is connected and waiting for the called response. After the callee receives the INVITE message, it will also have a bell or other incoming prompts. This is set by the callee so that we can think of it as our own phone ringtone ). For 180 responses, also known as "timely response of messages", it is a response used to test the called status. Therefore, it does not contain much information. The specific 180 response message is as follows:

SIP/2.0 180 Ringing
Via: SIP/2.0/UDP lab.high-voltage.org: 5060; branch = z9hG4bKfw19b
; Received = 100.101.102.103 <= here, a received parameter is added to identify the IP address of the receiver.
To: G. Marconi <sip: marconi@radio.org>; tag = a53e42 <= as mentioned above, To tag is the callee identifier
From: Nikola Tesla <sip: n.tesla@high-voltage.org>; tag = 76341 <= the sender From tag must be consistent
Call-ID: 123456789@lab.high-voltage.org
CSeq: 1 INVITE
Contact: <sip: marconi@tower.radio.org>
Content-Length: 0
<= For the 180 Ringing response, the content of INVITE Via, To, From, Call-ID, and CSeq is basically copied. For the first line, mark the SIP version number and respond To code 180) and action reason phrase)
<= Note: here the From and To addresses are used To specify the call direction. Therefore, the 200 OK response here does not reconcile the address and remains unchanged. The difference is that the To header field adds the tag ID generated by the callee Marconi.

200 OK

After the sip invite is called, if the called user Marconi receives the call, the system sends a 200 OK response. In addition to the connection instruction, this response also allows the caller to specify the format of the connected media allowed by the callee to confirm whether the caller can receive the media.

The message body is as follows:

SIP/2.0 200 OK
Via: SIP/2.0/UDP lab.high-voltage.org: 5060; branch = z9hG4bKfw19b
; Received = 100.101.102.103
To: G. Marconi <sip: marconi@radio.org>; tag = a53e42
From: Nikola Tesla <sip: n.tesla@high-voltage.org>; tag = 76341
Call-ID: 123456789@lab.high-voltage.org
CSeq: 1 INVITE
Contact: <sip: marconi@tower.radio.org>
Content-Type: application/sdp
Content-Length: 155
<= The header field is basically the same as the header field.

V = 0
O = Marconi 2890844528 2890844528 IN IP4 tower.radio.org
S = Phone Call
C = IN IP4 200.201.202.203
T = 0 0
M = audio60000 RTP/AVP 0
A = rtpmap: 0 PCMU/8000

<= We can obtain the following information from the above SDP message body:
<= Terminal IP Address: 200.201.202.203
<= Media Format: audio
<= Port: 60000
<= Media transfer type: RTP
<= Media Encoding: PCM u Law
<= Sampling rate: 8000Hz

ACK

The last step before a sip invite call is the caller's confirmation of the 200 OK response. This confirmation proves that the connection is allowed and a media connection is about to start using another protocol. The other protocol is the RTP format negotiated in the above SDP message segment. The ACK response content is as follows:

ACK sip:marconi@tower.radio.org SIP/2.0
Via: SIP/2.0/UDP lab.high-voltage.org:5060;branch=z9hG4bK321g
Max-Forwards: 70
To: G. Marconi <sip:marconi@radio.org>;tag=a53e42
From: Nikola Tesla <sip:n.tesla@high-voltage.org>;tag=76341
Call-ID: 123456789@lab.high-voltage.org
CSeq: 1 ACK
Content-Length: 0

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.