本文通过tcpdump对真实环境里的软电话的注册、呼叫、挂断流程进行抓包,通过真实的例子学习SIP协议。本文主要包括以下方面:
软电话使用x-lite,使用freeswitch的默认的两个号码1008和1018。
freeswitch部署在服务器的私网地址是172.23.4.92,公网地址115.aa.aa.aa。
1008的测试机器在私网上(IP为10.240.80.69),通过115.aa.aa.aa:5060注册freeswitch,但是出去后的公网地址是59.bb.bb.bb。
1018的测试机器在私网上,通过115.aa.aa.aa:5060注册freeswitch,但是出去后的公网地址是123.cc.cc.cc
在172.23.4.92上,使用tcpdump捕获通信过程中的所有包
为了安全,本文把真实环境的公网地址,全部使用假的地址进行替换
1008 向115.aa.aa.aa:5060 进行注册
A. 1008 向freeswitch第一次发起注册
No. Time Source Destination Protocol Length Info
201 8.599836 10.240.80.69 115.aa.aa.aa SIP 599 Request: REGISTER sip:115.aa.aa.aa:5060 (1 binding) |
Frame 201: 599 bytes on wire (4792 bits), 599 bytes captured (4792 bits) on interface 0
Ethernet II, Src: Giga-Byt_bf:ae:ce (40:8d:5c:bf:ae:ce), Dst: CiscoInc_53:c8:c2 (e8:65:49:53:c8:c2)
Internet Protocol Version 4, Src: 10.240.80.69, Dst: 115.aa.aa.aa
User Datagram Protocol, Src Port: 59531 (59531), Dst Port: 5060 (5060)
Session Initiation Protocol (REGISTER)
Request-Line: REGISTER sip:115.aa.aa.aa:5060 SIP/2.0
Message Header
Via: SIP/2.0/UDP 10.240.80.69:59531;branch=z9hG4bK-524287-1---671b073f870cfe63;rport
Max-Forwards: 70
Contact: 1008@10.240.80.69:59531;rinstance=b22023be9ce02608>
To: "1008"1008@115.aa.aa.aa:5060>
From: "1008"1008@115.aa.aa.aa:5060>;tag=9a71ed3c
Call-ID: 84253M2Q3MDQyZDY0Y2I2NTg1MGE3ZTExODQ0ODIyNDNkYTE
CSeq: 1 REGISTER
Expires: 3600
Allow: SUBSCRIBE, NOTIFY, INVITE, ACK, CANCEL, BYE, REFER, INFO, OPTIONS, MESSAGE
User-Agent: X-Lite release 4.9.8 stamp 84253
Content-Length: 0
B. freeswitch返回 401 未认证消息
freeswitch在返回sip消息中新增参数:
No. Time Source Destination Protocol Length Info
202 8.604062 115.aa.aa.aa 10.240.80.69 SIP 727 Status: 401 Unauthorized |
Frame 202: 727 bytes on wire (5816 bits), 727 bytes captured (5816 bits) on interface 0
Ethernet II, Src: CiscoInc_53:c8:c2 (e8:65:49:53:c8:c2), Dst: Giga-Byt_bf:ae:ce (40:8d:5c:bf:ae:ce)
Internet Protocol Version 4, Src: 115.aa.aa.aa, Dst: 10.240.80.69
User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 59531 (59531)
Session Initiation Protocol (401)
Status-Line: SIP/2.0 401 Unauthorized
Message Header
Via: SIP/2.0/UDP 10.240.80.69:59531;branch=z9hG4bK-524287-1---671b073f870cfe63;rport=35646;received=59.bb.bb.bb
From: "1008" <sip:1008@115.aa.aa.aa:5060>;tag=9a71ed3c
To: "1008" <sip:1008@115.aa.aa.aa:5060>;tag=va161eH7mmgNc
Call-ID: 84253M2Q3MDQyZDY0Y2I2NTg1MGE3ZTExODQ0ODIyNDNkYTE
CSeq: 1 REGISTER
User-Agent: FreeSWITCH-mod_sofia/1.6.19-36-7a77e0b~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
WWW-Authenticate: Digest realm="115.aa.aa.aa", nonce="1118e141-6f6d-4cee-a7d7-5061f8d8a2da", algorithm=MD5, qop="auth"
Content-Length: 0
C. 1008第二次发起注册请求
1008收到401未认证消息,会重新发起注册请求,并加上根据收到的认证摘要和1008的用户名密码生成的认证消息(Authorization头)。另外CSeq序号变成2
No. Time Source Destination Protocol Length Info
203 8.606034 10.240.80.69 115.aa.aa.aa SIP 859 Request: REGISTER sip:115.aa.aa.aa:5060 (1 binding) |
Frame 203: 859 bytes on wire (6872 bits), 859 bytes captured (6872 bits) on interface 0
Ethernet II, Src: Giga-Byt_bf:ae:ce (40:8d:5c:bf:ae:ce), Dst: CiscoInc_53:c8:c2 (e8:65:49:53:c8:c2)
Internet Protocol Version 4, Src: 10.240.80.69, Dst: 115.aa.aa.aa
User Datagram Protocol, Src Port: 59531 (59531), Dst Port: 5060 (5060)
Session Initiation Protocol (REGISTER)
Request-Line: REGISTER sip:115.aa.aa.aa:5060 SIP/2.0
Message Header
Via: SIP/2.0/UDP 10.240.80.69:59531;branch=z9hG4bK-524287-1---726c884045c07c61;rport
Max-Forwards: 70
Contact: 1008@10.240.80.69:59531;rinstance=b22023be9ce02608>
To: "1008"1008@115.aa.aa.aa:5060>
From: "1008"1008@115.aa.aa.aa:5060>;tag=9a71ed3c
Call-ID: 84253M2Q3MDQyZDY0Y2I2NTg1MGE3ZTExODQ0ODIyNDNkYTE
CSeq: 2 REGISTER
Expires: 3600
Allow: SUBSCRIBE, NOTIFY, INVITE, ACK, CANCEL, BYE, REFER, INFO, OPTIONS, MESSAGE
User-Agent: X-Lite release 4.9.8 stamp 84253
[truncated]Authorization: Digest username="1008",realm="115.aa.aa.aa",nonce="1118e141-6f6d-4cee-a7d7-5061f8d8a2da",uri="sip:115.aa.aa.aa:5060",response="1cd1bea82808566209948ba2eb53c9f1",cnonce="7761e8692660d5ee8467fc4a3974afe3",nc=
Content-Length: 0
D. Freeswitch注册成功返回200
Freeswitch收到请求后,对请求进行核实,如果认证通过,则返回200 OK消息。此时1008在freeswitch注册成功。freeswitch会将1008在SIP消息中的联系地址(contact字段)记录下来。如果有人呼叫1008,则freeswitch会向该地址发送SIP消息建立呼叫
补充,如果认证失败,则返回403 Forbidden消息
No. Time Source Destination Protocol Length Info
204 8.611684 115.aa.aa.aa 10.240.80.69 SIP 711 Status: 200 OK (1 binding) |
Frame 204: 711 bytes on wire (5688 bits), 711 bytes captured (5688 bits) on interface 0
Ethernet II, Src: CiscoInc_53:c8:c2 (e8:65:49:53:c8:c2), Dst: Giga-Byt_bf:ae:ce (40:8d:5c:bf:ae:ce)
Internet Protocol Version 4, Src: 115.aa.aa.aa, Dst: 10.240.80.69
User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 59531 (59531)
Session Initiation Protocol (200)
Status-Line: SIP/2.0 200 OK
Message Header
Via: SIP/2.0/UDP 10.240.80.69:59531;branch=z9hG4bK-524287-1---726c884045c07c61;rport=35646;received=59.bb.bb.bb
From: "1008" <sip:1008@115.aa.aa.aa:5060>;tag=9a71ed3c
To: "1008" <sip:1008@115.aa.aa.aa:5060>;tag=XKtZ391ajX67Q
Call-ID: 84253M2Q3MDQyZDY0Y2I2NTg1MGE3ZTExODQ0ODIyNDNkYTE
CSeq: 2 REGISTER
Contact: <sip:1008@10.240.80.69:59531;rinstance=b22023be9ce02608>;expires=3600
Date: Wed, 25 Oct 2017 08:26:48 GMT
User-Agent: FreeSWITCH-mod_sofia/1.6.19-36-7a77e0b~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Content-Length: 0
1008 呼叫 1018,然后接通通话,最后1018挂断电话
下文的流程图如下:
下方的SIP协议中,都包含SDP协议,这里的SDP用于1008和1018软电话对通话参数协商,使用通话双方能够通过RTP进行通信。本文我不介绍SDP内容。
A. 1008 向freeswitch发起INVITE 消息,请求建立一个呼叫
No. Time Source Destination Protocol Length Info
267 15.676245 59.bb.bb.bb 172.23.4.92 SIP/SDP 968 Request: INVITE sip:1018@115.aa.aa.aa:5060 |
Frame 267: 968 bytes on wire (7744 bits), 968 bytes captured (7744 bits)
Ethernet II, Src: ZteCorpo_60:22:21 (00:22:93:60:22:21), Dst: Vmware_83:02:4d (00:50:56:83:02:4d)
Internet Protocol Version 4, Src: 59.bb.bb.bb, Dst: 172.23.4.92
User Datagram Protocol, Src Port: 24576 (24576), Dst Port: 5060 (5060)
Session Initiation Protocol (INVITE)
Request-Line: INVITE sip:1018@115.aa.aa.aa:5060 SIP/2.0
Message Header
Via: SIP/2.0/UDP 10.240.80.69:59535;branch=z9hG4bK-524287-1---eafafc5cc50b9a41;rport
Max-Forwards: 70
Contact: 1008@59.bb.bb.bb:24576;rinstance=9d87a2b91a59c5b9>
To: 1018@115.aa.aa.aa:5060>
From: "1008"1008@115.aa.aa.aa:5060>;tag=54bd8d3a
Call-ID: 84253MGY3OGQwZWI1OGQ3YTRlZTYwZjQ3ZDZjZDhjNDNiMTU
CSeq: 1 INVITE
Allow: SUBSCRIBE, NOTIFY, INVITE, ACK, CANCEL, BYE, REFER, INFO, OPTIONS, MESSAGE
Content-Type: application/sdp
Supported: replaces
User-Agent: X-Lite release 4.9.8 stamp 84253
Content-Length: 334
Message Body
Session Description Protocol
Session Description Protocol Version (v): 0
Owner/Creator, Session Id (o): - 13153395802875591 1 IN IP4 10.240.80.69
Session Name (s): X-Lite release 4.9.8 stamp 84253
Connection Information (c): IN IP4 10.240.80.69
Time Description, active time (t): 0 0
Media Description, name and address (m): audio 64836 RTP/AVP 9 8 120 0 84 101
Media Attribute (a): rtpmap:120 opus/48000/2
Media Attribute (a): fmtp:120 useinbandfec=1; usedtx=1; maxaveragebitrate=64000
Media Attribute (a): rtpmap:84 speex/16000
Media Attribute (a): rtpmap:101 telephone-event/8000
Media Attribute (a): fmtp:101 0-15
Media Attribute (a): sendrecv
B freeswitch 回送 100 trying
freeswitch通过100 trying消息通知1008已经收到他的请求。对1008的权限进行验证,如果通过,则此时1008的UA和freeswitch的UA通信通道已经建立,被称之为freeswitch的一条腿,又称a-leg
No. Time Source Destination Protocol Length Info
268 15.676821 172.23.4.92 59.bb.bb.bb SIP 427 Status: 100 Trying |
Frame 268: 427 bytes on wire (3416 bits), 427 bytes captured (3416 bits)
Ethernet II, Src: Vmware_83:02:4d (00:50:56:83:02:4d), Dst: IETF-VRRP-VRID_04 (00:00:5e:00:01:04)
Internet Protocol Version 4, Src: 172.23.4.92, Dst: 59.bb.bb.bb
User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 24576 (24576)
Session Initiation Protocol (100)
Status-Line: SIP/2.0 100 Trying
Message Header
Via: SIP/2.0/UDP 10.240.80.69:59535;branch=z9hG4bK-524287-1---eafafc5cc50b9a41;rport=24576;received=59.bb.bb.bb
From: "1008" 1008@115.aa.aa.aa:5060>;tag=54bd8d3a
To: 1018@115.aa.aa.aa:5060>
Call-ID: 84253MGY3OGQwZWI1OGQ3YTRlZTYwZjQ3ZDZjZDhjNDNiMTU
CSeq: 1 INVITE
User-Agent: FreeSWITCH-mod_sofia/1.6.19-36-7a77e0b~64bit
Content-Length: 0
C. freeswitch向1018发送INVITE信息
freeswitch进行路由找到1018的信息,向1018发送INVITE信息。
重要参数
No. Time Source Destination Protocol Length Info
508 25.731551 172.23.4.92 123.cc.cc.cc SIP/SDP 1361 Request: INVITE sip:1018@123.58.160.154:36841;rinstance=0d9373ba78a06600 |
Frame 508: 1361 bytes on wire (10888 bits), 1361 bytes captured (10888 bits)
Ethernet II, Src: Vmware_83:02:4d (00:50:56:83:02:4d), Dst: IETF-VRRP-VRID_04 (00:00:5e:00:01:04)
Internet Protocol Version 4, Src: 172.23.4.92, Dst: 123.58.160.154
User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 36841 (36841)
Session Initiation Protocol (INVITE)
Request-Line: INVITE sip:1018@123.58.160.154:36841;rinstance=0d9373ba78a06600 SIP/2.0
Message Header
Via: SIP/2.0/UDP 115.aa.aa.aa;rport;branch=z9hG4bK85Z552j3KHv4K
Route: <sip:1018@123.58.160.154:36841>;rinstance=0d9373ba78a06600
Max-Forwards: 68
From: "1008" <sip:1008@172.23.4.92>;tag=7HUvrZpH3a9Up
To: <sip:1018@123.58.160.154:36841;rinstance=0d9373ba78a06600>
Call-ID: 30b8d974-3406-1236-52a1-00505683024d
CSeq: 114125036 INVITE
Contact: <sip:mod_sofia@115.aa.aa.aa:5060>
User-Agent: FreeSWITCH-mod_sofia/1.6.19-36-7a77e0b~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
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: 274
X-FS-Support: update_display,send_info
Remote-Party-ID: "1008" <sip:1008@172.23.4.92>;party=calling;screen=yes;privacy=off
Message Body
Session Description Protocol
Session Description Protocol Version (v): 0
Owner/Creator, Session Id (o): FreeSWITCH 1508895355 1508895356 IN IP4 115.aa.aa.aa
Session Name (s): FreeSWITCH
Connection Information (c): IN IP4 115.aa.aa.aa
Time Description, active time (t): 0 0
Media Description, name and address (m): audio 26828 RTP/AVP 9 8 0 101
Media Attribute (a): rtpmap:9 G722/8000
Media Attribute (a): rtpmap:8 PCMA/8000
Media Attribute (a): rtpmap:0 PCMU/8000
Media Attribute (a): rtpmap:101 telephone-event/8000
Media Attribute (a): fmtp:101 0-16
Media Attribute (a): ptime:20
D. 1018 回送100 trying
1018 回送100 trying 消息通知freeswitch,它已经正常接收到INVITE消息,正在准备进行下一步处理
No. Time Source Destination Protocol Length Info
513 25.824373 123.cc.cc.cc 172.23.4.92 SIP 346 Status: 100 Trying |
Frame 513: 346 bytes on wire (2768 bits), 346 bytes captured (2768 bits)
Ethernet II, Src: ZteCorpo_60:22:21 (00:22:93:60:22:21), Dst: Vmware_83:02:4d (00:50:56:83:02:4d)
Internet Protocol Version 4, Src: 123.58.160.154, Dst: 172.23.4.92
User Datagram Protocol, Src Port: 36841 (36841), Dst Port: 5060 (5060)
Session Initiation Protocol (100)
Status-Line: SIP/2.0 100 Trying
Message Header
Via: SIP/2.0/UDP 115.aa.aa.aa;rport=5060;branch=z9hG4bK85Z552j3KHv4K
To: <sip:1018@123.58.160.154:36841;rinstance=0d9373ba78a06600>
From: "1008" <sip:1008@172.23.4.92>;tag=7HUvrZpH3a9Up
Call-ID: 30b8d974-3406-1236-52a1-00505683024d
CSeq: 114125036 INVITE
Content-Length: 0
E. 1018 回送180 ring 消息
1018 进行振铃,并向freeswitch回送180 ring消息,通知1018正在振铃
No. Time Source Destination Protocol Length Info
520 26.377340 123.cc.cc.cc 172.23.4.92 SIP 507 Status: 180 Ringing |
Frame 520: 507 bytes on wire (4056 bits), 507 bytes captured (4056 bits)
Ethernet II, Src: ZteCorpo_60:22:21 (00:22:93:60:22:21), Dst: Vmware_83:02:4d (00:50:56:83:02:4d)
Internet Protocol Version 4, Src: 123.58.160.154, Dst: 172.23.4.92
User Datagram Protocol, Src Port: 36841 (36841), Dst Port: 5060 (5060)
Session Initiation Protocol (180)
Status-Line: SIP/2.0 180 Ringing
Message Header
Via: SIP/2.0/UDP 115.aa.aa.aa;rport=5060;branch=z9hG4bK85Z552j3KHv4K
Contact: <sip:1018@123.58.160.154:36841;rinstance=0d9373ba78a06600>
To: "1018"<sip:1018@123.58.160.154:36841;rinstance=0d9373ba78a06600>;tag=e243b65d
From: "1008" <sip:1008@172.23.4.92>;tag=7HUvrZpH3a9Up
Call-ID: 30b8d974-3406-1236-52a1-00505683024d
CSeq: 114125036 INVITE
User-Agent: X-Lite release 4.9.8 stamp 84253
Allow-Events: talk, hold
Content-Length: 0
F. freeswitch 给 1008 发送 183 消息
freeswitch 向1008产生一个回铃音,通过RTP发送给1008
No. Time Source Destination Protocol Length Info
525 26.399001 172.23.4.92 59.bb.bb.bb SIP/SDP 1228 Status: 183 Session Progress |
Frame 525: 1228 bytes on wire (9824 bits), 1228 bytes captured (9824 bits)
Ethernet II, Src: Vmware_83:02:4d (00:50:56:83:02:4d), Dst: IETF-VRRP-VRID_04 (00:00:5e:00:01:04)
Internet Protocol Version 4, Src: 172.23.4.92, Dst: 59.bb.bb.bb
User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 24576 (24576)
Session Initiation Protocol (183)
Status-Line: SIP/2.0 183 Session Progress
Message Header
Via: SIP/2.0/UDP 10.240.80.69:59535;branch=z9hG4bK-524287-1---eafafc5cc50b9a41;rport=24576;received=59.bb.bb.bb
From: "1008" 1008@115.aa.aa.aa:5060>;tag=54bd8d3a
To: 1018@115.aa.aa.aa:5060>;tag=6813p45D61j9a
Call-ID: 84253MGY3OGQwZWI1OGQ3YTRlZTYwZjQ3ZDZjZDhjNDNiMTU
CSeq: 1 INVITE
Contact: 1018@115.aa.aa.aa:5060;transport=udp>
User-Agent: FreeSWITCH-mod_sofia/1.6.19-36-7a77e0b~64bit
Accept: application/sdp
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
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: 226
Remote-Party-ID: "1018" 1018@115.aa.aa.aa>;party=calling;privacy=off;screen=no
Message Body
Session Description Protocol
Session Description Protocol Version (v): 0
Owner/Creator, Session Id (o): FreeSWITCH 1508899003 1508899004 IN IP4 115.aa.aa.aa
Session Name (s): FreeSWITCH
Connection Information (c): IN IP4 115.aa.aa.aa
Time Description, active time (t): 0 0
Media Description, name and address (m): audio 23180 RTP/AVP 9 101
Media Attribute (a): rtpmap:9 G722/8000
Media Attribute (a): rtpmap:101 telephone-event/8000
Media Attribute (a): fmtp:101 0-16
Media Attribute (a): ptime:20
G. 1018 回送200 OK
1018 接听电话,向freeswitch回送200 OK消息
No. Time Source Destination Protocol Length Info
741 27.795404 123.cc.cc.cc 172.23.4.92 SIP/SDP 815 Status: 200 OK |
Frame 741: 815 bytes on wire (6520 bits), 815 bytes captured (6520 bits)
Ethernet II, Src: ZteCorpo_60:22:21 (00:22:93:60:22:21), Dst: Vmware_83:02:4d (00:50:56:83:02:4d)
Internet Protocol Version 4, Src: 123.58.160.154, Dst: 172.23.4.92
User Datagram Protocol, Src Port: 36841 (36841), Dst Port: 5060 (5060)
Session Initiation Protocol (200)
Status-Line: SIP/2.0 200 OK
Message Header
Via: SIP/2.0/UDP 115.aa.aa.aa;rport=5060;branch=z9hG4bK85Z552j3KHv4K
Contact: <sip:1018@123.58.160.154:36841;rinstance=0d9373ba78a06600>
To: <sip:1018@123.58.160.154:36841;rinstance=0d9373ba78a06600>;tag=e243b65d
From: "1008" <sip:1008@172.23.4.92>;tag=7HUvrZpH3a9Up
Call-ID: 30b8d974-3406-1236-52a1-00505683024d
CSeq: 114125036 INVITE
Allow: SUBSCRIBE, NOTIFY, INVITE, ACK, CANCEL, BYE, REFER, INFO, OPTIONS, MESSAGE
Content-Type: application/sdp
Supported: replaces
User-Agent: X-Lite release 4.9.8 stamp 84253
Content-Length: 208
Message Body
Session Description Protocol
Session Description Protocol Version (v): 0
Owner/Creator, Session Id (o): - 2353942294 3 IN IP4 10.240.80.146
Session Name (s): X-Lite release 4.9.8 stamp 84253
Connection Information (c): IN IP4 10.240.80.146
Time Description, active time (t): 0 0
Media Description, name and address (m): audio 59974 RTP/AVP 9 8 0 101
Media Attribute (a): rtpmap:101 telephone-event/8000
Media Attribute (a): fmtp:101 0-15
Media Attribute (a): sendrecv
H. freeswitch向1018回送ACK证实消息
freeswitch向1018回送ACK证实消息,确认已经收到请求。此时 freeswitch和1018的通知通道已经建立,称为b-leg
No. Time Source Destination Protocol Length Info
742 27.798013 172.23.4.92 123.cc.cc.cc SIP 466 Request: ACK sip:1018@123.58.160.154:36841;rinstance=0d9373ba78a06600 |
Frame 742: 466 bytes on wire (3728 bits), 466 bytes captured (3728 bits)
Ethernet II, Src: Vmware_83:02:4d (00:50:56:83:02:4d), Dst: IETF-VRRP-VRID_04 (00:00:5e:00:01:04)
Internet Protocol Version 4, Src: 172.23.4.92, Dst: 123.58.160.154
User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 36841 (36841)
Session Initiation Protocol (ACK)
Request-Line: ACK sip:1018@123.58.160.154:36841;rinstance=0d9373ba78a06600 SIP/2.0
Message Header
Via: SIP/2.0/UDP 115.aa.aa.aa;rport;branch=z9hG4bK9eSy7X36gtjQF
Max-Forwards: 70
From: "1008" <sip:1008@172.23.4.92>;tag=7HUvrZpH3a9Up
To: <sip:1018@123.58.160.154:36841;rinstance=0d9373ba78a06600>;tag=e243b65d
Call-ID: 30b8d974-3406-1236-52a1-00505683024d
CSeq: 114125036 ACK
Contact: <sip:mod_sofia@115.aa.aa.aa:5060>
Content-Length: 0
I. freeswitch 向1008发送200K消息
freeswitch向1008发送200K消息,并切断原先自动产生的回铃音,将1018的接进来
No. Time Source Destination Protocol Length Info
788 27.816687 172.23.4.92 59.bb.bb.bb SIP/SDP 1234 Status: 200 OK |
Frame 788: 1234 bytes on wire (9872 bits), 1234 bytes captured (9872 bits)
Ethernet II, Src: Vmware_83:02:4d (00:50:56:83:02:4d), Dst: IETF-VRRP-VRID_04 (00:00:5e:00:01:04)
Internet Protocol Version 4, Src: 172.23.4.92, Dst: 59.bb.bb.bb
User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 24576 (24576)
Session Initiation Protocol (200)
Status-Line: SIP/2.0 200 OK
Message Header
Via: SIP/2.0/UDP 10.240.80.69:59535;branch=z9hG4bK-524287-1---eafafc5cc50b9a41;rport=24576;received=59.bb.bb.bb
From: "1008" <sip:1008@115.aa.aa.aa:5060>;tag=54bd8d3a
To: <sip:1018@115.aa.aa.aa:5060>;tag=6813p45D61j9a
Call-ID: 84253MGY3OGQwZWI1OGQ3YTRlZTYwZjQ3ZDZjZDhjNDNiMTU
CSeq: 1 INVITE
Contact: <sip:1018@115.aa.aa.aa:5060;transport=udp>
User-Agent: FreeSWITCH-mod_sofia/1.6.19-36-7a77e0b~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Session-Expires: 120;refresher=uas
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 226
Remote-Party-ID: "Outbound Call" <sip:1018@115.aa.aa.aa>;party=calling;privacy=off;screen=no
Message Body
Session Description Protocol
Session Description Protocol Version (v): 0
Owner/Creator, Session Id (o): FreeSWITCH 1508899003 1508899004 IN IP4 115.aa.aa.aa
Session Name (s): FreeSWITCH
Connection Information (c): IN IP4 115.aa.aa.aa
Time Description, active time (t): 0 0
Media Description, name and address (m): audio 23180 RTP/AVP 9 101
Media Attribute (a): rtpmap:9 G722/8000
Media Attribute (a): rtpmap:101 telephone-event/8000
Media Attribute (a): fmtp:101 0-16
Media Attribute (a): ptime:20
J. 1008回送freeswitch ACK消息
1008回送freeswitch ACK消息,他已经收到200消息
此时a-leg和b-leg的通话建立完毕,freeswitch将两个leg桥接起来,使得双方可以正常通话
No. Time Source Destination Protocol Length Info
792 27.827819 59.bb.bb.bb 172.23.4.92 SIP 524 Request: ACK sip:1018@115.aa.aa.aa:5060;transport=udp |
Frame 792: 524 bytes on wire (4192 bits), 524 bytes captured (4192 bits)
Ethernet II, Src: ZteCorpo_60:22:21 (00:22:93:60:22:21), Dst: Vmware_83:02:4d (00:50:56:83:02:4d)
Internet Protocol Version 4, Src: 59.bb.bb.bb, Dst: 172.23.4.92
User Datagram Protocol, Src Port: 24576 (24576), Dst Port: 5060 (5060)
Session Initiation Protocol (ACK)
Request-Line: ACK sip:1018@115.aa.aa.aa:5060;transport=udp SIP/2.0
Message Header
Via: SIP/2.0/UDP 10.240.80.69:59535;branch=z9hG4bK-524287-1---aa9f7e058653c625;rport
Max-Forwards: 70
Contact: 1008@59.bb.bb.bb:24576;rinstance=9d87a2b91a59c5b9>
To: 1018@115.aa.aa.aa:5060>;tag=6813p45D61j9a
From: "1008" 1008@115.aa.aa.aa:5060>;tag=54bd8d3a
Call-ID: 84253MGY3OGQwZWI1OGQ3YTRlZTYwZjQ3ZDZjZDhjNDNiMTU
CSeq: 1 ACK
User-Agent: X-Lite release 4.9.8 stamp 84253
Content-Length: 0
A. 1018 挂断电话,向freeswitch发送BYE消息
1018 挂断电话,向freeswitch发送BYE消息,freeswitch进行拆线
No. Time Source Destination Protocol Length Info
1826 32.660666 123.cc.cc.cc 172.23.4.92 SIP 523 Request: BYE sip:mod_sofia@115.aa.aa.aa:5060 |
Frame 1826: 523 bytes on wire (4184 bits), 523 bytes captured (4184 bits)
Ethernet II, Src: ZteCorpo_60:22:21 (00:22:93:60:22:21), Dst: Vmware_83:02:4d (00:50:56:83:02:4d)
Internet Protocol Version 4, Src: 123.58.160.154, Dst: 172.23.4.92
User Datagram Protocol, Src Port: 36841 (36841), Dst Port: 5060 (5060)
Session Initiation Protocol (BYE)
Request-Line: BYE sip:mod_sofia@115.aa.aa.aa:5060 SIP/2.0
Message Header
Via: SIP/2.0/UDP 10.240.80.146:49713;branch=z9hG4bK-524287-1---e2a3f037aa702259;rport
Max-Forwards: 70
Contact: 1018@123.58.160.154:36841;rinstance=0d9373ba78a06600>
To: "1008" 1008@172.23.4.92>;tag=7HUvrZpH3a9Up
From: 1018@123.58.160.154:36841;rinstance=0d9373ba78a06600>;tag=e243b65d
Call-ID: 30b8d974-3406-1236-52a1-00505683024d
CSeq: 2 BYE
User-Agent: X-Lite release 4.9.8 stamp 84253
Content-Length: 0
B. freeswitch回送200消息
freeswitch回送200消息,并释放b-leg
No. Time Source Destination Protocol Length Info
1829 32.682037 172.23.4.92 123.cc.cc.cc SIP 590 Status: 200 OK |
Frame 1829: 590 bytes on wire (4720 bits), 590 bytes captured (4720 bits)
Ethernet II, Src: Vmware_83:02:4d (00:50:56:83:02:4d), Dst: IETF-VRRP-VRID_04 (00:00:5e:00:01:04)
Internet Protocol Version 4, Src: 172.23.4.92, Dst: 123.58.160.154
User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 36841 (36841)
Session Initiation Protocol (200)
Status-Line: SIP/2.0 200 OK
Message Header
Via: SIP/2.0/UDP 10.240.80.146:49713;branch=z9hG4bK-524287-1---e2a3f037aa702259;rport=36841;received=123.58.160.154
From: <sip:1018@123.58.160.154:36841;rinstance=0d9373ba78a06600>;tag=e243b65d
To: "1008" <sip:1008@172.23.4.92>;tag=7HUvrZpH3a9Up
Call-ID: 30b8d974-3406-1236-52a1-00505683024d
CSeq: 2 BYE
User-Agent: FreeSWITCH-mod_sofia/1.6.19-36-7a77e0b~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Content-Length: 0
C. freeswitch向1008发送BYE消息
freeswitch向1008发送BYE消息,通知1008拆线
重要参数
No. Time Source Destination Protocol Length Info
1858 32.698972 172.23.4.92 59.bb.bb.bb SIP 661 Request: BYE sip:1008@59.bb.bb.bb:24576;rinstance=9d87a2b91a59c5b9 |
Frame 1858: 661 bytes on wire (5288 bits), 661 bytes captured (5288 bits)
Ethernet II, Src: Vmware_83:02:4d (00:50:56:83:02:4d), Dst: IETF-VRRP-VRID_04 (00:00:5e:00:01:04)
Internet Protocol Version 4, Src: 172.23.4.92, Dst: 59.bb.bb.bb
User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 24576 (24576)
Session Initiation Protocol (BYE)
Request-Line: BYE sip:1008@59.bb.bb.bb:24576;rinstance=9d87a2b91a59c5b9 SIP/2.0
Message Header
Via: SIP/2.0/UDP 115.aa.aa.aa;rport;branch=z9hG4bKarjQ9rmae389a
Max-Forwards: 70
From: 1018@115.aa.aa.aa:5060>;tag=6813p45D61j9a
To: "1008" 1008@115.aa.aa.aa:5060>;tag=54bd8d3a
Call-ID: 84253MGY3OGQwZWI1OGQ3YTRlZTYwZjQ3ZDZjZDhjNDNiMTU
CSeq: 114125039 BYE
User-Agent: FreeSWITCH-mod_sofia/1.6.19-36-7a77e0b~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Reason: Q.850;cause=16;text="NORMAL_CLEARING"
Content-Length: 0
D. 1008回送200消息
1008回送200消息, freeswitch收到后,也释放a-leg,通话结束
No. Time Source Destination Protocol Length Info
1879 32.818814 59.bb.bb.bb 172.23.4.92 SIP 459 Status: 200 OK |
Frame 1879: 459 bytes on wire (3672 bits), 459 bytes captured (3672 bits)
Ethernet II, Src: ZteCorpo_60:22:21 (00:22:93:60:22:21), Dst: Vmware_83:02:4d (00:50:56:83:02:4d)
Internet Protocol Version 4, Src: 59.bb.bb.bb, Dst: 172.23.4.92
User Datagram Protocol, Src Port: 24576 (24576), Dst Port: 5060 (5060)
Session Initiation Protocol (200)
Status-Line: SIP/2.0 200 OK
Message Header
Via: SIP/2.0/UDP 115.aa.aa.aa;rport=5060;branch=z9hG4bKarjQ9rmae389a
Contact: 1008@59.bb.bb.bb:24576;rinstance=9d87a2b91a59c5b9>
To: "1008"1008@115.aa.aa.aa:5060>;tag=54bd8d3a
From: 1018@115.aa.aa.aa:5060>;tag=6813p45D61j9a
Call-ID: 84253MGY3OGQwZWI1OGQ3YTRlZTYwZjQ3ZDZjZDhjNDNiMTU
CSeq: 114125039 BYE
User-Agent: X-Lite release 4.9.8 stamp 84253
Content-Length: 0
本文中的所有的图,都是作者用手机拍摄自图书”freeswitch权威指南”