Peerjs: ICE failed, add a STUN server and see about:webrtc for more details

Created on 26 Nov 2018  ·  18Comments  ·  Source: peers/peerjs

I'm new to this webRTC. I have created a connection between two streams. It's working but when transferring the media streams its throwing this error ICE failed, add a STUN server and see about:webrtc for more details. I have tried like this

peer = new Peer(id, {
debug: 2,
config: {'iceServers': [
{ url: 'stun:stun.l.google.com:19302' },
{ url: 'stun:stun1.l.google.com:19302' },
]}

but still, I'm facing this issue. What is the exact solution for this? @kidandcat

Most helpful comment

I did this but in that itself there are many problems are there. I used COTURN since that's the one is a free open source for STUN and TURN server. @mballabaniapr

All 18 comments

Sorry, the Docs need an update, the ice Servers are configured like this:

{'iceServers': [{ 'urls': 'stun:stun.l.google.com:19302' }]};

Fine. Whether is there any free stun and turn server is there or else I need to buy these servers? @kidandcat

There are a lot of free STUN servers, because they are used only to start
the connection (they don't need high resources) but there are no TURN
servers free, because if the P2P connection cannot be established, the
fallback is that all the communication goes through a TURN server, so they
need high resources and bandwidth.

El mar., 27 nov. 2018 7:08, RamyaAshika notifications@github.com escribió:

Fine. Whether is there any free stun and turn server is there or else I
need to buy these servers? @kidandcat https://github.com/kidandcat


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/peers/peerjs/issues/470#issuecomment-441937144, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ADrV0qWA1WciYRt65jrYBhB_0b8k8WA1ks5uzNblgaJpZM4YzF3r
.

OOh, Can I build my application without TURN server? and also if I'm in different wireless network that connection is getting lost after 3-5minutes @kidandcat

Yeah sure,
but if there is a strang network condition where p2p is completely
impossible, there will be no fallback to TURN and the connection will fail,
but those cases are not common. You just need STUN servers.

Gracias,
Jairo Caro-Accino Viciana.

El mar., 27 nov. 2018 a las 11:00, RamyaAshika (notifications@github.com)
escribió:

OOh, Can I build my application without TURN server? @kidandcat
https://github.com/kidandcat


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/peers/peerjs/issues/470#issuecomment-441998795, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ADrV0tpMsIoIJqHgM25BSr_9HX4pCgyVks5uzQ0-gaJpZM4YzF3r
.

Okay, this is the open source I'm using { urls: 'stun:stun1.l.google.com:19302' } but still, I'm getting the error sometimes ICE failed, add a STUN server and see about:webrtc for more details. Do you know any open source stun server configuration and why after 5-10 minutes, Connection is getting lost? @kidandcat

Fixed it. Thanks @kidandcat

@RamyaAshika How did you fix it?

I did this but in that itself there are many problems are there. I used COTURN since that's the one is a free open source for STUN and TURN server. @mballabaniapr

Hi @RamyaAshika how did you deploy your coturn server? I deployed it on AWS and it seems to work from what https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ tells me because there is relay, however it doesnt work when I call webrtc connect to turn server from my web app hosted on AWS and get ice candidates and gives me the same error: ICE failed, add a STUN server and see about:webrtc for more details

Hi @RamyaAshika,
I face exact same issue. Can you you please share your solution in details.
Thank you.

Same here

I had the same problem, but I fixed it.
https://gist.github.com/sagivo/3a4b2f2c7ac6e1b5267c2f1f59ac6c6b

You must provide stun + turn

"iceServers": [
          {
            "urls": "stun:vc.example.com:3478"
          },
          {
            "urls": "turn:vc.example.com:3478",
            "username": "coturnUser",
            "credential": "coturnUserPassword"
          }
        ],

You can specify "iceTransportPolicy": "relay" to use only relay server (without p2p)

@afrokick Where is this code written?I use java api development

i have also issues over the internet (WAN) on LAN everthing is fine.

i'll try it with https://github.com/coturn/coturn coturn...

i use the following setup to communicate over the internet not LAN.

var fs = require('fs');
var PeerServer = require('peer').PeerServer;

var server = PeerServer({
    port: 3001,
    debug: true,
    path: '/peerjs',
    ssl: {
        key: fs.readFileSync('privkey.pem', 'utf8'),
        cert: fs.readFileSync('fullchain.pem', 'utf8')
    },
    config: {"iceServers": [

      {
        "iceTransportPolicy": "relay",
        "urls": "stun:62.138.7.233:3478"
      },
      {
        "iceTransportPolicy": "relay",
        "urls": "turn:62.138.7.233:3478",
        "username": "ninefingers",
        "credential": "youhavetoberealistic"
      }
    ],
  }
});

my coturn server: turnserver -L 62.138.7.233 -a -f -r north.gov

output of coturn:

0: Domain name:
0: Default realm: north.gov
0: ERROR:
CONFIG ERROR: Empty cli-password, and so telnet cli interface is disabled! Please set a non empty cli-password!
0: WARNING: cannot find certificate file: turn_server_cert.pem (1)
0: WARNING: cannot start TLS and DTLS listeners because certificate file is not set properly
0: WARNING: cannot find private key file: turn_server_pkey.pem (1)
0: WARNING: cannot start TLS and DTLS listeners because private key file is not set properly
0: Relay address to use: 62.138.7.233

....

do we need TLS?

Why this issue has been closed when there is no proper solution suggested?

Was this page helpful?
0 / 5 - 0 ratings