webrtc janus服务器调试工具 admin api 详解(二)调试janus看这一篇就够了!!

在上一篇发布的时候离现在已经过去不少的时间, 这段时间也一直处理这个问题, 最终解决了它,因为自己内容的原因,自己也走不了少的弯路,比如增加一些配置问题, coturn在测试网站 是通的,但实际使用的时候是不通的, (具体原因还不了解)现在都解决了, 自己之前保存的也乱掉的,写的有些不好,以后想好会微调本博客

在调试janus的时候,因为底层是调用底层webrtc的api,包含http, https,websocket, ice连接,dtls连接,等许多传输方式,在外网调试的时候经常会遇到黑屏,光有声音没有画面等一系列问题, 但是遇到这些情况到底是什么原因引起的呢, 如果要根据日志, 其具体情况也是模糊不清的, 一些中间变量到底缺少什么呢, 这时就需要admin api, 这工具实在是太有用的。
浏览器也有一些中间情况的调试 比如,chrome浏览器 chrome://webrtc-internals firfox浏览器 about:webrtc, 但是别的端也没得工具了, 比如手机, 前段时间调试videocall功能, 手机端一直调试不通, 在疯狂找寻解决方案的时候,看到了admin api, 也利用这个工具解决的自己的问题。

成功的handles

