• 一次完整的通话过程SIP报文分析


    场景:

    主叫方(1004,Yate客户端,端口号:52110) -> 通过FreeSWITCH(端口号:5070)呼叫 -> 被叫方(1000,ZoIPer客户端,端口号:5070)

    被叫方经历:振铃->(N秒后)接听->正常通话一段时间后->挂断电话。

    注:主叫、被叫、FreeSWITCH均在同1个机器(mac本上)

    为了方便分析SIP报文,有2种方法:

    1、freeswitch开启sip报文debug

    sofia profile internal siptrace on
    

    freeswitch控制台上,输入上述命令,即可开始记录SIP报文,上述通话过程,输出的报文日志如下(注:为了方便查看,每段报文手动加了序号)

    1-> recv 903 bytes from udp/[192.168.7.101]:52110 at 20:07:57.811303:
    ------------------------------------------------------------------------
    INVITE sip:1000@192.168.7.101 SIP/2.0
    Max-Forwards: 20
    Via: SIP/2.0/UDP 192.168.7.101:52110;rport;branch=z9hG4bK1749195434
    From: <sip:1004@192.168.7.101>;tag=106736978
    To: <sip:1000@192.168.7.101>
    Call-ID: 1808150176@192.168.7.101
    CSeq: 5 INVITE
    User-Agent: YATE/5.5.0
    Contact: <sip:1004@192.168.7.101:52110>
    Allow: ACK, INVITE, BYE, CANCEL, OPTIONS, INFO
    Content-Type: application/sdp
    Content-Length: 483
    
    v=0
    o=yate 1621771677 1621771677 IN IP4 192.168.7.101
    s=SIP Call
    c=IN IP4 192.168.7.101
    t=0 0
    m=audio 20902 RTP/AVP 0 8 11 98 97 102 103 104 105 106 101
    a=rtpmap:0 PCMU/8000
    a=rtpmap:8 PCMA/8000
    a=rtpmap:11 L16/8000
    a=rtpmap:98 iLBC/8000
    a=fmtp:98 mode=20
    a=rtpmap:97 iLBC/8000
    a=fmtp:97 mode=30
    a=rtpmap:102 SPEEX/8000
    a=rtpmap:103 SPEEX/16000
    a=rtpmap:104 SPEEX/32000
    a=rtpmap:105 iSAC/16000
    a=rtpmap:106 iSAC/32000
    a=rtpmap:101 telephone-event/8000
    a=ptime:30
    2021-05-23 20:07:57.808015 [NOTICE] switch_channel.c:1118 New Channel sofia/internal/1004@192.168.7.101 [e343d2cb-fef0-4f00-b83d-743a9b05b6f0]
    
    
    
    2 -> send 802 bytes to udp/[192.168.7.101]:52110 at 20:07:57.814089:
    ------------------------------------------------------------------------
    SIP/2.0 407 Proxy Authentication Required
    Via: SIP/2.0/UDP 192.168.7.101:52110;rport=52110;branch=z9hG4bK1749195434
    From: <sip:1004@192.168.7.101>;tag=106736978
    To: <sip:1000@192.168.7.101>;tag=4c1tpQSFK9t3D
    Call-ID: 1808150176@192.168.7.101
    CSeq: 5 INVITE
    User-Agent: FreeSWITCH-mod_sofia/1.10.2-release~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
    Proxy-Authenticate: Digest realm="192.168.7.101", nonce="cf2b5f97-bf80-4637-9a38-5b5807386f0b", algorithm=MD5, qop="auth"
    Content-Length: 0
    
    
    
    3 -> recv 351 bytes from udp/[192.168.7.101]:52110 at 20:07:57.833718:
    ------------------------------------------------------------------------
    ACK sip:1000@192.168.7.101 SIP/2.0
    Via: SIP/2.0/UDP 192.168.7.101:52110;rport;branch=z9hG4bK1749195434
    From: <sip:1004@192.168.7.101>;tag=106736978
    To: <sip:1000@192.168.7.101>;tag=4c1tpQSFK9t3D
    Call-ID: 1808150176@192.168.7.101
    CSeq: 5 ACK
    Max-Forwards: 20
    Contact: <sip:1004@192.168.7.101:52110>
    User-Agent: YATE/5.5.0
    Content-Length: 0
    
    
    
    4 -> recv 1173 bytes from udp/[192.168.7.101]:52110 at 20:07:57.833904:
    ------------------------------------------------------------------------
    INVITE sip:1000@192.168.7.101 SIP/2.0
    Max-Forwards: 20
    Via: SIP/2.0/UDP 192.168.7.101:52110;rport;branch=z9hG4bK1194732859
    From: <sip:1004@192.168.7.101>;tag=106736978
    To: <sip:1000@192.168.7.101>
    Call-ID: 1808150176@192.168.7.101
    User-Agent: YATE/5.5.0
    Contact: <sip:1004@192.168.7.101:52110>
    Allow: ACK, INVITE, BYE, CANCEL, OPTIONS, INFO
    CSeq: 6 INVITE
    Proxy-Authorization: Digest username="1004", realm="192.168.7.101", nonce="cf2b5f97-bf80-4637-9a38-5b5807386f0b", uri="sip:1000@192.168.7.101", response="1318d10a492939a03eda60e7f0e9deed", algorithm=MD5, qop=auth, nc=0000000c, cnonce="5c5fdd612beb705f0cb01343ff044de7"
    Content-Type: application/sdp
    Content-Length: 483
    
    v=0
    o=yate 1621771677 1621771677 IN IP4 192.168.7.101
    s=SIP Call
    c=IN IP4 192.168.7.101
    t=0 0
    m=audio 20902 RTP/AVP 0 8 11 98 97 102 103 104 105 106 101
    a=rtpmap:0 PCMU/8000
    a=rtpmap:8 PCMA/8000
    a=rtpmap:11 L16/8000
    a=rtpmap:98 iLBC/8000
    a=fmtp:98 mode=20
    a=rtpmap:97 iLBC/8000
    a=fmtp:97 mode=30
    a=rtpmap:102 SPEEX/8000
    a=rtpmap:103 SPEEX/16000
    a=rtpmap:104 SPEEX/32000
    a=rtpmap:105 iSAC/16000
    a=rtpmap:106 iSAC/32000
    a=rtpmap:101 telephone-event/8000
    a=ptime:30
    2021-05-23 20:07:57.848628 [INFO] mod_dialplan_xml.c:637 Processing 1004 <1004>->1000 in context default
    
    
    
    5 -> send 298 bytes to udp/[192.168.7.101]:52110 at 20:07:57.855169:
    ------------------------------------------------------------------------
    SIP/2.0 100 Trying
    Via: SIP/2.0/UDP 192.168.7.101:52110;rport=52110;branch=z9hG4bK1194732859
    From: <sip:1004@192.168.7.101>;tag=106736978
    To: <sip:1000@192.168.7.101>
    Call-ID: 1808150176@192.168.7.101
    CSeq: 6 INVITE
    User-Agent: FreeSWITCH-mod_sofia/1.10.2-release~64bit
    Content-Length: 0
    
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 log(CRIT WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING )
    2021-05-23 20:07:57.848628 [CRIT] mod_dptools.c:1866 WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 log(CRIT Open /usr/local/freeswitch/conf/vars.xml and change the default_password.)
    2021-05-23 20:07:57.848628 [CRIT] mod_dptools.c:1866 Open /usr/local/freeswitch/conf/vars.xml and change the default_password.
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 log(CRIT Once changed type 'reloadxml' at the console.)
    2021-05-23 20:07:57.848628 [CRIT] mod_dptools.c:1866 Once changed type 'reloadxml' at the console.
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 log(CRIT WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING )
    2021-05-23 20:07:57.848628 [CRIT] mod_dptools.c:1866 WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 sleep(10000)
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 hash(insert/192.168.7.101-spymap/1004/e343d2cb-fef0-4f00-b83d-743a9b05b6f0)
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 hash(insert/192.168.7.101-last_dial/1004/1000)
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 hash(insert/192.168.7.101-last_dial/global/e343d2cb-fef0-4f00-b83d-743a9b05b6f0)
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 export(RFC2822_DATE=Sun, 23 May 2021 20:08:06 +0800)
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 export(dialed_extension=1000)
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 bind_meta_app(1 b s execute_extension::dx XML features)
    2021-05-23 20:08:06.698015 [INFO] switch_ivr_async.c:4465 Bound B-Leg: *1 execute_extension::dx XML features
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 bind_meta_app(2 b s record_session::/usr/local/freeswitch/recordings/1004.2021-05-23-20-08-06.wav)
    2021-05-23 20:08:06.698015 [INFO] switch_ivr_async.c:4465 Bound B-Leg: *2 record_session::/usr/local/freeswitch/recordings/1004.2021-05-23-20-08-06.wav
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 bind_meta_app(3 b s execute_extension::cf XML features)
    2021-05-23 20:08:06.698015 [INFO] switch_ivr_async.c:4465 Bound B-Leg: *3 execute_extension::cf XML features
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 bind_meta_app(4 b s execute_extension::att_xfer XML features)
    2021-05-23 20:08:06.698015 [INFO] switch_ivr_async.c:4465 Bound B-Leg: *4 execute_extension::att_xfer XML features
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 set(ringback=%(2000,4000,440,480))
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 set(transfer_ringback=local_stream://moh)
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 set(call_timeout=30)
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 set(hangup_after_bridge=true)
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 set(continue_on_fail=true)
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 hash(insert/192.168.7.101-call_return/1000/1004)
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 hash(insert/192.168.7.101-last_dial_ext/1000/e343d2cb-fef0-4f00-b83d-743a9b05b6f0)
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 set(called_party_callgroup=techsupport)
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 hash(insert/192.168.7.101-last_dial_ext/techsupport/e343d2cb-fef0-4f00-b83d-743a9b05b6f0)
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 hash(insert/192.168.7.101-last_dial_ext/global/e343d2cb-fef0-4f00-b83d-743a9b05b6f0)
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 hash(insert/192.168.7.101-last_dial/techsupport/e343d2cb-fef0-4f00-b83d-743a9b05b6f0)
    EXECUTE [depth=0] sofia/internal/1004@192.168.7.101 bridge(user/1000@192.168.7.101)
    2021-05-23 20:08:06.698015 [NOTICE] switch_channel.c:1118 New Channel sofia/internal/1000@192.168.7.101:5060 [0c2ec47e-f3a6-4e74-8565-c523b5547d1f]
    2021-05-23 20:08:06.708027 [NOTICE] switch_ivr_originate.c:2955 Cannot create outgoing channel of type [error] cause: [USER_NOT_REGISTERED]
    
    
    
    
    6 -> send 1241 bytes to udp/[192.168.7.101]:5060 at 20:08:06.709329:
    ------------------------------------------------------------------------
    INVITE sip:1000@192.168.7.101:5060;rinstance=00eb482b7d4631f5 SIP/2.0
    Via: SIP/2.0/UDP 192.168.7.101:5070;rport;branch=z9hG4bKKS6jBryj6cv7c
    Max-Forwards: 19
    From: "Extension 1004" <sip:1004@192.168.7.101>;tag=6yKctDUpDU78m
    To: <sip:1000@192.168.7.101:5060;rinstance=00eb482b7d4631f5>
    Call-ID: 5fcdc4bf-3662-123a-9a87-1158c9642285
    CSeq: 36332051 INVITE
    Contact: <sip:mod_sofia@192.168.7.101:5070>
    User-Agent: FreeSWITCH-mod_sofia/1.10.2-release~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: 246
    X-FS-Support: update_display,send_info
    Remote-Party-ID: "Extension 1004" <sip:1004@192.168.7.101>;party=calling;screen=yes;privacy=off
    
    v=0
    o=FreeSWITCH 1621743220 1621743221 IN IP4 192.168.7.101
    s=FreeSWITCH
    c=IN IP4 192.168.7.101
    t=0 0
    m=audio 28466 RTP/AVP 0 8 101
    a=rtpmap:0 PCMU/8000
    a=rtpmap:8 PCMA/8000
    a=rtpmap:101 telephone-event/8000
    a=fmtp:101 0-16
    a=ptime:30
    
    
    
    
    7 -> recv 425 bytes from udp/[192.168.7.101]:5060 at 20:08:06.764337:
    ------------------------------------------------------------------------
    SIP/2.0 180 Ringing
    Via: SIP/2.0/UDP 192.168.7.101:5070;rport=5070;branch=z9hG4bKKS6jBryj6cv7c
    Contact: <sip:1000@192.168.7.101:5060;rinstance=00eb482b7d4631f5>
    To: <sip:1000@192.168.7.101:5060;rinstance=00eb482b7d4631f5>;tag=03fd6964
    From: "Extension 1004"<sip:1004@192.168.7.101>;tag=6yKctDUpDU78m
    Call-ID: 5fcdc4bf-3662-123a-9a87-1158c9642285
    CSeq: 36332051 INVITE
    User-Agent: Zoiper rev.1809
    Content-Length: 0
    
    2021-05-23 20:08:06.775511 [NOTICE] sofia.c:7412 Ring-Ready sofia/internal/1000@192.168.7.101:5060!
    2021-05-23 20:08:06.793301 [INFO] switch_ivr_originate.c:1246 Sending early media
    2021-05-23 20:08:06.810398 [NOTICE] sofia_media.c:92 Pre-Answer sofia/internal/1004@192.168.7.101!
    
    
    
    
    8 ->  send 1091 bytes to udp/[192.168.7.101]:52110 at 20:08:06.821167:
    ------------------------------------------------------------------------
    SIP/2.0 183 Session Progress
    Via: SIP/2.0/UDP 192.168.7.101:52110;rport=52110;branch=z9hG4bK1194732859
    From: <sip:1004@192.168.7.101>;tag=106736978
    To: <sip:1000@192.168.7.101>;tag=5NtKrjaKgjHpS
    Call-ID: 1808150176@192.168.7.101
    CSeq: 6 INVITE
    Contact: <sip:1000@192.168.7.101:5070;transport=udp>
    User-Agent: FreeSWITCH-mod_sofia/1.10.2-release~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: 222
    Remote-Party-ID: "1000" <sip:1000@192.168.7.101>;party=calling;privacy=off;screen=no
    
    v=0
    o=FreeSWITCH 1621743230 1621743231 IN IP4 192.168.7.101
    s=FreeSWITCH
    c=IN IP4 192.168.7.101
    t=0 0
    m=audio 28456 RTP/AVP 0 101
    a=rtpmap:0 PCMU/8000
    a=rtpmap:101 telephone-event/8000
    a=fmtp:101 0-16
    a=ptime:30
    2021-05-23 20:08:07.618015 [WARNING] switch_core_media.c:3192 [CBR]: Asynchronous PTIME not supported, changing our end from 30 to 20
    
    
    
    9 -> recv 840 bytes from udp/[192.168.7.101]:5060 at 20:08:21.972451:
    ------------------------------------------------------------------------
    SIP/2.0 200 OK
    Via: SIP/2.0/UDP 192.168.7.101:5070;rport=5070;branch=z9hG4bKKS6jBryj6cv7c
    Contact: <sip:1000@192.168.7.101:5060;rinstance=00eb482b7d4631f5>
    To: <sip:1000@192.168.7.101:5060;rinstance=00eb482b7d4631f5>;tag=03fd6964
    From: "Extension 1004"<sip:1004@192.168.7.101>;tag=6yKctDUpDU78m
    Call-ID: 5fcdc4bf-3662-123a-9a87-1158c9642285
    CSeq: 36332051 INVITE
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO
    Content-Type: application/sdp
    User-Agent: Zoiper rev.1809
    Content-Length: 306
    
    v=0
    o=Z 0 0 IN IP4 192.168.7.101
    s=Z
    c=IN IP4 192.168.7.101
    t=0 0
    m=audio 8000 RTP/AVP 0 3 110 98 8 101
    a=rtpmap:0 PCMU/8000
    a=rtpmap:3 GSM/8000
    a=rtpmap:110 speex/8000
    a=rtpmap:98 iLBC/8000
    a=fmtp:98 mode=30
    a=rtpmap:8 PCMA/8000
    a=rtpmap:101 telephone-event/8000
    a=fmtp:101 0-15
    a=sendrecv
    
    
    
    10 -> send 432 bytes to udp/[192.168.7.101]:5060 at 20:08:21.975783:
    ------------------------------------------------------------------------
    ACK sip:1000@192.168.7.101:5060;rinstance=00eb482b7d4631f5 SIP/2.0
    Via: SIP/2.0/UDP 192.168.7.101:5070;rport;branch=z9hG4bKm2ZBDKFp3Njtr
    Max-Forwards: 70
    From: "Extension 1004" <sip:1004@192.168.7.101>;tag=6yKctDUpDU78m
    To: <sip:1000@192.168.7.101:5060;rinstance=00eb482b7d4631f5>;tag=03fd6964
    Call-ID: 5fcdc4bf-3662-123a-9a87-1158c9642285
    CSeq: 36332051 ACK
    Contact: <sip:mod_sofia@192.168.7.101:5070>
    Content-Length: 0
    
    
    
    
    2021-05-23 20:08:21.978841 [NOTICE] sofia.c:8479 Channel [sofia/internal/1000@192.168.7.101:5060] has been answered
    11 -> send 1061 bytes to udp/[192.168.7.101]:52110 at 20:08:22.005595:
    ------------------------------------------------------------------------
    SIP/2.0 200 OK
    Via: SIP/2.0/UDP 192.168.7.101:52110;rport=52110;branch=z9hG4bK1194732859
    From: <sip:1004@192.168.7.101>;tag=106736978
    To: <sip:1000@192.168.7.101>;tag=5NtKrjaKgjHpS
    Call-ID: 1808150176@192.168.7.101
    CSeq: 6 INVITE
    Contact: <sip:1000@192.168.7.101:5070;transport=udp>
    User-Agent: FreeSWITCH-mod_sofia/1.10.2-release~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: 222
    Remote-Party-ID: "Outbound Call" <sip:1000@192.168.7.101>;party=calling;privacy=off;screen=no
    
    v=0
    o=FreeSWITCH 1621743230 1621743231 IN IP4 192.168.7.101
    s=FreeSWITCH
    c=IN IP4 192.168.7.101
    t=0 0
    m=audio 28456 RTP/AVP 0 101
    a=rtpmap:0 PCMU/8000
    a=rtpmap:101 telephone-event/8000
    a=fmtp:101 0-16
    a=ptime:30
    2021-05-23 20:08:21.998639 [NOTICE] switch_ivr_originate.c:3751 Channel [sofia/internal/1004@192.168.7.101] has been answered
    
    
    
    12 -> recv 639 bytes from udp/[192.168.7.101]:52110 at 20:08:22.012161:
    ------------------------------------------------------------------------
    ACK sip:1000@192.168.7.101:5070;transport=udp SIP/2.0
    Via: SIP/2.0/UDP 192.168.7.101:52110;rport;branch=z9hG4bK411043961
    From: <sip:1004@192.168.7.101>;tag=106736978
    To: <sip:1000@192.168.7.101>;tag=5NtKrjaKgjHpS
    Call-ID: 1808150176@192.168.7.101
    CSeq: 6 ACK
    Max-Forwards: 20
    Contact: <sip:1004@192.168.7.101:52110>
    Proxy-Authorization: Digest username="1004", realm="192.168.7.101", nonce="cf2b5f97-bf80-4637-9a38-5b5807386f0b", uri="sip:1000@192.168.7.101", response="1318d10a492939a03eda60e7f0e9deed", algorithm=MD5, qop=auth, nc=0000000c, cnonce="5c5fdd612beb705f0cb01343ff044de7"
    User-Agent: YATE/5.5.0
    Content-Length: 0
    
    2021-05-23 20:08:22.258073 [WARNING] switch_core_media.c:3192 [CBR]: Asynchronous PTIME not supported, changing our end from 30 to 20
    
    
    
    
    13 -> recv 476 bytes from udp/[192.168.7.101]:5060 at 20:08:47.008280:
    ------------------------------------------------------------------------
    BYE sip:mod_sofia@192.168.7.101:5070 SIP/2.0
    Via: SIP/2.0/UDP 192.168.7.101:5060;branch=z9hG4bK-d8754z-1ad0fd1d257abc86-1---d8754z-;rport
    Max-Forwards: 70
    Contact: <sip:1000@192.168.7.101:5060;rinstance=00eb482b7d4631f5>
    To: "Extension 1004"<sip:1004@192.168.7.101>;tag=6yKctDUpDU78m
    From: <sip:1000@192.168.7.101:5060;rinstance=00eb482b7d4631f5>;tag=03fd6964
    Call-ID: 5fcdc4bf-3662-123a-9a87-1158c9642285
    CSeq: 2 BYE
    User-Agent: Zoiper rev.1809
    Content-Length: 0
    
    2021-05-23 20:08:47.018016 [NOTICE] sofia.c:1089 Hangup sofia/internal/1000@192.168.7.101:5060 [CS_EXCHANGE_MEDIA] [NORMAL_CLEARING]
    
    
    
    
    
    14 -> send 536 bytes to udp/[192.168.7.101]:5060 at 20:08:47.020434:
    ------------------------------------------------------------------------
    SIP/2.0 200 OK
    Via: SIP/2.0/UDP 192.168.7.101:5060;branch=z9hG4bK-d8754z-1ad0fd1d257abc86-1---d8754z-;rport=5060
    From: <sip:1000@192.168.7.101:5060;rinstance=00eb482b7d4631f5>;tag=03fd6964
    To: "Extension 1004"<sip:1004@192.168.7.101>;tag=6yKctDUpDU78m
    Call-ID: 5fcdc4bf-3662-123a-9a87-1158c9642285
    CSeq: 2 BYE
    User-Agent: FreeSWITCH-mod_sofia/1.10.2-release~64bit
    Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
    Supported: timer, path, replaces
    Content-Length: 0
    
    2021-05-23 20:08:47.038076 [NOTICE] switch_ivr_bridge.c:1947 Hangup sofia/internal/1004@192.168.7.101 [CS_EXECUTE] [NORMAL_CLEARING]
    2021-05-23 20:08:47.038076 [NOTICE] switch_core_session.c:1744 Session 9 (sofia/internal/1000@192.168.7.101:5060) Ended
    2021-05-23 20:08:47.038076 [NOTICE] switch_core_session.c:1748 Close Channel sofia/internal/1000@192.168.7.101:5060 [CS_DESTROY]
    
    
    
    
    15 -> send 547 bytes to udp/[192.168.7.101]:52110 at 20:08:47.051274:
    ------------------------------------------------------------------------
    BYE sip:1004@192.168.7.101:52110 SIP/2.0
    Via: SIP/2.0/UDP 192.168.7.101:5070;rport;branch=z9hG4bKNBS4ee0S0y8cm
    Max-Forwards: 70
    From: <sip:1000@192.168.7.101>;tag=5NtKrjaKgjHpS
    To: <sip:1004@192.168.7.101>;tag=106736978
    Call-ID: 1808150176@192.168.7.101
    CSeq: 36332071 BYE
    User-Agent: FreeSWITCH-mod_sofia/1.10.2-release~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
    
    2021-05-23 20:08:47.058169 [NOTICE] switch_core_session.c:1744 Session 8 (sofia/internal/1004@192.168.7.101) Ended
    2021-05-23 20:08:47.058169 [NOTICE] switch_core_session.c:1748 Close Channel sofia/internal/1004@192.168.7.101 [CS_DESTROY]
    
    
    
    
    16 -> recv 309 bytes from udp/[192.168.7.101]:52110 at 20:08:47.085929:
    ------------------------------------------------------------------------
    SIP/2.0 100 Trying
    Via: SIP/2.0/UDP 192.168.7.101:5070;rport=5070;branch=z9hG4bKNBS4ee0S0y8cm;received=192.168.7.101
    From: <sip:1000@192.168.7.101>;tag=5NtKrjaKgjHpS
    To: <sip:1004@192.168.7.101>;tag=106736978
    Call-ID: 1808150176@192.168.7.101
    CSeq: 36332071 BYE
    Server: YATE/5.5.0
    Content-Length: 0
    
    
    
    
    17 -> recv 409 bytes from udp/[192.168.7.101]:52110 at 20:08:47.116921:
    ------------------------------------------------------------------------
    SIP/2.0 200 OK
    Via: SIP/2.0/UDP 192.168.7.101:5070;rport=5070;branch=z9hG4bKNBS4ee0S0y8cm;received=192.168.7.101
    From: <sip:1000@192.168.7.101>;tag=5NtKrjaKgjHpS
    To: <sip:1004@192.168.7.101>;tag=106736978
    Call-ID: 1808150176@192.168.7.101
    CSeq: 36332071 BYE
    P-RTP-Stat: PS=1986,OS=317760,PR=1987,OR=319520,PL=887
    Server: YATE/5.5.0
    Allow: ACK, INVITE, BYE, CANCEL, OPTIONS, INFO
    Content-Length: 0
    

      

    2、采用wireshark抓包

    共17条SIP报文。

    梳理成时序图如下: 

    上图中,每1条最后的“-xx秒”,是根据wireshark中抓包截图中的Time列填上的,代表开始抓包后的第N秒截取到的包,从时间和CSeq大致可以看出来:

    1-5 为主叫发起呼叫阶段

    6-8 为被叫振铃阶段

    9-12 为应答通话阶段

    13-17 为挂断阶段

    作者:菩提树下的杨过
    出处:http://yjmyzz.cnblogs.com
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    bzoj3771 Triple
    【BZOJ-1597】土地购买 DP + 斜率优化
    【BZOJ-1911】特别行动队 DP + 斜率优化
    【BZOJ-3144】切糕 最小割-最大流
    【BZOJ-2095】Bridge 最大流 + 混合图欧拉回路 + 二分
    【BZOJ-3996】线性代数 最小割-最大流
    【BZOJ-1497】最大获利 最大流
    【BZOJ-1500】维修数列 Splay
    【BZOJ-1458】士兵占领 最大流
    【BZOJ-3626】LCA 树链剖分
  • 原文地址:https://www.cnblogs.com/yjmyzz/p/sip-packet-analysis-during-one-call.html
Copyright © 2020-2023  润新知