4
votes

I am working with the Answering a call documentation of Mozilla to answer a WebRTC call in Mozilla Firefox 35.0.1 but everytime I try to set a local description on the peer connection it fails.

The error is an INTERNAL_ERROR with the message:

Cannot start media channels cause = OK

My code is written in CoffeeScript but is hopefully easy to read:

_create_answer: =>

  # @param {mozRTCSessionDescription} answer the SDP answer.
  on_answer_success = (answer) =>
    console.log 'Create Answer: OK', answer

  on_local_sdp_success = () =>
    console.log 'Set local SDP (answer): OK'
    @_send_local_sdp answer

  on_local_sdp_failure = (error) =>
    console.log "#{error.name} - #{error.message}"

  console.log '(5) Set local SDP.', @logger.levels.INFO
  @pc.setLocalDescription answer, on_local_sdp_success, on_local_sdp_failure

As you can see, setting the local description on the peer connection is the fifth step. Here are the steps that I do before:

  1. Request user media stream (navigator.getUserMedia)
  2. Set local media stream (pc.addStream / pc.onaddstream)
  3. Set remote SDP (pc.setRemoteDescription)
  4. Create answer (pc.createAnswer)
  5. Set local SDP (pc.setLocalDescription)

Here is the SDP answer that Firefox generates and which I try to set to the peer connection via pc.setLocalDescription:

v=0
o=Mozilla-SIPUA-35.0.1 2330 0 IN IP4 0.0.0.0
s=SIP Call
t=0 0
a=ice-ufrag:c6dc3e0f
a=ice-pwd:8ab875b276043fa2e76effc4fbe77014
a=fingerprint:sha-256 F5:53:7F:74:A4:3E:27:8F:4B:BC:64:37:ED:96:BD:2D:0D:22:49:FB:E5:AF:8C:E7:05:41:5F:EF:7F:F1:D9:A0
m=audio 9 RTP/SAVPF 96
c=IN IP4 0.0.0.0
a=rtpmap:96 opus/48000/2
a=ptime:20
a=sendrecv
a=setup:active
a=rtcp-mux

Do I need to pay attention to something else?

1
Can you add more information so we can try to reproduce your issue? What device and OS are you using? You are following the proper steps (don't forget to use a RTCSessionDescription Object for answer in the setLocalDescription).Maxime Marchand

1 Answers

0
votes

This may be related to the switch to all-trickle-ICE. You need to set up onicecandidate's at the right times, and install them. See webrtc_landing/pc_test for a slightly complex example (it's made complex by having two peerconnections in one page, calling itself, so you have to be somewhat careful not to install ice candidates before the peerconnection in question is ready for them (see the source to that page). Also, there are a lot of checkbox options to turn on and off different features.

That example page likely needs a small update. Please feel free once your code works to go in and correct it! (or provide updates to me if that's a problem)