{
    "session_id": 4709436143336474,
    "session_last_activity": 938106145327,
    "session_transport": "janus.transport.http",
    "handle_id": 5789998927964963,
    "opaque_id": "videocalltest-exp2R7ARfc2e",
    "loop-running": true,
    "created": 938056512086,
    "current_time": 938113653201,
    "plugin": "janus.plugin.videocall",
    "plugin_specific": {
        "state": "incall",
        "username": "11",
        "peer": "868047048785234",
        "audio_active": true,
        "video_active": true,
        "audio_codec": "opus",
        "video_codec": "vp8",
        "bitrate": 0,
        "slowlink_count": 0,
        "incall": 1,
        "hangingup": 0,
        "destroyed": 0
    },
    "flags": {
        "got-offer": true,
        "got-answer": true,
        "negotiated": true,
        "processing-offer": false,
        "starting": true,
        "ice-restart": false,
        "ready": true,
        "stopped": false,
        "alert": false,
        "trickle": true,
        "all-trickles": true,
        "resend-trickles": false,
        "trickle-synced": false,
        "data-channels": false,
        "has-audio": true,
        "has-video": true,
        "new-datachan-sdp": false,
        "rfc4588-rtx": true,
        "cleaning": false
    },
    "agent-created": 938100862880,
    "ice-mode": "full",
    "ice-role": "controlled",
    "sdps": {
        "profile": "UDP/TLS/RTP/SAVPF",
        "local": "v=0\r\no=- 6604980758976787289 2 IN IP4 139.198.21.32\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0 1\r\na=msid-semantic: WMS janus\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 126\r\nc=IN IP4 139.198.21.32\r\na=sendrecv\r\na=mid:0\r\na=rtcp-mux\r\na=ice-ufrag:VDh4\r\na=ice-pwd:BVY7eQtEfKPxnR0HLv6GLB\r\na=ice-options:trickle\r\na=fingerprint:sha-256 DA:BA:EE:27:78:AF:6D:72:78:8D:5D:13:65:94:BA:87:F2:98:49:30:55:C1:06:E6:79:D9:F4:3E:6C:5C:E8:8B\r\na=setup:active\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=rtpmap:111 opus/48000/2\r\na=fmtp:111 minptime=10; useinbandfec=1\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:104 ISAC/32000\r\na=rtpmap:9 G722/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:106 CN/32000\r\na=rtpmap:105 CN/16000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:126 telephone-event/8000\r\na=maxptime:60\r\na=msid:janus janusa0\r\na=ssrc:3007781558 cname:janus\r\na=ssrc:3007781558 msid:janus janusa0\r\na=ssrc:3007781558 mslabel:janus\r\na=ssrc:3007781558 label:janusa0\r\na=candidate:1 1 udp 2013266431 10.180.16.16 30341 typ host\r\na=candidate:2 1 udp 1677722111 139.198.21.32 30341 typ srflx raddr 10.180.16.16 rport 30341\r\na=end-of-candidates\r\nm=video 9 UDP/TLS/RTP/SAVPF 96 98 100 97 99 101\r\nc=IN IP4 139.198.21.32\r\na=sendrecv\r\na=mid:1\r\na=rtcp-mux\r\na=ice-ufrag:VDh4\r\na=ice-pwd:BVY7eQtEfKPxnR0HLv6GLB\r\na=ice-options:trickle\r\na=fingerprint:sha-256 DA:BA:EE:27:78:AF:6D:72:78:8D:5D:13:65:94:BA:87:F2:98:49:30:55:C1:06:E6:79:D9:F4:3E:6C:5C:E8:8B\r\na=setup:active\r\na=extmap:14 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:13 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:12 urn:3gpp:video-orientation\r\na=rtpmap:96 VP8/90000\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 nack\r\na=rtcp-fb:96 nack pli\r\na=rtcp-fb:96 goog-remb\r\na=rtcp-fb:96 transport-cc\r\na=rtpmap:98 VP9/90000\r\na=rtcp-fb:98 ccm fir\r\na=rtcp-fb:98 nack\r\na=rtcp-fb:98 nack pli\r\na=rtcp-fb:98 goog-remb\r\na=rtcp-fb:98 transport-cc\r\na=rtpmap:100 VP9/90000\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 nack pli\r\na=rtcp-fb:100 goog-remb\r\na=rtcp-fb:100 transport-cc\r\na=rtpmap:97 rtx/90000\r\na=fmtp:97 apt=96\r\na=rtpmap:99 rtx/90000\r\na=fmtp:99 apt=98\r\na=rtpmap:101 rtx/90000\r\na=fmtp:101 apt=100\r\na=ssrc-group:FID 1928236914 2073398329\r\na=msid:janus janusv0\r\na=ssrc:1928236914 cname:janus\r\na=ssrc:1928236914 msid:janus janusv0\r\na=ssrc:1928236914 mslabel:janus\r\na=ssrc:1928236914 label:janusv0\r\na=ssrc:2073398329 cname:janus\r\na=ssrc:2073398329 msid:janus janusv0\r\na=ssrc:2073398329 mslabel:janus\r\na=ssrc:2073398329 label:janusv0\r\na=candidate:1 1 udp 2013266431 10.180.16.16 30341 typ host\r\na=candidate:2 1 udp 1677722111 139.198.21.32 30341 typ srflx raddr 10.180.16.16 rport 30341\r\na=end-of-candidates\r\nm=application 0 UDP/DTLS/SCTP 0\r\nc=IN IP4 139.198.21.32\r\na=inactive\r\n",
        "remote": "v=0\r\no=- 815922366182672713 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0 1 2\r\na=msid-semantic: WMS hAHEZJCyj0sW6zXhQ4jeskuGEmrWiaUHtmww\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:aERs\r\na=ice-pwd:YwuQ9HVjbcV/CvcGeK1aIT3s\r\na=ice-options:trickle\r\na=fingerprint:sha-256 9C:8B:28:7F:97:7C:CA:B7:64:BC:46:5B:42:31:35:BA:B7:55:10:9F:C6:D9:DF:B9:E6:95:C7:93:3C:08:07:28\r\na=setup:actpass\r\na=mid:0\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:2 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\na=extmap:5 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\r\na=sendrecv\r\na=msid:hAHEZJCyj0sW6zXhQ4jeskuGEmrWiaUHtmww bf352498-e8f9-4eed-a554-3ec5e7ae7ca0\r\na=rtcp-mux\r\na=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=fmtp:111 minptime=10;useinbandfec=1\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:104 ISAC/32000\r\na=rtpmap:9 G722/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:106 CN/32000\r\na=rtpmap:105 CN/16000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:110 telephone-event/48000\r\na=rtpmap:112 telephone-event/32000\r\na=rtpmap:113 telephone-event/16000\r\na=rtpmap:126 telephone-event/8000\r\na=ssrc:3305798903 cname:qRF1CYUPDDog5DKD\r\na=ssrc:3305798903 msid:hAHEZJCyj0sW6zXhQ4jeskuGEmrWiaUHtmww bf352498-e8f9-4eed-a554-3ec5e7ae7ca0\r\na=ssrc:3305798903 mslabel:hAHEZJCyj0sW6zXhQ4jeskuGEmrWiaUHtmww\r\na=ssrc:3305798903 label:bf352498-e8f9-4eed-a554-3ec5e7ae7ca0\r\nm=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 102 122 127 121 125 107 108 109 124 120 123 119 114 115 116\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:aERs\r\na=ice-pwd:YwuQ9HVjbcV/CvcGeK1aIT3s\r\na=ice-options:trickle\r\na=fingerprint:sha-256 9C:8B:28:7F:97:7C:CA:B7:64:BC:46:5B:42:31:35:BA:B7:55:10:9F:C6:D9:DF:B9:E6:95:C7:93:3C:08:07:28\r\na=setup:actpass\r\na=mid:1\r\na=extmap:14 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:13 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:12 urn:3gpp:video-orientation\r\na=extmap:2 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:11 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\r\na=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type\r\na=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing\r\na=extmap:8 http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07\r\na=extmap:9 http://www.webrtc.org/experiments/rtp-hdrext/color-space\r\na=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\na=extmap:5 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\r\na=sendrecv\r\na=msid:hAHEZJCyj0sW6zXhQ4jeskuGEmrWiaUHtmww fa481682-cca4-48ba-b051-f854a8ffc039\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:96 VP8/90000\r\na=rtcp-fb:96 goog-remb\r\na=rtcp-fb:96 transport-cc\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 nack\r\na=rtcp-fb:96 nack pli\r\na=rtpmap:97 rtx/90000\r\na=fmtp:97 apt=96\r\na=rtpmap:98 VP9/90000\r\na=rtcp-fb:98 goog-remb\r\na=rtcp-fb:98 transport-cc\r\na=rtcp-fb:98 ccm fir\r\na=rtcp-fb:98 nack\r\na=rtcp-fb:98 nack pli\r\na=fmtp:98 profile-id=0\r\na=rtpmap:99 rtx/90000\r\na=fmtp:99 apt=98\r\na=rtpmap:100 VP9/90000\r\na=rtcp-fb:100 goog-remb\r\na=rtcp-fb:100 transport-cc\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 nack pli\r\na=fmtp:100 profile-id=2\r\na=rtpmap:101 rtx/90000\r\na=fmtp:101 apt=100\r\na=rtpmap:102 H264/90000\r\na=rtcp-fb:102 goog-remb\r\na=rtcp-fb:102 transport-cc\r\na=rtcp-fb:102 ccm fir\r\na=rtcp-fb:102 nack\r\na=rtcp-fb:102 nack pli\r\na=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f\r\na=rtpmap:122 rtx/90000\r\na=fmtp:122 apt=102\r\na=rtpmap:127 H264/90000\r\na=rtcp-fb:127 goog-remb\r\na=rtcp-fb:127 transport-cc\r\na=rtcp-fb:127 ccm fir\r\na=rtcp-fb:127 nack\r\na=rtcp-fb:127 nack pli\r\na=fmtp:127 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f\r\na=rtpmap:121 rtx/90000\r\na=fmtp:121 apt=127\r\na=rtpmap:125 H264/90000\r\na=rtcp-fb:125 goog-remb\r\na=rtcp-fb:125 transport-cc\r\na=rtcp-fb:125 ccm fir\r\na=rtcp-fb:125 nack\r\na=rtcp-fb:125 nack pli\r\na=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f\r\na=rtpmap:107 rtx/90000\r\na=fmtp:107 apt=125\r\na=rtpmap:108 H264/90000\r\na=rtcp-fb:108 goog-remb\r\na=rtcp-fb:108 transport-cc\r\na=rtcp-fb:108 ccm fir\r\na=rtcp-fb:108 nack\r\na=rtcp-fb:108 nack pli\r\na=fmtp:108 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f\r\na=rtpmap:109 rtx/90000\r\na=fmtp:109 apt=108\r\na=rtpmap:124 H264/90000\r\na=rtcp-fb:124 goog-remb\r\na=rtcp-fb:124 transport-cc\r\na=rtcp-fb:124 ccm fir\r\na=rtcp-fb:124 nack\r\na=rtcp-fb:124 nack pli\r\na=fmtp:124 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d0032\r\na=rtpmap:120 rtx/90000\r\na=fmtp:120 apt=124\r\na=rtpmap:123 H264/90000\r\na=rtcp-fb:123 goog-remb\r\na=rtcp-fb:123 transport-cc\r\na=rtcp-fb:123 ccm fir\r\na=rtcp-fb:123 nack\r\na=rtcp-fb:123 nack pli\r\na=fmtp:123 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640032\r\na=rtpmap:119 rtx/90000\r\na=fmtp:119 apt=123\r\na=rtpmap:114 red/90000\r\na=rtpmap:115 rtx/90000\r\na=fmtp:115 apt=114\r\na=rtpmap:116 ulpfec/90000\r\na=ssrc-group:FID 1419345867 4186372101\r\na=ssrc:1419345867 cname:qRF1CYUPDDog5DKD\r\na=ssrc:1419345867 msid:hAHEZJCyj0sW6zXhQ4jeskuGEmrWiaUHtmww fa481682-cca4-48ba-b051-f854a8ffc039\r\na=ssrc:1419345867 mslabel:hAHEZJCyj0sW6zXhQ4jeskuGEmrWiaUHtmww\r\na=ssrc:1419345867 label:fa481682-cca4-48ba-b051-f854a8ffc039\r\na=ssrc:4186372101 cname:qRF1CYUPDDog5DKD\r\na=ssrc:4186372101 msid:hAHEZJCyj0sW6zXhQ4jeskuGEmrWiaUHtmww fa481682-cca4-48ba-b051-f854a8ffc039\r\na=ssrc:4186372101 mslabel:hAHEZJCyj0sW6zXhQ4jeskuGEmrWiaUHtmww\r\na=ssrc:4186372101 label:fa481682-cca4-48ba-b051-f854a8ffc039\r\nm=application 9 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:aERs\r\na=ice-pwd:YwuQ9HVjbcV/CvcGeK1aIT3s\r\na=ice-options:trickle\r\na=fingerprint:sha-256 9C:8B:28:7F:97:7C:CA:B7:64:BC:46:5B:42:31:35:BA:B7:55:10:9F:C6:D9:DF:B9:E6:95:C7:93:3C:08:07:28\r\na=setup:actpass\r\na=mid:2\r\na=sctp-port:5000\r\na=max-message-size:262144\r\n"
    },
    "queued-packets": 0,
    "streams": [
        {
            "id": 1,
            "ready": -1,
            "ssrc": {
                "audio": 3007781558,
                "video": 1928236914,
                "video-rtx": 2073398329,
                "audio-peer": 3305798903,
                "video-peer": 1419345867,
                "video-peer-rtx": 4186372101
            },
            "direction": {
                "audio-send": true,
                "audio-recv": true,
                "video-send": true,
                "video-recv": true
            },
            "codecs": {
                "audio-pt": 111,
                "audio-codec": "opus",
                "video-pt": 96,
                "video-rtx-pt": 97,
                "video-codec": "vp8"
            },
            "bwe": {
                "twcc": true,
                "twcc-ext-id": 2
            },
            "rtcp_stats": {
                "audio": {
                    "base": 48000,
                    "rtt": 46,
                    "lost": 0,
                    "lost-by-remote": 0,
                    "jitter-local": 2,
                    "jitter-remote": 3,
                    "in-link-quality": 100,
                    "in-media-link-quality": 100,
                    "out-link-quality": 0,
                    "out-media-link-quality": 0
                },
                "video": {
                    "base": 90000,
                    "rtt": 45,
                    "lost": 0,
                    "lost-by-remote": 0,
                    "jitter-local": 4,
                    "jitter-remote": 10,
                    "in-link-quality": 100,
                    "in-media-link-quality": 100,
                    "out-link-quality": 100,
                    "out-media-link-quality": 100
                }
            },
            "components": [
                {
                    "id": 1,
                    "state": "ready",
                    "connected": 938104539138,
                    "local-candidates": [
                        "1 1 udp 2013266431 10.180.16.16 30341 typ host",
                        "2 1 udp 1677722111 139.198.21.32 30341 typ srflx raddr 10.180.16.16 rport 30341"
                    ],
                    "remote-candidates": [
                        "2205748223 1 udp 2122260223 192.168.0.244 49886 typ host generation 0 ufrag aERs network-id 1",
                        "remote1 1 udp 1853824767 171.217.92.33 2065 typ prflx raddr 171.217.92.33 rport 2065\r\n"
                    ],
                    "selected-pair": "139.198.21.32:30341 [srflx,udp] <-> 171.217.92.33:2065 [prflx,udp]",
                    "dtls": {
                        "fingerprint": "DA:BA:EE:27:78:AF:6D:72:78:8D:5D:13:65:94:BA:87:F2:98:49:30:55:C1:06:E6:79:D9:F4:3E:6C:5C:E8:8B",
                        "remote-fingerprint": "9C:8B:28:7F:97:7C:CA:B7:64:BC:46:5B:42:31:35:BA:B7:55:10:9F:C6:D9:DF:B9:E6:95:C7:93:3C:08:07:28",
                        "remote-fingerprint-hash": "sha-256",
                        "dtls-role": "active",
                        "dtls-state": "connected",
                        "retransmissions": 0,
                        "valid": true,
                        "srtp-profile": "SRTP_AES128_CM_SHA1_80",
                        "ready": true,
                        "handshake-started": 938104539150,
                        "connected": 938104638695
                    },
                    "in_stats": {
                        "audio_packets": 450,
                        "audio_bytes": 43277,
                        "audio_bytes_lastsec": 4855,
                        "do_audio_nacks": false,
                        "video_packets": 428,
                        "video_bytes": 352272,
                        "video_bytes_lastsec": 52000,
                        "do_video_nacks": true,
                        "video_nacks": 0,
                        "video_retransmissions": 0,
                        "data_packets": 2,
                        "data_bytes": 1804
                    },
                    "out_stats": {
                        "audio_packets": 430,
                        "audio_bytes": 33264,
                        "audio_bytes_lastsec": 3727,
                        "audio_nacks": 0,
                        "video_packets": 1420,
                        "video_bytes": 1558826,
                        "video_bytes_lastsec": 209718,
                        "video_nacks": 0,
                        "data_packets": 3,
                        "data_bytes": 1686
                    }
                }
            ]
        }
    ]
}

