7

I have a turn server which is using co-turn and hosted on GCP.

And already installed the server successfully without any error and enabled the port.

But when I used it back on my web rtc project, it seems like it's not working because my application only works only on the same router or network.

It's not working on a different network.

I tried checking on https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ and get the following result which says it is fine.

So, i'm a bit lost about where to check anymore.

Please kindly help me what I can check anywhere else. Thanks.

enter image description here

============================================

Updated after adding external IP.

enter image description here

Latest Update

When I debug on chrome://webrtc-internals/, there is an error message on icecandidateerror event which state as Unauthorized.

url: turn:turn.xxxxx.live:5349?transport=udp
address: 10.19.95.x
port: 41207
host_candidate: 10.19.95.x:41207
error_text: Unauthorized
error_code: 401

When I recheck the turn server which I created with reference to this link, I still have user=guest:somepassword line, so trying my server with that password to confirm if it is the user issue.

Still no luck though. Please help me guide where did I need to look more into.

Since I'm new to this technology and infrastructure, I'm a bit lost here.

Mg Thar
  • 1,084
  • 8
  • 24

1 Answers1

5

10.138.0.2 probably isn't what you want. Edit the coturn config to set a --external-ip value that is the external IP of your TURN server. This page should print the world routable IP of your TURN server, not 10.138.0.2

When you create a new PeerConnection are you sure you are passing the values properly? Can you confirm that onicecandidate emits srflx and relay candidates? This probably isn't the issue, but worth checking.

Sean DuBois
  • 3,972
  • 1
  • 11
  • 22
  • Hi @Sean, first of all, thanks for the answer. It is great to have some response. Regarding the server, I added the --external-ip and the response is now changed. But the issue is still there. Not really sure about that onicecandidate emitting srflx and relay thing. Can you please help to elaborate a bit more on this? – Mg Thar Jun 10 '20 at 07:08
  • Also, I can share with you my project link via PM if it might be helpful for you to help. – Mg Thar Jun 10 '20 at 07:16
  • When `onicecandidate` is called do you send the candidate to the other PeerConnection and call `addIceCandidate` ? When `onicecandidate` is called you will see `host`, `srflx` or `relay`. https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addIceCandidate is a good example – Sean DuBois Jun 10 '20 at 07:22
  • Hello Sean, I was using the following example for the group chat. https://github.com/anoek/webrtc-group-chat-example And yes, when I check on the onicecandidate event, it was sent the candidate information which is ""candidate:1228400177 1 udp 2122260223 10.64.112.51 47863 typ host generation 0 ufrag UMrY network-id 1 network-cost 900"". Is 10.64.112.51 was the issue there? Looks likes it is sending out the local IP. – Mg Thar Jun 10 '20 at 09:12
  • Did you add your TURN server config here https://github.com/anoek/webrtc-group-chat-example/blob/master/client.html#L31-L33 ? You can also look in `chrome://webrtc-internals` that has useful debugging info. – Sean DuBois Jun 10 '20 at 17:25
  • Yes. I add them in like below. var ICE_SERVERS = [ { url: "stun:stun.xxxxxxxx.live:5349" }, { url: 'turn:turn.xxxxxxxx.live:5349', credential: 'xxxxxxxx', username: 'xxxxxxxx' } ]; I will check the chrome://webrtc-internals tools. – Mg Thar Jun 11 '20 at 02:58
  • 1
    I found an interesting piece of information. icecandidateerror url: turn:turn.xxxxx.live:5349?transport=udp address: 10.19.95.x port: 43311 host_candidate: 10.19.95.x:43311 error_text: Unauthorized error_code: 401..... I think I misconfigure the turn server access. I will look more into it. Please let me know if you have some great example as well. – Mg Thar Jun 11 '20 at 03:29
  • I updated the question. Please check if you have some spare time. Thanks Sean. – Mg Thar Jun 11 '20 at 04:08
  • And the same credentials work on the ICE trickle test page? It could possible be a browser cache issue? The trickle ICE page just creates a PeerConnection with those attributes, so really not sure what it could be! – Sean DuBois Jun 11 '20 at 04:20
  • Yes. Both credentials working fine on ICT trickle page. And I double-check the credentials on the web page javascripts. Everything looks correct. Can help me to check If I share you all the project? – Mg Thar Jun 11 '20 at 04:33
  • Hello Sean, any other idea? I'm still stuck at this point. – Mg Thar Jun 19 '20 at 08:49
  • Sorry I don't have any ideas, I am not that familiar with coturn. Maybe try deploying a different TURN server locally and testing with that. I work on this one https://github.com/pion/turn/tree/master/examples and we distribute static binaries for Windows/Mac/Linux so could be an easy way to test quickly! – Sean DuBois Jun 19 '20 at 20:15