需要澄清 Kurento 的 API 以将 webRTCEndpoint 连接到 RTPEndpoint [英] Need clarification on Kurento's API to connect webRTCEndpoint to RTPEndpoint

查看:44
本文介绍了需要澄清 Kurento 的 API 以将 webRTCEndpoint 连接到 RTPEndpoint的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Kurento 将 webRTCendpoint 桥接到 RTPendpoint.webRTCendpoint 客户端是一个 Chrome 浏览器.RTPendpoint 客户端是一个 SIP 服务器(代理/B2BUA).这是我的基本代码或伪代码(我在我的应用服务器中使用 Kurento-client.js):

I am attempting to use Kurento's bridging of webRTCendpoint to RTPendpoint. The webRTCendpoint client is a Chrome browser. The RTPendpoint client is a SIP server (proxy/B2BUA). Here is the basic code or pseudo-code I have (I am using Kurento-client.js in my app server):

//On receipt of offer from the WebRTC Browser-Peer
mySignalling.on('sdpOffer', function(sdpOffer) { //Action starts!

  //Create Mediapipeline so that endpoints can be created
  kurentoClient.create('MediaPipeline', function(error, pipeline) {
    pipeline.create('webRtcEndpoint', function(error, myWebrtcEndpoint)  {
      //Get ICE Candidates from webRTC endpoint to send to browser
      mySignalling.on('candidate', function(candidate) {
        myWebrtcEndpoint.addIceCandidate(candidate);
      });
      myWebrtcEndpoint.on('OnIceCandidate', function(event) {
        var candidate = kurento.register.complexTypes.IceCandidate(event.candidate);
        mySignalling.send(candidate); //Send ICE candidate to webRTC browser peer
      });
      pipeline.create('rtpEndpoint', function(error,myRtpEndpoint) {
        myWebrtcEndpoint.connect(myrtpEndpoint,function(error){ });
        myWebrtcEndpoint.processOffer(sdpOffer, function(error, sdpAnswer) {
          mySignalling.send(sdpAnswer);  //Send answersdp to browser
        });
        myRtpEndpoint.generateOffer(function(error){
          myRtpEndpoint.getLocalSessionDescriptor(function(error, sdpRTP) {
            mySignalling2.send(sdpRTP); //Send SDP to Asterisk as part of SIP INVITE
          });
        });
      });
    });
  });
});

我有几个问题:

  1. 整体结构是否正确?
  2. webRTCEndpoint.gatherCandidates 有什么用?文档说它必须在 processOffer 之后调用.为什么?它如何连接到 addIceCandidate 方法?
  3. RTPendpoint 已连接到 webrtcEndpoint,但如何控制由 RTPEndpoint generateOffer 生成的 RTP 配置文件?我的意思是,例如,我如何从 RTPEndpoint 获取 RTP/AVPF 而不是 RTP/AVP?如果没有,并且必须将 AVPF 映射到 AVP,Kurento 是否会处理F"?在 AVPF 中,同时从 AVPF 桥接到 AVP.

为了简单起见,我没有添加错误处理、OnIceGatheringDone 事件处理、多用户/会话配置等.

I have not added, for simplicity, error processing, OnIceGatheringDone event handling, provision for multiple-users/sessions, etc.

另一方面,我正在应用服务器中构建自己的 SIP 请求并处理 SIP 响应.如果需要,我将更改由 RTPEndpoint.generateOffer 生成的 SDP(如果需要).当我克服这个最初的障碍时,就会走到那一步!

As a side, I am constructing my own SIP requests in the app server and processing the SIP responses. I will be changing, if required, the SDPs generated by the RTPEndpoint.generateOffer, if required. Will come to that point, when I get over this initial hurdle!

推荐答案

1) 看起来不错.如果您愿意,您可以在创建 RtpEndpoint 之前完成 WebRtcEndpoint 协商.此外,您错过了对 gatherCandidates 的调用,这将在您的下一个问题中介绍.

1) It looks fine. You can finish the WebRtcEndpoint negotiation before creating the RtpEndpoint, if you'd like. Also, you're missing the call to gatherCandidates, which is covered in your next question.

2) gatherCandidates 用于通知 de WebRtcEndpoint 开始收集 ICE 候选.那是 滴流 ICE,它是对 ICE 协议的优化:候选者在被发现时被发出,并发送到另一个对等点进行探测.这加快了连接时间,因为可以在收获所有内容之前找到有效的候选者(这可能需要 20 秒或更长时间).WebRtcEndpoint 需要将候选对象发送到远程对等方,而从远程对等方接收到的候选对象则使用 addIceCandidate 方法进行处理.如果您在处理报价或生成答案之前调用 gatherCandidates,这些候选人将被添加到 SDP 报价或答案中,并且您将使用 Vanilla ICE.

2) gatherCandidates is used to signal de WebRtcEndpoint to start harvesting ICE candidates. That's trickle ICE, and it's an optimisation of the ICE protocol: candidates are emitted when discovered, and sent to the other peer for probing. This speeds up connection times, as a valid candidate can be found before all are harvested (which can take up to 20 seconds or more). The WebRtcEndpoint needs to send the candidates to the remote peer, while the candidates received from the remote peer are processed with the addIceCandidate method. If you call gatherCandidates before processing the offer or generating the answer, those candidates will be added to the SDP offer or answer, and you'll be using Vanilla ICE.

3) 如果您打算仅将 R​​tpEndpoint 用于发射,我建议您提供一个带有您需要的选项的损坏的 SDP,并拥有提供的端点进程.例如,如果您要发送到 Wowza,您可以修复 Wowza 媒体服务器期望 RTP 流的 IP 和端口.

3) If you are going to use the RtpEndpoint for emitting only, I'd recommend providing a mangled SDP with the options you need, and having the endpoint process that offer. If you are going to send to Wowza, for instance, you can fix the IP and port where the Wowza Media Server expects the RTP flow.

这篇关于需要澄清 Kurento 的 API 以将 webRTCEndpoint 连接到 RTPEndpoint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