这是一个成功的handles, 这里面重要的是
1 sdps, 这里包含一个offer 和一个answer的sdp, 可以利用这个sdp查看一些连接的基本内容。
2 components, 这里包含 candidates的信息, dtls的信息。而components里的内容是我主要利用的内容。

  1. local-candidates 本地候选者,
  2. remote-candidates 远端候选者
  3. selected-pair 连接
  4. dtls dtls连接状态

失败例子1

"components": [
    {
        "id": 0,
        "state": "disconnected",
        "local-candidates": [
            "1 1 udp 2013266431 172.17.0.3 46008 typ host\r\n",
            "2 1 udp 2013266431 143.225.229.138 60710 typ host\r\n",
            "3 1 udp 2013266431 2002:8fe1:1cc3:b:5c48:51ff:fee9:11ef 58925 typ host\r\n",
            "4 1 udp 2013266431 fec0::b:5c48:51ff:fee9:11ef 52486 typ host\r\n"
        ],
        "dtls": {},
        "in_stats": {},
        "out_stats": {}
    }
]

state的状态是"disconnected", 这意味着根本没有启动连接状态检查, dtls的数据也是为空的, 这是什么原因引起的呢,这只有本地候选者, 没有远端候选者,这说明客户端没有上报信息到janus,janus没有信息所以建立不了连接。这时检查offersdp及回复的answer有什么问题。
失败例子2

