IMS/SIP - PRACK消息什么时候会用到?

PRACK是对PR的ACK消息。Provisional Response ACKnowledgement

PR是什么? Provisional Response ---- 临时响应

那它为什么叫临时响应呢?顾名思义,就是说这个响应只是暂时的,并不是最终session成功建立的响应消息。因为确认最终session建立的那个响应叫最终响应(Final Response), 最终响应的例子就是回复INVITE消息的200 OK消息。

临时响应的例子是180Ringing.

PRACK就是用于Proivisional Response的可靠传输,如果没有收到 PRACK,PR消息将被重传。

PRACK不能应用于“100 Trying ”,只有101~199 临时响应需要可靠传送。

我们来看看协议里对PRACK的解释:4.1.13 PRACK

The PRACK [28] method is used to acknowledge receipt ofreliably transported

扫描二维码关注公众号,回复: 9399807 查看本文章

provisional responses (1xx). The reliability of 2xx, 3xx,4xx, 5xx, and 6xx responses

to INVITEs is achieved using the ACK method. However, incases where a

provisional response, such as 180 Ringing, is critical indetermining the call state,

it may be necessary for the receipt of a provisionalresponse to be confirmed.

The PRACK method applies to all provisional responsesexcept the 100 Trying

response, which is never reliably transported.

(PRACK是用于回应已经接收到了可靠的“transportedprovisional response(1xx)”,

而对于响应invite的2xx/3xx..的response消息可靠性,则通过ACK消息来保证。然后,

对于180 ringing这样的对呼叫状态的决定非常关键的provisional response,

确认收到这种response可能是必须的。)

A PRACK is generated by a UAC when a provisional responsehas been received

containing an RSeq reliable sequence number and a Supported:100rel header.

The PRACK echoes the number in the RSeq and the CSeq ofthe response

in a RAck header. The message flow is asshown in Figure 4.11. In this example,

the UAC sends the 180 Ringing responsereliably by including the RSeq header.

When no PRACK is received from the UAC afterthe expiration of a timer(an “X”

is used to represent a lost message),the response is retransmitted. The receipt

of the PRACK confirms the delivery of theresponse and stops all further transmissions.

The 200 OK response to the PRACK stopsretransmissions of the PRACK request.

(最关键的部分来了,到底要不要PRACK,看收到的消息是否有Rseq!!!!!!)

 我们来看一个消息log例子:

//手机接收到对端发过来的RINGING,该消息里携带Rseq

2016 Sep  2  05:18:19.643 [BA]  0x156E  IMS SIP Message  --  IMS_SIP_INVITE/RINGING

Version = 1

Direction = NETWORK_TO_UE

SDP Presence = 0

SIP Call ID Length = 62

SIP Message Length = 968

SIP Message Logged Bytes = 969

Message ID = IMS_SIP_INVITE

Response Code = RINGING (180)

CM Call ID = 11

SIP Call ID =1482489267_2360040920@2409:8809:8530:857d:c575:f266:2aa0:dc24

Sip Message = SIP/2.0 180 Ringing

Via: SIP/2.0/TCP [2409:8809:8530:857D:C575:F266:2AA0:DC24]:8904;branch=z9hG4bK1019613377

Record-Route:<sip:[2409:8019:8430:4500:0000:0000:0000:0008]:9900;transport=tcp;lr;Hpt=8f62_116;CxtId=3;TRC=ffffffff-ffffffff;X-HwB2bUaCookie=14559>

Call-ID:1482489267_2360040920@2409:8809:8530:857d:c575:f266:2aa0:dc24

From:<sip:[email protected]>;tag=1482489276

To:<tel:15914177445;phone-context=ims.mnc000.mcc460.3gppnetwork.org>;tag=55116ypd

CSeq: 408747442INVITE

Allow:INVITE,ACK,OPTIONS,BYE,CANCEL,INFO,PRACK,NOTIFY,MESSAGE,REFER,UPDATE

Contact:<sip:[2409:8019:8430:4500:0000:0000:0000:0008]:9900;Hpt=8f62_16;CxtId=3;TRC=ffffffff-ffffffff>

Require: 100rel

RSeq: 2

P-Early-Media: sendonly

P-Access-Network-Info:  3GPP-E-UTRAN;utran-cell-id-3gpp=46000286633BFE84;sbc-domain=sbc04.0755.gd.chinamobile.com;ue-ip=[2409:8809:8530:857D:C575:F266:2AA0:DC24];ue-port=8005;network-provided

Content-Length: 0

 //手机回复PRACK消息

2016 Sep  2  05:18:19.671 [47]  0x156E  IMS SIP Message  -- IMS_SIP_PRACK/INFORMAL_RESPONSE

Version = 1

Direction = UE_TO_NETWORK

SDP Presence = 0

SIP Call ID Length = 62

SIP Message Length = 906

SIP Message Logged Bytes = 907

Message ID = IMS_SIP_PRACK

Response Code = INFORMAL_RESPONSE (0)

CM Call ID = 11

SIP Call ID =1482489267_2360040920@2409:8809:8530:857d:c575:f266:2aa0:dc24

Sip Message = PRACKsip:[2409:8019:8430:4500:0000:0000:0000:0008]:9900;Hpt=8f62_16;CxtId=3;TRC=ffffffff-ffffffffSIP/2.0

i:1482489267_2360040920@2409:8809:8530:857d:c575:f266:2aa0:dc24

f:<sip:[email protected]>;tag=1482489276

t:<tel:15914177445;phone-context=ims.mnc000.mcc460.3gppnetwork.org>;tag=55116ypd

CSeq: 408747444 PRACK

P-Access-Network-Info: 3GPP-E-UTRAN-TDD;utran-cell-id-3gpp=46000286633BFE84

l: 0

v: SIP/2.0/TCP[2409:8809:8530:857d:c575:f266:2aa0:dc24]:8904;branch=z9hG4bK3379790848

Max-Forwards: 70

Security-Verify:ipsec-3gpp;alg=hmac-md5-96;prot=esp;mod=trans;ealg=null;spi-c=2643107290;spi-s=3412854899;port-c=9950;port-s=9900

RAck: 2 408747442 INVITE

Route:<sip:[2409:8019:8430:4500:0000:0000:0000:0008]:9900;transport=tcp;lr;Hpt=8f62_116;CxtId=3;TRC=ffffffff-ffffffff;X-HwB2bUaCookie=14559>

Proxy-Require: sec-agree

Require: sec-agree

k: timer

---------------------------------
 

发布了421 篇原创文章 · 获赞 44 · 访问量 11万+

猜你喜欢

转载自blog.csdn.net/ZhongGuoRenMei/article/details/103816533
sip