SIP协议之PRACK机制

    SIP PRACK(Provisional Response ACKnowledgement)是由SIP的扩展协议RFC3262定义的,旨在为SIP的临时应答提供传输的可靠性。扩展机制使用选项100rel和临时应答方法PRACK实现。该机制同SIP协议中的2xx对INVITE应答的可靠机制类似。


流程图:


信令流程:

 

编号1:1015呼叫1012
INVITE sip:1012@192.168.0.24:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.201;rport;branch=z9hG4bKrD9r3p90FyNUm
Max-Forwards: 68
From: "1015" <sip:1015@192.168.0.201>;tag=1r000Km00ZmFQ
To: <sip:1012@192.168.0.24:5060>
Call-ID: d897f7d0-21c9-123b-f4a7-000c29e7aea9
CSeq: 49273533 INVITE
Contact: <sip:mod_sofia@192.168.0.201:5060>
User-Agent: FreeSWITCH-mod_sofia/1.10.7-dev+git~20210720T181005Z~4c04914003~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, PRACK, NOTIFY, PUBLISH, SUBSCRIBE
Supported: 100rel, timer, path, replaces             //支持100rel
Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 1058
X-FS-Support: update_display,send_info
Remote-Party-ID: "1015" <sip:1015@192.168.0.201>;party=calling;screen=yes;privacy=off

v=0
o=- 20011 20011 IN IP4 192.168.1.2
s=SDP data
c=IN IP4 192.168.1.2
b=AS:1310
t=0 0
m=audio 50158 RTP/AVP 121 122 123 124 9 0 8 18 101
a=rtpmap:121 G7221/32000
a=fmtp:121 bitrate=48000
a=rtpmap:122 G7221/32000
a=fmtp:122 bitrate=32000
a=rtpmap:123 G7221/32000
a=fmtp:123 bitrate=24000
a=rtpmap:124 G7221/16000
a=fmtp:124 bitrate=24000
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20
m=video 50160 RTP/AVP 97 99 98 110 117
b=TIAS:1310720
a=rtpmap:97 H264/90000
a=fmtp:97 profile-level-id=64001f; max-mbps=108000; max-fs=3600; packetization-mode=1
a=rtpmap:99 H264/90000
a=fmtp:99 profile-level-id=42801f; max-mbps=108000; max-fs=3600; packetization-mode=1
a=rtpmap:98 H264/90000
a=fmtp:98 profile-level-id=42801f; max-mbps=108000; max-fs=3600
a=rtpmap:110 VP8/90000
a=fmtp:110 max-fr=30;max-fs=3600;
a=rtpmap:117 YL-FPR/90000
a=fmtp:117 yl-capset=15;yl-ver=1;yl-ext=19
a=ptime:20
a=rtcp-fb:* ccm fir=

编号2:
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.0.201;rport=5060;received=192.168.0.201;branch=z9hG4bKrD9r3p90FyNUm
Call-ID: d897f7d0-21c9-123b-f4a7-000c29e7aea9
From: "1015" <sip:1015@192.168.0.201>;tag=1r000Km00ZmFQ
To: <sip:1012@192.168.0.24>
CSeq: 49273533 INVITE
Content-Length:  0

编号3:
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 192.168.0.201;rport=5060;received=192.168.0.201;branch=z9hG4bKrD9r3p90FyNUm
Call-ID: d897f7d0-21c9-123b-f4a7-000c29e7aea9
From: "1015" <sip:1015@192.168.0.201>;tag=1r000Km00ZmFQ
To: <sip:1012@192.168.0.24>;tag=OfcYIGGy9WfXV5Mccen4eDK8LbiM23SR
CSeq: 49273533 INVITE
Contact: "1012" <sip:1012@192.168.0.24:5060>
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
User-Agent: VoIP
Require: 100rel    //要求使用100rel机制
RSeq: 8167         //可靠序号
Content-Length:  0

编号4:
PRACK sip:1012@192.168.0.24:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.201;rport;branch=z9hG4bKSp2H5Ht4c7Beg
Max-Forwards: 70
From: "1015" <sip:1015@192.168.0.201>;tag=1r000Km00ZmFQ
To: <sip:1012@192.168.0.24:5060>;tag=OfcYIGGy9WfXV5Mccen4eDK8LbiM23SR
Call-ID: d897f7d0-21c9-123b-f4a7-000c29e7aea9
CSeq: 49273534 PRACK
Contact: <sip:mod_sofia@192.168.0.201:5060>
RAck: 8167 49273533 INVITE      //对应临时应答180(编号3)的确认(可靠序号RSeq: 8167 )
User-Agent: FreeSWITCH-mod_sofia/1.10.7-dev+git~20210720T181005Z~4c04914003~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, PRACK, NOTIFY, PUBLISH, SUBSCRIBE
Supported: 100rel, timer, path, replaces
Content-Length: 0