"components": [
	{
		"id": 1,
		"state": "failed",
		"local-candidates": [
			"1 1 udp 2013266431 172.17.0.3 42083 typ host\r\n",
			"2 1 udp 2013266431 143.225.229.138 41619 typ host\r\n",
			"3 1 udp 2013266431 2002:8fe1:1cc3:b:5c48:51ff:fee9:11ef 46602 typ host\r\n",
			"4 1 udp 2013266431 fec0::b:5c48:51ff:fee9:11ef 33518 typ host\r\n"
		],
		"remote-candidates": [
			"1434301788 1 udp 2122260223 192.168.0.10 56611 typ host generation 0"
		],
		"dtls": {},
		"in_stats": {},
		"out_stats": {}
	}
]

这里的远端候选者的ip是一个本地ip, 不是一个公网ip, 这说明客户端上报的时候没有上报自己的公网ip,在做连接的时候两台机器不在一个内网环境的话,光本地ip是连接不通的, 引起的原因如下 :
1.缺少足够的数据来使ICE连接成功
2.网络问题, 防火墙或者别的原因引起的ICE连接不成功
3.客户端没有配置STUN服务器,
4.客户端配置了STUN服务器,但STUN服务器有问题或者连接STUN有问题

说明: janus服务需要ICE连接相互流转media数据的, 所以janus服务端要配置一个STUN, 而客户端也需要各自配置STUN服务,缺少一个都会导致不通。

