muaz-khan / RTCMultiConnection

RTCMultiConnection is a WebRTC JavaScript library for peer-to-peer applications (screen sharing, audio/video conferencing, file sharing, media streaming etc.)
https://muazkhan.com:9001/
MIT License
2.53k stars 1.37k forks source link

the turn server maybe not works? #135

Open Jackie2016 opened 8 years ago

Jackie2016 commented 8 years ago

Hi,great muaz i make a experiment of rtcmulticonnection in two client.one is on the network which is symmetric nat ,another is restricted port cone.and now i could not chat in video/audio.i think it is p2p traversal fail.but i check the code.i find as below

` var iceServers = []; iceServers.push({ url: 'stun:stun.l.google.com:19302' });

iceServers.push({
    url: 'stun:stun.anyfirewall.com:3478'
});

iceServers.push({
    url: 'turn:turn.bistri.com:80',
    credential: 'homeo',
    username: 'homeo'
});

iceServers.push({
    url: 'turn:turn.anyfirewall.com:443?transport=tcp',
    credential: 'webrtc',
    username: 'webrtc'
});

connection.iceServers = iceServers;

connection.rtcConfiguration = {
    iceServers: null,
    iceTransports: 'all', // none || relay || all - ref: http://goo.gl/40I39K
    peerIdentity: false
};

` here the code have turn server and i can ping turn.anyfirewall.com successfully and could get turn.bistri.com webpage.i want to know why i could not chat successfully.is the turn server not working?or any errors? any light would be appreciated.thanks

dnish commented 8 years ago

Did you check your WebRTC logs in chrome?

muaz-khan commented 8 years ago

XirSys always works however free-account disconnects often. Merely anyfirewall TURN server is expected to work. I'll setup a custom TURN server and remove all these 3rd party links (soon).

Jackie2016 commented 8 years ago

thanks,muaz,when you setup your own turn server,tell me and i could try it.thanks very much.

shaitkhan786 commented 8 years ago

thanks muaz for all your effort

which turn server you would be implementing. can you share the installation steps

Jackie2016 commented 8 years ago

coturn is popular,you can google coturn+webrtc.you can get the steps in detail.

muaz-khan commented 8 years ago

The TURN-server (coturn) is running here:

connection.iceServers = [];

connection.iceServers.push({
    urls: 'turn:webrtcweb.com:3478',
    username: 'muazkh',
    credential: 'muazkh'
});

connection.iceServers.push({
    urls: 'turns:webrtcweb.com:5349',
    username: 'muazkh',
    credential: 'muazkh'
});

connection.candidates = {
    turn: true, // relay:true or turn:true
    stun: false
};

Currently it is listening ports 3478 and 5349 however I'm planning to run on ports 80/443 to make sure it can traverse maximum of the NATs.

Jackie2016 commented 8 years ago

oh,thanks.but the server is not stable.i try five times but only one time succeed.

muaz-khan commented 8 years ago

Now CoTURN is listening both TCP/UDP ports (both on 80/443).

// for v2.2.2 (skip xirsys servers)
connection.getExternalIceServers = false;

connection.iceServers = [];

connection.iceServers.push({
    url: 'stun:stun.l.google.com:19302'
});

connection.iceServers.push({
    urls: 'turn:webrtcweb.com:80',
    username: 'muazkh',
    credential: 'muazkh'
});

connection.iceServers.push({
    urls: 'turn:webrtcweb.com:443',
    username: 'muazkh',
    credential: 'muazkh'
});

Currently port 443 is listening fake certificate that's why we can't use turns:.

dnish commented 8 years ago

@muaz-khan But do FF and Chrome even use Turn if it's not encrypted over SSL? I'm just wondering about Chrome, because it forces SSL for camera access and also has the rule that on a encrypted site all resources need to be called over SSL.

shaitkhan786 commented 8 years ago

@muaz-khan

Where can I find instructions to implement my own Turn server?

muaz-khan commented 8 years ago

You can try this (2013-old) post:

I'll update it for the CoTURN installation steps on Ubuntu/Debian, after fixing turn:webrtcweb.com:80 auto-disconnection bugs.

libuma commented 7 years ago

Dear all, muaz-khan, I also installed CoTURN, and I'm experiencing auto-disconnection issues. I'm not able to see any related number of connection nor up time. Is this something known and fixed ? Can someone help me regarding this ?

Nitishkumar3211 commented 4 years ago

@muaz-khan I have implemented turn and stun server as you have implemented in "Video Conference" But I am unable to get Remote Stream if they are on another network. its work only when end user and me are on same wifi. Please guide .

Thanks in advance

ashishbutolajnu16 commented 3 years ago

Hi Muaz, I used you turn server in my webrtc application. They didn't work. I am able to share screening within same wifi but not able to share screen on different network. I created my own turn server also but still not able to share screen on different network. Please can you help me in this. session 000000000000000002: user <>: incoming packet message processed, error 401: Unauthorised. This error is logging in my turn server when i connect with my application. Can you help me regarding this. I used your turn server also in my code but they are also not working. Please help me into this