Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webrtc: Could not process WebRTC answer

Im using ejabberd + stanza io to build a realtime messaging and audio calling website. ive managed to make my first audio call

from chrome(on PC) -> chrome(on mac) with no errors

the problem occurs when i try to make the call

from chrome(on mac) to firefox(on pc) or vice versa

the chrome browser log is showing Could not process WebRTC answer

by using the chrome://webrtc-internals debugger tool ive figured out that setremotedescription failed with the error:

`Failed to set remote answer sdp: Called with SDP without ice-ufrag and ice-pwd`

this is what im using to start a call:

var session = client.jingle.createMediaSession('full JID');
  session.addStream(localAudio_stream); // getUserMedia stream
  session.start();

what am i doing wrong? how can firefox successfully establish a call but chrome cant (tested on opera to with the same result (failure))

Full JS code

like image 890
Med Abida Avatar asked Dec 10 '17 15:12

Med Abida


1 Answers

i've solved the problem by including the npm package sdpparser in the client.js (of stanza.io) then building it again, and in stanza.io.bundle ive tweaked the PeerConnection.prototype.handleAnswer like so:

var sdp = client.SdpParser.parse(answer.sdp);
sdp.media.forEach(function(media){
  if(media.type === 'video' && media.inactive ) {
    delete media.fingerprint;
    media.port = 0;
  }
});
answer.sdp = client.SdpParser.format(sdp);

this may not be the best way to do it , but it definitely solves the problem.

github link of the tweaked stanza.io

Helpful github issue on jingle.js repo

like image 109
Med Abida Avatar answered Nov 15 '22 07:11

Med Abida