失败例子3

"components": [
	{
		"id": 1,
		"state": "connected",
		"local-candidates": [
			"1 1 udp 2013266431 172.17.0.3 50886 typ host\r\n",
			"2 1 udp 2013266431 143.225.229.138 58254 typ host\r\n",
			"3 1 udp 2013266431 2002:8fe1:1cc3:b:5c48:51ff:fee9:11ef 49885 typ host\r\n",
			"4 1 udp 2013266431 fec0::b:5c48:51ff:fee9:11ef 50676 typ host\r\n"
		],
		"remote-candidates": [
			"1434301788 1 udp 2122260223 192.168.0.10 49782 typ host generation 0",
			"2741881992 1 udp 1686052607 95.247.194.217 49782 typ srflx raddr 192.168.0.10 rport 49782 generation 0"
		],
		"selected-pair": "2  2741881992",
		"dtls": {
			"fingerprint": "D2:B9:31:8F:DF:24:D8:0E:ED:D2:EF:25:9E:AF:6F:B8:34:AE:53:9C:E6:F3:8F:F2:64:15:FA:E8:7F:53:2D:38",
			"remote-fingerprint": "FF:12:C8:72:DA:61:86:E5:01:BD:C0:3C:BE:06:A9:E7:99:44:7B:A7:D2:B8:80:CA:D3:D8:FE:F2:5D:88:D1:21",
			"dtls-role": "passive",
			"dtls-state": "connected",
			"valid": 1,
			"ready": 1
		},
		"in_stats": {
			"audio_bytes": 0,
			"video_bytes": 0,
			"data_bytes": 900,
			"audio_nacks": 0,
			"video_nacks": 0,
			"audio_bytes_lastsec": 0,
			"video_bytes_lastsec": 0
		},
		"out_stats": {
			"audio_bytes": 0,
			"video_bytes": 0,
			"data_bytes": 1227,
			"audio_nacks": 0,
			"video_nacks": 0
		}
	}
]

