我正在尝试使用Kurento桥接webRTCendpoint到RTPendpoint。 webRTCendpoint客户端是Chrome浏览器。 RTPendpoint客户端是一个SIP服务器(代理/ B2BUA)。这是基本的代码或伪代码,我有(我用Kurento-client.js在我的应用程序服务器):需要澄清在Kurento的API连接webRTCEndpoint到RTPEndpoint
//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
});
});
});
});
});
});
我有几个问题:
- 是整体结构是否正确?
- webRTCEndpoint.gatherCandidates有什么用?该文档说它必须在processOffer之后调用。为什么?它如何连接到addIceCandidate方法?
- RTPendpoint连接到webrtcEndpoint,但是如何控制RTPEndpoint generateOffer生成的RTP配置文件?我的意思是,我如何从RTPEndpoint获取RTP/AVPF而不是RTP/AVP?如果没有,并且AVPF必须映射到AVP,则Kurento将处理AVPF中的“F”,同时将AVPF桥接到AVP。
我还没有添加,为简单起见,错误处理,OnIceGatheringDone事件处理,提供了多用户/会话等
作为一个方面,我建设我自己的SIP请求的应用服务器并处理SIP响应。如果需要,我将更改由RTPEndpoint.generateOffer生成的SDP(如果需要)。当我克服这个最初的障碍时,会来到这一点!
谢谢。第2点:您说:“如果您在处理报价或生成答案之前致电collectCandidates,那些候选人将被添加到SDP报价或答案中,并且您将使用Vanilla ICE。”据我所知,在浏览器中,本地ICE候选人在setLocalDescription调用之后被解雇。当浏览器获取信息来生成准确的候选人时,这与“Vanilla”ICE相反是有意义的。因此,在Kurento,候选人不应被解雇,直到处理远程报价并生成答案。应该不需要collectCandidates方法。我错过了什么? – Sam
第3点:我将使用RTPEndpoint和来自两端的媒体流。 “损坏的SDP”,你的意思是手动编码的SDP?由于我必须桥接来自RTPEndpoint的SIP呼叫,并且事先知道SIP电话支持的SDP,因此我可以拥有一个rtpEndpoint。processOffer基于SIP电话的SDP,或者我可以启动一个generateOffer,我认为它会给我“Vanilla”SDP或Kurento中的所有可能的RTP功能,我可以使用我的SIP INVITE请求进行标记。哪个更好? **是否有关于Kurento支持的RTP配置文件的任何文档?**是否支持RTPEndpoint中的AVPF? – Sam
有关rtpEndpoint [此处](https://doc-kurento.readthedocs.io/en/stable/_static/langdoc/jsdoc/kurento-client-js/module-elements.RtpEndpoint.html)的文档缺少许多方法,如generateOffer,getLocalSessionDescriptor,...或者我在错误的地方看? – Sam