Co-Turn server not working properly for Web RTC project
Asked Answered
I

1

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.

Ingesta answered 10/6, 2020 at 5:27 Comment(0)
N
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.

Nootka answered 10/6, 2020 at 6:24 Comment(12)
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?Ingesta
Also, I can share with you my project link via PM if it might be helpful for you to help.Ingesta
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. developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/… is a good exampleNootka
Hello Sean, I was using the following example for the group chat. 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.Ingesta
Did you add your TURN server config here github.com/anoek/webrtc-group-chat-example/blob/master/… ? You can also look in chrome://webrtc-internals that has useful debugging info.Nootka
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.Ingesta
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.Ingesta
I updated the question. Please check if you have some spare time. Thanks Sean.Ingesta
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!Nootka
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?Ingesta
Hello Sean, any other idea? I'm still stuck at this point.Ingesta
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 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!Nootka

© 2022 - 2025 — McMap. All rights reserved.