这是ICE是成功的, dtls-state也是连接的, 但是数据流还是没有, 这可能 就是插件配置里的问题,可能是没有订阅或者 其他 的问题导致的。
失败例子4:

 "components": [
                {
                    "id": 1,
                    "state": "connecting",
                    "local-candidates": [
                        "1 1 udp 2013266431 10.180.16.16 21218 typ host"
                    ],
                    "remote-candidates": [
                        "1874011935 1 udp 2122260223 192.168.0.85 34949 typ host generation 0 ufrag PcfJPuJHsdXPdhEL"
                    ],
                    "dtls": {
                        "fingerprint": "DA:BA:EE:27:78:AF:6D:72:78:8D:5D:13:65:94:BA:87:F2:98:49:30:55:C1:06:E6:79:D9:F4:3E:6C:5C:E8:8B",
                        "remote-fingerprint": "A0:C6:38:91:03:39:10:BC:E0:EC:51:95:DB:44:66:61:94:66:86:D8:D7:B9:DF:79:E7:9F:92:F1:F5:20:45:72",
                        "remote-fingerprint-hash": "sha-256",
                        "dtls-role": "active",
                        "dtls-state": "created",
                        "retransmissions": 0,
                        "valid": false,
                        "srtp-profile": "none",
                        "ready": false
                    },
                    "in_stats": {
                        "audio_packets": 0,
                        "audio_bytes": 0,
                        "audio_bytes_lastsec": 0,
                        "do_audio_nacks": false,
                        "video_packets": 0,
                        "video_bytes": 0,
                        "video_bytes_lastsec": 0,
                        "do_video_nacks": true,
                        "video_nacks": 0,
                        "video_retransmissions": 0,
                        "data_packets": 0,
                        "data_bytes": 0
                    },
                    "out_stats": {
                        "audio_packets": 0,
                        "audio_bytes": 0,
                        "audio_bytes_lastsec": 0,
                        "audio_nacks": 0,
                        "video_packets": 0,
                        "video_bytes": 0,
                        "video_bytes_lastsec": 0,
                        "video_nacks": 0,
                        "data_packets": 0,
                        "data_bytes": 0
                    }
                }
            ]