编号5:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.0.201;rport=5060;received=192.168.0.201;branch=z9hG4bKSp2H5Ht4c7Beg
Call-ID: d897f7d0-21c9-123b-f4a7-000c29e7aea9
From: "1015" <sip:1015@192.168.0.201>;tag=1r000Km00ZmFQ
To: <sip:1012@192.168.0.24>;tag=OfcYIGGy9WfXV5Mccen4eDK8LbiM23SR
CSeq: 49273534 PRACK      //对PRACK(编号4)的响应
Content-Length:  0

编号6:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.0.201;rport=5060;received=192.168.0.201;branch=z9hG4bKrD9r3p90FyNUm
Call-ID: d897f7d0-21c9-123b-f4a7-000c29e7aea9
From: "1015" <sip:1015@192.168.0.201>;tag=1r000Km00ZmFQ
To: <sip:1012@192.168.0.24>;tag=OfcYIGGy9WfXV5Mccen4eDK8LbiM23SR
CSeq: 49273533 INVITE
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
User-Agent: VoIP
Contact: "1012" <sip:1012@192.168.0.24:5060>
Supported: replaces, 100rel
Content-Type: application/sdp
Content-Length:   227

v=0
o=- 3856643454 3856643456 IN IP4 192.168.0.24
s=SDP
c=IN IP4 192.168.0.24
t=0 0
m=audio 10000 RTP/AVP 9 101
c=IN IP4 192.168.0.24
a=rtpmap:9 G722/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv

编号7:
ACK sip:1012@192.168.0.24:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.201;rport;branch=z9hG4bKtZUa7cB89F20B
Max-Forwards: 70
From: "1015" <sip:1015@192.168.0.201>;tag=1r000Km00ZmFQ
To: <sip:1012@192.168.0.24:5060>;tag=OfcYIGGy9WfXV5Mccen4eDK8LbiM23SR
Call-ID: d897f7d0-21c9-123b-f4a7-000c29e7aea9
CSeq: 49273533 ACK
Contact: <sip:mod_sofia@192.168.0.201:5060>
Content-Length: 0

编号8:
BYE sip:mod_sofia@192.168.0.201:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.24:5060;rport;branch=z9hG4bKPjSS1VmZXhcsqLblXHayM3E6vlR-i4rlSu
Max-Forwards: 70
From: <sip:1012@192.168.0.24>;tag=OfcYIGGy9WfXV5Mccen4eDK8LbiM23SR
To: "1015" <sip:1015@192.168.0.201>;tag=1r000Km00ZmFQ
Call-ID: d897f7d0-21c9-123b-f4a7-000c29e7aea9
CSeq: 26829 BYE
User-Agent: VoIP
Content-Length:  0

编号9:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.0.24:5060;rport=5060;branch=z9hG4bKPjSS1VmZXhcsqLblXHayM3E6vlR-i4rlSu
From: <sip:1012@192.168.0.24>;tag=OfcYIGGy9WfXV5Mccen4eDK8LbiM23SR
To: "1015" <sip:1015@192.168.0.201>;tag=1r000Km00ZmFQ
Call-ID: d897f7d0-21c9-123b-f4a7-000c29e7aea9
CSeq: 26829 BYE
User-Agent: FreeSWITCH-mod_sofia/1.10.7-dev+git~20210720T181005Z~4c04914003~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, PRACK, NOTIFY, PUBLISH, SUBSCRIBE
Supported: 100rel, timer, path, replaces
Content-Length: 0


关键说明:

    1. INVITE(编号1)中的Supported头域中携带100rel表示发起方支持该机制

    2. 如果INVITE发起方支持100rel,INVITE接受方支持100rel, 则INVITE接受方在临时应答1xx(编号3)中携带Require: 100rel
    
    3. 如果INVITE发起方支持100rel,INVITE接受方不支持100rel, 则INVITE接受方在临时应答1xx不能携带Require: 100rel
    
    4. 如果INVITE发起方不支持100rel,那么无论INVITE接受方是否支持100rel, INVITE接受方都不能在临时应答1xx不能携带Require: 100rel    

    5. INVITE发起方收到1xx响应中如果有100rel要求,则需要发送PRACK(编号4)进行确认

    6. 由于PRACK是一个请求,因此,INVITE接受方需要作出响应(编号5)

    7. 100 Trying不使用100rel机制.(原因是100 Trying是hop-by-hop的, PRACK是用于end-to-end)
 

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

浪游东戴河

你就是这个世界的唯一

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值