携带鉴权的SIP呼叫流程图
携带鉴权SIP呼叫流程描述
1) 主叫1000发起一路呼叫,终端向服务器发送INVITE请求消息。
2) 代理服务器向终端1000回407响应,表示代理服务器要求终端带上鉴权信息。
3) 终端1000向服务器发送INVITE消息,并带上鉴权信息。
4) 代理服务器向终端用户1000回100Trying响应,表示呼叫已经在处理中。
5) 代理服务器向被叫用户1002终端转发INVITE请求消息。
6) 终端用户1002向代理服务器回100Trying响应,告知代理服务器呼叫正在处理。
7) 被叫终端1002振铃,终端向代理服务器回180ring响应。
8) 代理服务器向终端用户1000转发180ring响应。
9) 被叫用户1002摘机,终端1002向代理服务器回200OK响应消息,表示连接成功。
10)代理服务器向终端1000转发200OK响应消息。
11) 终端1000收到200OK消息后,向代理服务器发送ACK消息进行确认。
12)终端服务将ACK确认消息转发给代理终端1002。
13)终端1000和1002通话建立成功。
14)通话结束,终端1002挂机,并向代理服务器发送BYE消息。
15)代理服务器转发BYE消息至终端1000。
16)终端1000收到BYE消息后,向代理服务器发送200OK消息。
17)代理服务器转发200OK响应消息至终端1002。
18)通话结束。
带鉴权信息的SIP呼叫消息
INVITE sip:[email protected]/2.0
Via: SIP/2.0/UDP192.168.50.32:2445;branch=z9hG4bK-d8754z-244fd550d2729557-1---d8754z-;rport
Max-Forwards: 70
Contact:<sip:[email protected]:2445>
To: <sip:[email protected]>
From:"1002"<sip:[email protected]>;tag=f2698931
Call-ID:OTUzZGM2MzQ2ODZkM2Q0NTczOTgxZDhlOWY5MjA3ODU.
CSeq: 1 INVITE
Allow: INVITE, ACK, CANCEL,OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
Content-Type: application/sdp
Supported: replaces
User-Agent: Bria Professionalrelease 2.4 stamp 49381
Content-Length: 596
v=0
o=- 1 2 IN IP4 192.168.50.32
s=CounterPath Bria Professional
c=IN IP4 192.168.50.32
t=0 0
m=audio 3564 RTP/AVP 107 119 100106 0 98 8 18 101
a=alt:1 3 : 3RJcASQD J+MIobg5192.168.50.32 3564
a=alt:2 2 : 7O4fx9KR Fs3hXCYf192.168.129.1 3564
a=alt:3 1 : 12zuNFYg Ya4ebcvU192.168.110.1 3564
a=fmtp:18 annexb=yes
a=fmtp:101 0-15
a=rtpmap:107 BV32/16000
a=rtpmap:119 BV32-FEC/16000
a=rtpmap:100 SPEEX/16000
a=rtpmap:106 SPEEX-FEC/16000
a=rtpmap:98 iLBC/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=sendrecv
a=x-rtp-session-id:56A9F9BE76774F7C962FD8ACDB1B86E1
主叫1000发起一路呼叫,终端向服务器发送INVITE请求消息
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP192.168.50.32:2445;branch=z9hG4bK-d8754z-244fd550d2729557-1---d8754z-;rport
From:"1002"<sip:[email protected]>;tag=f2698931
To:<sip:[email protected]>;tag=043de7350
Call-ID:OTUzZGM2MzQ2ODZkM2Q0NTczOTgxZDhlOWY5MjA3ODU.
CSeq: 1 INVITE
Contact:<sip:[email protected]:5060>
Proxy-Authenticate: Digest realm="soft3000",nonce="1dbb0165"
Content-Length: 0
代理服务器向终端1000回407响应,表示代理服务器要求终端代理带上鉴权信息。代理服务器什么情况下回407,首先,用户在注册时,必须带鉴权的认证消息;其次,服务器端必须开启呼叫鉴权
ACK sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP192.168.50.32:2445;branch=z9hG4bK-d8754z-244fd550d2729557-1---d8754z-;rport
To:<sip:[email protected]>;tag=043de7350
From:"1002"<sip:[email protected]>;tag=f2698931
Call-ID:OTUzZGM2MzQ2ODZkM2Q0NTczOTgxZDhlOWY5MjA3ODU.
CSeq: 1 ACK
Content-Length: 0
终端用户对407消息确认,告诉服务器端,客户端已经收到
INVITE sip:[email protected]/2.0
Via: SIP/2.0/UDP192.168.50.32:2445;branch=z9hG4bK-d8754z-344b5a077e1cc11e-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:[email protected]:2445>
To: <sip:[email protected]>
From:"1002"<sip:[email protected]>;tag=f2698931
Call-ID:OTUzZGM2MzQ2ODZkM2Q0NTczOTgxZDhlOWY5MjA3ODU.
CSeq: 2 INVITE
Allow: INVITE, ACK, CANCEL,OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
Content-Type: application/sdp
Proxy-Authorization: Digestusername="1002",realm="soft3000 ",nonce="1dbb0165",uri="sip:[email protected]",response="eb3a7e40a4797c2e7b549a6c30d2d091",algorithm=MD5
Supported: replaces
User-Agent: Bria Professionalrelease 2.4 stamp 49381
Content-Length: 596
v=0
o=- 1 2 IN IP4 192.168.50.32
s=CounterPath Bria Professional
c=IN IP4 192.168.50.32
t=0 0
m=audio 3564 RTP/AVP 107 119 100106 0 98 8 18 101
a=alt:1 3 : 3RJcASQD J+MIobg5192.168.50.32 3564
a=alt:2 2 : 7O4fx9KR Fs3hXCYf 192.168.129.13564
a=alt:3 1 : 12zuNFYg Ya4ebcvU192.168.110.1 3564
a=fmtp:18 annexb=yes
a=fmtp:101 0-15
a=rtpmap:107 BV32/16000
a=rtpmap:119 BV32-FEC/16000
a=rtpmap:100 SPEEX/16000
a=rtpmap:106 SPEEX-FEC/16000
a=rtpmap:98 iLBC/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=sendrecv
a=x-rtp-session-id:56A9F9BE76774F7C962FD8ACDB1B86E1
终端1000向代理服务器重新发起带鉴权的INVITE消息,鉴权信息详见,Proxy-Authorization头域,后续的呼叫流程和基本呼叫流程一样。
SIP/2.0 100 Trying
Via: SIP/2.0/UDP192.168.50.32:2445;branch=z9hG4bK-d8754z-344b5a077e1cc11e-1---d8754z-;rport
From:"1002"<sip:[email protected]>;tag=f2698931
To:<sip:[email protected]>;tag=118336ef9
Call-ID:OTUzZGM2MzQ2ODZkM2Q0NTczOTgxZDhlOWY5MjA3ODU.
CSeq: 2 INVITE
Contact:<sip:[email protected]:5060>
Content-Length: 0
INVITE sip:[email protected]/2.0
Via: SIP/2.0/UDP192.168.50.34:5060;branch=3f50f4d6
From: "1002"<sip:[email protected]>;tag=78e8c5c7
Contact:<sip:[email protected]:5060>
To: <sip:[email protected]>
Call-ID: 13867544773b5f42984898934a7e8ef6ca@2232a8c0
CSeq: 238 INVITE
Max-Forwards: 70
Supported: timer
Session-Expires: 90
Content-Type: application/sdp
Content-Length: 340
v=0
o=root 1062270166 1062270166 IN IP4192.168.50.34
s=session
c=IN IP4 192.168.50.34
t=0 0
m=audio 45294 RTP/AVP 0 8 18 3 114101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=rtpmap:3 GSM/8000
a=rtpmap:114 AMR/8000
a=fmtp:114octet-align=1;mode-set=7,0
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
SIP/2.0 100 Trying
Via: SIP/2.0/UDP192.168.50.34:5060;branch=3f50f4d6
From:"1002"<sip:[email protected]>;tag=78e8c5c7
To: <sip:[email protected]>
Call-ID: 13867544773b5f42984898934a7e8ef6ca@2232a8c0
CSeq: 238 INVITE
Content-Length: 0
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP192.168.50.34:5060;branch=3f50f4d6
From:"1002"<sip:[email protected]>;tag=78e8c5c7
To:<sip:[email protected]>;tag=97865811
Call-ID: 13867544773b5f42984898934a7e8ef6ca@2232a8c0
CSeq: 238 INVITE
Contact:<sip:[email protected]:18553>
Content-Length: 0
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP192.168.50.32:2445;branch=z9hG4bK-d8754z-344b5a077e1cc11e-1---d8754z-;rport
From:"1002"<sip:[email protected]>;tag=f2698931
To:<sip:[email protected]>;tag=118336ef9
Call-ID:OTUzZGM2MzQ2ODZkM2Q0NTczOTgxZDhlOWY5MjA3ODU.
CSeq: 2 INVITE
Contact:<sip:[email protected]:5060>
Content-Length: 0
SIP/2.0 200 OK
Via: SIP/2.0/UDP192.168.50.34:5060;branch=3f50f4d6
From:"1002"<sip:[email protected]>;tag=78e8c5c7
To:<sip:[email protected]>;tag=97865811
Call-ID:Anta13867544773b5f42984898934a7e8ef6ca@2232a8c0
CSeq: 238 INVITE
Contact:<sip:[email protected]:18553>
Allow-Events: telephone-event
Require: timer
Supported: timer
Session-Expires: 90;refresher=uac
Content-Type: application/sdp
Content-Length: 326
v=0
o=192.168.50.32 1074907112788190655 IN IP4 192.168.50.32
s=-
c=IN IP4 192.168.50.32
t=0 0
m=audio 26752 RTP/AVP 0 8 18 3 114101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=rtpmap:3 GSM/8000
a=rtpmap:114 AMR/8000
a=fmtp:114 mode-set=0
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
ACK sip:[email protected]:18553SIP/2.0
Via: SIP/2.0/UDP192.168.50.34:5060;branch=3f50f4d6
From: "1002"<sip:[email protected]>;tag=78e8c5c7
To:<sip:[email protected]>;tag=97865811
Call-ID:Anta13867544773b5f42984898934a7e8ef6ca@2232a8c0
CSeq: 238 ACK
Max-Forwards: 70
Content-Length: 0
SIP/2.0 200 OK
Via: SIP/2.0/UDP192.168.50.32:2445;branch=z9hG4bK-d8754z-344b5a077e1cc11e-1---d8754z-;rport
From:"1002"<sip:[email protected]>;tag=f2698931
To:<sip:[email protected]>;tag=118336ef9
Call-ID: OTUzZGM2MzQ2ODZkM2Q0NTczOTgxZDhlOWY5MjA3ODU.
CSeq: 2 INVITE
Contact:<sip:[email protected]:5060>
Content-Type: application/sdp
Content-Length: 199
v=0
o=root 113824166 113824166 IN IP4192.168.50.34
s=session
c=IN IP4 192.168.50.34
t=0 0
m=audio 41182 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
ACK sip:[email protected]:5060SIP/2.0
Via: SIP/2.0/UDP192.168.50.32:2445;branch=z9hG4bK-d8754z-bd168751863dd812-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:[email protected]:2445>
To:<sip:[email protected]>;tag=118336ef9
From:"1002"<sip:[email protected]>;tag=f2698931
Call-ID:OTUzZGM2MzQ2ODZkM2Q0NTczOTgxZDhlOWY5MjA3ODU.
CSeq: 2 ACK
Proxy-Authorization: Digestusername="1002",realm="ASG Switch",nonce="1dbb0165",uri="sip:[email protected]",response="eb3a7e40a4797c2e7b549a6c30d2d091",algorithm=MD5
User-Agent: Bria Professionalrelease 2.4 stamp 49381
Content-Length: 0
BYE sip:[email protected]:5060SIP/2.0
Via: SIP/2.0/UDP192.168.50.32:2445;branch=z9hG4bK-d8754z-61057e021325140c-1---d8754z-;rport
Max-Forwards: 70
Contact:<sip:[email protected]:2445>
To:<sip:[email protected]>;tag=118336ef9
From:"1002"<sip:[email protected]>;tag=f2698931
Call-ID:OTUzZGM2MzQ2ODZkM2Q0NTczOTgxZDhlOWY5MjA3ODU.
CSeq: 3 BYE
Proxy-Authorization: Digestusername="1002",realm="ASGSwitch",nonce="1dbb0165",uri="sip:[email protected]:5060",response="b24a55d3ca4420c406eef5a2797e6411",algorithm=MD5
User-Agent: Bria Professionalrelease 2.4 stamp 49381
Reason: SIP;description="UserHung Up"
Content-Length: 0
SIP/2.0 200 OK
Via: SIP/2.0/UDP192.168.50.32:2445;branch=z9hG4bK-d8754z-61057e021325140c-1---d8754z-;rport
From:"1002"<sip:[email protected]>;tag=f2698931
To:<sip:[email protected]>;tag=118336ef9
Call-ID: OTUzZGM2MzQ2ODZkM2Q0NTczOTgxZDhlOWY5MjA3ODU.
CSeq: 3 BYE
Contact:<sip:[email protected]:5060>
Content-Length: 0
BYE sip:[email protected]:18553SIP/2.0
Via: SIP/2.0/UDP192.168.50.34:5060;branch=3f50f4d6
From: "1002"<sip:[email protected]>;tag=78e8c5c7
To:<sip:[email protected]>;tag=97865811
Call-ID:Anta13867544773b5f42984898934a7e8ef6ca@2232a8c0
CSeq: 239 BYE
Max-Forwards: 70
Content-Length: 0
SIP/2.0 200 OK
Via: SIP/2.0/UDP192.168.50.34:5060;branch=3f50f4d6
From:"1002"<sip:[email protected]>;tag=78e8c5c7
To:<sip:[email protected]>;tag=97865811
Call-ID:Anta13867544773b5f42984898934a7e8ef6ca@2232a8c0
CSeq: 239 BYE
Content-Length: 0
标签:SIP,sip,鉴权,rtpmap,tag,2.0,1002,1000 From: https://www.cnblogs.com/opensmarty/p/17325790.html