ice连接失败,创建 selected-pair失败是ice_lite janus在janus配置支持ICE_LITE的时候报的错, 这导致的原因是STUN服务和janus配置不一致
失败例子5

"components": [
                {
                    "id": 1,
                    "state": "failed",
                    "failed-detected": 941643429515,
                    "icetimer-started": true,
                    "local-candidates": [
                        "1 1 udp 2013266431 10.180.16.16 28940 typ host",
                        "2 1 udp 1677722111 139.198.21.32 28940 typ srflx raddr 10.180.16.16 rport 28940"
                    ],
                    "remote-candidates": [
                        "1874011935 1 udp 2122260223 192.168.0.85 45539 typ host generation 0 ufrag KCkidTnB/c3JOLqJ"
                    ],
                    "dtls": {
                        "fingerprint": "DA:BA:EE:27:78:AF:6D:72:78:8D:5D:13:65:94:BA:87:F2:98:49:30:55:C1:06:E6:79:D9:F4:3E:6C:5C:E8:8B",
                        "remote-fingerprint": "4B:2A:B6:E8:C9:BB:EE:97:C4:AC:5D:A2:7F:C8:78:20:57:BC:D0:38:16:A7:98:5E:78:0B:86:CE:C2:38:CD:08",
                        "remote-fingerprint-hash": "sha-256",
                        "dtls-role": "active",
                        "dtls-state": "created",
                        "retransmissions": 0,
                        "valid": false,
                        "srtp-profile": "none",
                        "ready": false
                    },

这个是janus full_trickle时,STUN服务跟janus不一致导致的。这些都 是ICE连接的失败。

你可能感兴趣的:(webrtc)