V
V
Vyacheslav Saratovsky2014-10-09 12:06:05
JavaScript
Vyacheslav Saratovsky, 2014-10-09 12:06:05

How to overcome NAT (webrtc)?

I make a video chat on webrtc, it works within the local network, I can’t go beyond nat
Now these parameters are

var pcConstraints = {"optional": [{"DtlsSrtpKeyAgreement": true}]};
var peerConfig = { iceServers:[{"url": "stun:stun.l.google.com:19302"}]};

In the candidates, the ip of the machine on the network and the ip stun of the server.
Moreover, the addStream event fires, but there is no stream itself.
I tried this (taken from swag):
peerConfig = { iceServers:[{url:'stun:stun01.sipphone.com'},
{url:'stun:stun.ekiga.net'},
{url:'stun:stun.fwdnet.net'},
{url:'stun:stun.ideasip.com'},
{url:'stun:stun.iptel.org'},
{url:'stun:stun.rixtelecom.se'},
{url:'stun:stun.schlund.de'},
{url:'stun:stun.l.google.com:19302'},
{url:'stun:stun1.l.google.com:19302'},
{url:'stun:stun2.l.google.com:19302'},
{url:'stun:stun3.l.google.com:19302'},
{url:'stun:stun4.l.google.com:19302'},
{url:'stun:stunserver.org'},
{url:'stun:stun.softjoys.com'},
{url:'stun:stun.voiparound.com'},
{url:'stun:stun.voipbuster.com'},
{url:'stun:stun.voipstunt.com'},
{url:'stun:stun.voxgratia.org'},
{url:'stun:stun.xten.com'},
{
    url: 'turn:numb.viagenie.ca',
    credential: 'muazkh',
    username: '[email protected]'
},
{
    url: 'turn:192.158.29.39:3478?transport=udp',
    credential: 'JZEOEt2V3Qb0y27GRntt2u2PAYA=',
    username: '28224511:1379330808'
},
{
    url: 'turn:192.158.29.39:3478?transport=tcp',
    credential: 'JZEOEt2V3Qb0y27GRntt2u2PAYA=',
    username: '28224511:1379330808'
}]}

Then the candidates were only the addresses of the local machine.
What to do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artur Zayats, 2014-10-16
@super-developer

In short, there are 4 types of NAT that need to be overcome somehow, 3 of them are easily overcome with the help of STUN servers (they are used only when peers are connected to each other - that is, all traffic does not go through them, there are a bunch of free stun servers), the fourth is the most problematic, about 15% of all peer-to-peer connections on the Internet fall under it - this is the so-called double NAT (when both peers are hidden behind NAT). To overcome this fourth type of NAT, a TURN server is needed. Its peculiarity is that it works as a proxy - that is, it passes all traffic through itself - from here you should understand that you will not find free TURN servers. Those accounts that you brought above most likely have been disabled for a long time.
An excellent list of STUN servers can be found here -https://github.com/DamonOehlman/freeice it is constantly checked and updated there.
The problem with double NAT is solved in one of three ways:
1. find a temporarily free account on the TURN server somewhere (but the account can suddenly be disabled)
2. buy a paid account on an existing server and pay for traffic, for example here - https ://my.xirsys.com/signup/plans/standard/monthly
3. Deploy your turn server. We, for example, did just that. We took Ubuntu for $5 a month on digitalocean and installed an open-source, free turn-server there in half a day - turnserver.open-sys.org/downloads

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question