我已成功注册通过SIP,但无法连接到webRTC。
有谁能想到我们如何将SIP与webRTC连接起来呢?
请帮帮我们,我们有麻烦了。
发布于 2020-01-07 04:47:03
为了在SIP和Webrtc之间进行互操作,您需要在两个层上解决问题:
最后,Webrtc和SIP都在使用SDP来设置媒体会话,您需要集中精力在Webrtc代理和SIP代理端的SDP中提供相同的功能支持。
为了做到这一点,你需要:
如果我是正确的,从您的问题,您已经注册了一个SIP服务的webrtc代理?无论如何,您可能已经使用过的解决方案使用javascript堆栈(如JsSIP )。此堆栈正在为webrtc代理实现缺少的SIP协议层。它可以用于通过websocket向SIP服务(如kamailio )发送寄存器。JsSIP还可以用Webrtc生成的SDP发送INVITE。
一旦注册了webrtc代理,就可以调用SIP代理。
下一步是让SIP代理能够与Webrtc发送的SDP进行互操作。Webrtc的SDP需要实现和协商许多特性。否则,SDP谈判将在Webrtc方面失败。
在webrtc上对SDP的要求是:-使用OPUS编解码器用于音频(PCMU或PCMA也可以工作)--使用VP8、VP9、H264作为视频。(取决于浏览器?)-使用UDP/TLS/ RTP /SAVPF配置文件(而不是RTP/AVP) -使用DTLS进行媒体加密-使用RTCP反馈,例如GOOG、TMMBR、PLI、NACK -对RTP和RTCP (使用相同的套接字)使用muxing对音频和视频流(使用相同的套接字)-使用ICE建立和验证本地、存根和切换候选的流-一些其他编解码器或可选扩展,如"ssrc“和"extmap”属性.
下面是使用JsSIP和当前Chrome的webrtc的SDP示例:
INVITE sip:antisip@sip.antisip.com SIP/2.0
Via: SIP/2.0/WSS 23g0dst83l03.invalid;branch=z9hG4bK9183549
Max-Forwards: 69
To: <sip:antisip@sip.antisip.com>
From: "test61" <sip:test61@sip.antisip.com>;tag=ug27evkg8b
Call-ID: fgk6v33jjsmcqkec4hnk
CSeq: 1493 INVITE
Proxy-Authorization: Digest algorithm=MD5, username="test61", realm="sip.antisip.com", nonce="XhRyf14UcVN1NxxGnK1M2SSNNMCCeN28/hp17aOPbPRx6h7r++W5Ng==", uri="sip:antisip@sip.antisip.com", response="801f72fe7a2d95aa21b8b7ab7eb45930", qop=auth, cnonce="bka9v71mqbqu", nc=00000001
Contact: <sip:test61@sip.antisip.com;gr=urn:uuid:01542fc1-e3d6-4e92-a032-5c5378bff6c1>
Content-Type: application/sdp
Session-Expires: 90
Allow: INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY
Supported: timer,gruu,ice,replaces,outbound
User-Agent: JsSIP 3.3.11
Content-Length: 9992
v=0
o=- 6413630617983761779 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0 1
a=msid-semantic: WMS WUvtnpqd3NIpvzakhMqR4QQ308BUCsNHi75U
m=audio 62668 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126
c=IN IP4 90.66.179.60
a=rtcp:62672 IN IP4 90.66.179.60
a=candidate:3769397851 1 udp 2122262783 2a01:cb14:7c1:7f00:1d76:e7d4:3237:e96f 62665 typ host generation 0 network-id 3
a=candidate:2805962766 1 udp 2122197247 2a01:cb14:7c1:7f00:f961:60c1:70f1:25a0 62666 typ host generation 0 network-id 4
a=candidate:2999745851 1 udp 2122129151 192.168.56.1 62667 typ host generation 0 network-id 1
a=candidate:4077567720 1 udp 2122063615 192.168.1.10 62668 typ host generation 0 network-id 2
a=candidate:3769397851 2 udp 2122262782 2a01:cb14:7c1:7f00:1d76:e7d4:3237:e96f 62669 typ host generation 0 network-id 3
a=candidate:2805962766 2 udp 2122197246 2a01:cb14:7c1:7f00:f961:60c1:70f1:25a0 62670 typ host generation 0 network-id 4
a=candidate:2999745851 2 udp 2122129150 192.168.56.1 62671 typ host generation 0 network-id 1
a=candidate:4077567720 2 udp 2122063614 192.168.1.10 62672 typ host generation 0 network-id 2
a=candidate:85641020 1 udp 1685855999 90.66.179.60 62668 typ srflx raddr 192.168.1.10 rport 62668 generation 0 network-id 2
a=candidate:85641020 2 udp 1685855998 90.66.179.60 62672 typ srflx raddr 192.168.1.10 rport 62672 generation 0 network-id 2
a=candidate:2922352299 1 tcp 1518283007 2a01:cb14:7c1:7f00:1d76:e7d4:3237:e96f 9 typ host tcptype active generation 0 network-id 3
a=candidate:3921437950 1 tcp 1518217471 2a01:cb14:7c1:7f00:f961:60c1:70f1:25a0 9 typ host tcptype active generation 0 network-id 4
a=candidate:4233069003 1 tcp 1518149375 192.168.56.1 9 typ host tcptype active generation 0 network-id 1
a=candidate:3179889176 1 tcp 1518083839 192.168.1.10 9 typ host tcptype active generation 0 network-id 2
a=candidate:2922352299 2 tcp 1518283006 2a01:cb14:7c1:7f00:1d76:e7d4:3237:e96f 9 typ host tcptype active generation 0 network-id 3
a=candidate:3921437950 2 tcp 1518217470 2a01:cb14:7c1:7f00:f961:60c1:70f1:25a0 9 typ host tcptype active generation 0 network-id 4
a=candidate:4233069003 2 tcp 1518149374 192.168.56.1 9 typ host tcptype active generation 0 network-id 1
a=candidate:3179889176 2 tcp 1518083838 192.168.1.10 9 typ host tcptype active generation 0 network-id 2
a=ice-ufrag:8hGn
a=ice-pwd:7nXTzHnYYJqjFn/PuIQs0M74
a=ice-options:trickle
a=fingerprint:sha-256 BC:82:61:35:EA:5B:A5:26:05:82:04:D8:59:4C:38:5D:C9:2A:A2:FB:3C:D1:4D:B3:F0:30:51:15:12:35:09:53
a=setup:actpass
a=mid:0
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
a=sendrecv
a=msid:WUvtnpqd3NIpvzakhMqR4QQ308BUCsNHi75U 40826d93-0424-428b-9d5e-c75e8529f908
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:106 CN/32000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:112 telephone-event/32000
a=rtpmap:113 telephone-event/16000
a=rtpmap:126 telephone-event/8000
a=ssrc:1958040920 cname:YJ7EvDTAqjZBMG5q
a=ssrc:1958040920 msid:WUvtnpqd3NIpvzakhMqR4QQ308BUCsNHi75U 40826d93-0424-428b-9d5e-c75e8529f908
a=ssrc:1958040920 mslabel:WUvtnpqd3NIpvzakhMqR4QQ308BUCsNHi75U
a=ssrc:1958040920 label:40826d93-0424-428b-9d5e-c75e8529f908
m=video 62676 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
c=IN IP4 90.66.179.60
a=rtcp:62680 IN IP4 90.66.179.60
a=candidate:3769397851 1 udp 2122262783 2a01:cb14:7c1:7f00:1d76:e7d4:3237:e96f 62673 typ host generation 0 network-id 3
a=candidate:2805962766 1 udp 2122197247 2a01:cb14:7c1:7f00:f961:60c1:70f1:25a0 62674 typ host generation 0 network-id 4
a=candidate:2999745851 1 udp 2122129151 192.168.56.1 62675 typ host generation 0 network-id 1
a=candidate:4077567720 1 udp 2122063615 192.168.1.10 62676 typ host generation 0 network-id 2
a=candidate:3769397851 2 udp 2122262782 2a01:cb14:7c1:7f00:1d76:e7d4:3237:e96f 62677 typ host generation 0 network-id 3
a=candidate:2805962766 2 udp 2122197246 2a01:cb14:7c1:7f00:f961:60c1:70f1:25a0 62678 typ host generation 0 network-id 4
a=candidate:2999745851 2 udp 2122129150 192.168.56.1 62679 typ host generation 0 network-id 1
a=candidate:4077567720 2 udp 2122063614 192.168.1.10 62680 typ host generation 0 network-id 2
a=candidate:85641020 1 udp 1685855999 90.66.179.60 62676 typ srflx raddr 192.168.1.10 rport 62676 generation 0 network-id 2
a=candidate:85641020 2 udp 1685855998 90.66.179.60 62680 typ srflx raddr 192.168.1.10 rport 62680 generation 0 network-id 2
a=candidate:2922352299 1 tcp 1518283007 2a01:cb14:7c1:7f00:1d76:e7d4:3237:e96f 9 typ host tcptype active generation 0 network-id 3
a=candidate:3921437950 1 tcp 1518217471 2a01:cb14:7c1:7f00:f961:60c1:70f1:25a0 9 typ host tcptype active generation 0 network-id 4
a=candidate:4233069003 1 tcp 1518149375 192.168.56.1 9 typ host tcptype active generation 0 network-id 1
a=candidate:3179889176 1 tcp 1518083839 192.168.1.10 9 typ host tcptype active generation 0 network-id 2
a=candidate:2922352299 2 tcp 1518283006 2a01:cb14:7c1:7f00:1d76:e7d4:3237:e96f 9 typ host tcptype active generation 0 network-id 3
a=candidate:3921437950 2 tcp 1518217470 2a01:cb14:7c1:7f00:f961:60c1:70f1:25a0 9 typ host tcptype active generation 0 network-id 4
a=candidate:4233069003 2 tcp 1518149374 192.168.56.1 9 typ host tcptype active generation 0 network-id 1
a=candidate:3179889176 2 tcp 1518083838 192.168.1.10 9 typ host tcptype active generation 0 network-id 2
a=ice-ufrag:8hGn
a=ice-pwd:7nXTzHnYYJqjFn/PuIQs0M74
a=ice-options:trickle
a=fingerprint:sha-256 BC:82:61:35:EA:5B:A5:26:05:82:04:D8:59:4C:38:5D:C9:2A:A2:FB:3C:D1:4D:B3:F0:30:51:15:12:35:09:53
a=setup:actpass
a=mid:1
a=extmap:14 urn:ietf:params:rtp-hdrext:toffset
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:13 urn:3gpp:video-orientation
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:12 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=extmap:11 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
a=extmap:8 http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07
a=extmap:9 http://www.webrtc.org/experiments/rtp-hdrext/color-space
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
a=sendrecv
a=msid:WUvtnpqd3NIpvzakhMqR4QQ308BUCsNHi75U 654d0876-4021-4443-924c-80a0a5395492
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 goog-remb
a=rtcp-fb:96 transport-cc
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli
a=rtpmap:97 rtx/90000
a=fmtp:97 apt=96
a=rtpmap:98 VP9/90000
a=rtcp-fb:98 goog-remb
a=rtcp-fb:98 transport-cc
a=rtcp-fb:98 ccm fir
a=rtcp-fb:98 nack
a=rtcp-fb:98 nack pli
a=fmtp:98 profile-id=0
a=rtpmap:99 rtx/90000
a=fmtp:99 apt=98
a=rtpmap:100 VP9/90000
a=rtcp-fb:100 goog-remb
a=rtcp-fb:100 transport-cc
a=rtcp-fb:100 ccm fir
a=rtcp-fb:100 nack
a=rtcp-fb:100 nack pli
a=fmtp:100 profile-id=2
a=rtpmap:101 rtx/90000
a=fmtp:101 apt=100
a=rtpmap:102 H264/90000
a=rtcp-fb:102 goog-remb
a=rtcp-fb:102 transport-cc
a=rtcp-fb:102 ccm fir
a=rtcp-fb:102 nack
a=rtcp-fb:102 nack pli
a=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
a=rtpmap:122 rtx/90000
a=fmtp:122 apt=102
a=rtpmap:127 H264/90000
a=rtcp-fb:127 goog-remb
a=rtcp-fb:127 transport-cc
a=rtcp-fb:127 ccm fir
a=rtcp-fb:127 nack
a=rtcp-fb:127 nack pli
a=fmtp:127 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f
a=rtpmap:121 rtx/90000
a=fmtp:121 apt=127
a=rtpmap:125 H264/90000
a=rtcp-fb:125 goog-remb
a=rtcp-fb:125 transport-cc
a=rtcp-fb:125 ccm fir
a=rtcp-fb:125 nack
a=rtcp-fb:125 nack pli
a=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
a=rtpmap:107 rtx/90000
a=fmtp:107 apt=125
a=rtpmap:108 H264/90000
a=rtcp-fb:108 goog-remb
a=rtcp-fb:108 transport-cc
a=rtcp-fb:108 ccm fir
a=rtcp-fb:108 nack
a=rtcp-fb:108 nack pli
a=fmtp:108 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f
a=rtpmap:109 rtx/90000
a=fmtp:109 apt=108
a=rtpmap:124 H264/90000
a=rtcp-fb:124 goog-remb
a=rtcp-fb:124 transport-cc
a=rtcp-fb:124 ccm fir
a=rtcp-fb:124 nack
a=rtcp-fb:124 nack pli
a=fmtp:124 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d0032
a=rtpmap:120 rtx/90000
a=fmtp:120 apt=124
a=rtpmap:123 H264/90000
a=rtcp-fb:123 goog-remb
a=rtcp-fb:123 transport-cc
a=rtcp-fb:123 ccm fir
a=rtcp-fb:123 nack
a=rtcp-fb:123 nack pli
a=fmtp:123 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640032
a=rtpmap:119 rtx/90000
a=fmtp:119 apt=123
a=rtpmap:114 red/90000
a=rtpmap:115 rtx/90000
a=fmtp:115 apt=114
a=rtpmap:116 ulpfec/90000
a=ssrc-group:FID 1470715227 2811192556
a=ssrc:1470715227 cname:YJ7EvDTAqjZBMG5q
a=ssrc:1470715227 msid:WUvtnpqd3NIpvzakhMqR4QQ308BUCsNHi75U 654d0876-4021-4443-924c-80a0a5395492
a=ssrc:1470715227 mslabel:WUvtnpqd3NIpvzakhMqR4QQ308BUCsNHi75U
a=ssrc:1470715227 label:654d0876-4021-4443-924c-80a0a5395492
a=ssrc:2811192556 cname:YJ7EvDTAqjZBMG5q
a=ssrc:2811192556 msid:WUvtnpqd3NIpvzakhMqR4QQ308BUCsNHi75U 654d0876-4021-4443-924c-80a0a5395492
a=ssrc:2811192556 mslabel:WUvtnpqd3NIpvzakhMqR4QQ308BUCsNHi75U
a=ssrc:2811192556 label:654d0876-4021-4443-924c-80a0a5395492
如果您希望与SIP代理进行互操作,则此SIP代理必须与SDP中的大多数功能兼容。
解决办法是,在没有所有功能的情况下调用基本的SIP用户代理是在中间有一个网关(例如星号或freeswitch?)。然而,这种解决方案并不是最好的,因为您将失去SDP中所有功能的好处(端到端加密、最佳媒体路径、实时带宽协商、视频丢失管理等)。
发布于 2020-01-04 11:25:13
SIP和WebRTC是不同的协议(或者在WebRTC的例子中是不同系列的协议)。WebRTC不包括WebRTC,因此您无法直接将SIP连接到WebRTC服务器,反之亦然。
您可以做的是使用一个能够理解这两种协议的服务器,例如星号或FreeSWITCH,充当桥梁。
发布于 2020-01-07 21:23:37
使用Janus WebRTC Server -janus-webrtc-网关-as-as网关
https://stackoverflow.com/questions/59588308
复制相似问题