I cannot form a WebRTC connection between browsers using two separate public IP addresses that are behind a NAT (a.k.a. regularly over the internet) that do not allow connecting using STUN information only and instead require TURN server assistance.
I have already had success with forming connections in LAN, but so far I haven't came across ANY instructions on how to form a simple TURN-based connection with javascript webrtc. It seems that all the tutorials are happy when they receive "typ relay" type of sdp and end there. I got the "typ relay" sdp from my coturn as well, however I never got the ICE to connect using TURN over internet and I have found no instructions that instruct on this case (which I recon should be quite typical).
My best effort according to firefox's about:webrtc -page has provided me ICE connection effort where both remote and local candidates of the raw connections of ICE are turn-relay addresses with correct TURN server public IP and UDP port. However this ICE connection fails for a reason unknown to me.
Also, I've tried to find all mystical security requirements related to TURN server, however I'm not sure what level of settings exactly are required by Chrome or Firefox. My current coturn config is as follows:
external-ip=13.X.X.X/172.X.X.X
listening-port=3478
log-file=stdout
lt-cred-mech
max-port=36980
min-port=36940
fingerprint
no-cli
realm=example.com
user=usernamehere:passwordhere
verbose
cert=/etc/letsencrypt/live/example.com/cert.pem
pkey=/etc/letsencrypt/live/example.com/privkey.pem
no-sslv2
no-sslv3
I would love to see a tutorial or instructions where someone has made a simple code that IS ACTUALLY USED to pass data accross internet using webrtc and TURN server. So far i've found examples with same browser only, using websockets or success with STUN information.
Just having the ICE connection successfully form would make my day.
EDIT: Turns out (pun intended) that my signaling method was too slow. To use UDP-based TURN relay server, you need to deliver candidates faster than my signaling method (human copypaste to another tab) did. Websockets provide a method for delivering signaling info fast enough.
RTCIceTransportPolicy
object, if you put ice transport policy torelay
instead ofdefault
( which isall
), then your current webRTC session will try to be established using only relay/turn candidates even they are in same network. – Pallab Gain