Groups
Groups

how to test/troubleshoot simple coturn setup for webrtc?

2,735 views
Skip to first unread message

Chris Dawson

unread,
Apr 10, 2020, 3:05:29 PM4/10/20
to TURN Server (Open-Source project)
TL;DR I have a local webrtc demo working. I want to permit a relay between two clients that are outside the local network. I'm setting up a turn server. But, I'm unsure if my coturn is incorrectly setup, or if ports are not open, or if my webrtc client is wrong. I'm struggling with understanding where to look (tcpdump or chrome webrtc internals, or otherwise?) 

Specific questions
  1. Should the credentials inside my peer config be username=abc, credential=123 OR username: "abc:123" (and then credential field is something else)? Here (https://www.html5rocks.com/en/tutorials/webrtc/infrastructure/) it says crendentials like this: { 'credential': 'JZEOEt2V3Qb0y27GRntt2u2PAYA=', 'username': '28224511:1379330808' }. I don't get where they get the "JZ...." for credentials string but I see username is username/password separated by a colon. Perhaps this is backend specific?
  2. Should tls-listening-port inside my coturn configuration file be set to 3478, or 443 (or 8443). What is that port, an admin https port? Which one should I provide to Trickle ICE? 
  3. What should I be looking for inside the webrtc internals of Chrome or Firefox to see if authentication is passing for a webrtc connection (either with Trickle ICE or my own webrtc demo)?
  4. What can I look for on the server using  tcpdump to see if trickle ICE is talking to my server (and see if it is a firewall issue perhaps). 
Now the full details:

(I've changed my hostnames and IPs to fake ones here BTW)

I have an example webrtc app working that allows me to send and display video from two clients. It works great within a closed network using just a STUN URL.

var config = {
'iceServers': [ {'urls': 'stun:stun.l.google.com:19302'}]
};


Two different browsers send video back and forth. If I have one browser inside the firewall and then another outside, things don't work. I'm trying to get a TURN server using coturn working to relay for me with this config.

var config = {
'iceServers': [ {'urls': 'stun:stun.l.google.com:19302'}, 
{
        'urls': 'turn:turn.example.com:3478',
username: "abc",
credential: "123",
    },]
};



I have one running on ubuntu with this configuration.

cert=/etc/letsencrypt/live/turn.example.com/cert.pem
pkey=/etc/letsencrypt/live/turn.example.com/privkey.pem
fingerprint
listening-ip=0.0.0.0
external-ip=34.34.34.34
listening-port=3478
tls-listening-port=443
min-port=10000
max-port=20000
log-file=/var/log/turnserver.log
verbose
user=abc:123
lt-cred-mech

I can see it is listening when I run netstat:

# netstat -anp | grep turn
tcp        0      0 0.0.0.0:3478            0.0.0.0:*               LISTEN      6363/turnserver     
tcp        0      0 0.0.0.0:3478            0.0.0.0:*               LISTEN      6363/turnserver     
...
tcp        0      0 0.0.0.0:3478            0.0.0.0:*               LISTEN      6363/turnserver     
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      6363/turnserver     
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      6363/turnserver     
...

I'm unable to use the Trickle ICE testing tool (https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/) to work (or I'm unsure what correct output would be).

I add this server:

turn:turn.example.com:3478 [abc:123]

Then, I see this:

Note: errors from onicecandidateerror above are not neccessarily fatal. For example an IPv6 DNS lookup may fail but relay candidates can still be gathered via IPv4.
The server stun:turn.example.com:3478 returned an error with code=701:
STUN host lookup received error.
The server stun:turn.example.com:3478 returned an error with code=701:
STUN host lookup received error.
The server turn:turn.example.com:3478?transport=udp returned an error with code=701:
TURN host lookup received error.
The server turn:turn.example.com:3478?transport=udp returned an error with code=701:
TURN host lookup received error.

That's what happens on Chrome for Linux (80.0.3987.163 (Official Build(64-bit))

If I use Firefox, it just seems to hang (nothing is output)

Inside the JS  on both platforms I see this output:

Creating new PeerConnection with config={"iceServers":[{"urls":["turn:turn.example.com:3478"],"username":"abc","credential":"123"}],"iceTransportPolicy":"relay","iceCandidatePoolSize":"0"} main.js:151:11

I attempt to sniff the packets with tcpdump and am not seeing anything with this command (but I'm no tcpdump expert!). Is this the correct command to use? What can I use to determine whether the client is at least connecting?

# tcpdump 'port 3478'
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens4, link-type EN10MB (Ethernet), capture size 262144 bytes



Chris Dawson

unread,
Apr 11, 2020, 8:26:57 PM4/11/20
to TURN Server (Open-Source project)
Doh. Simply a firewall issue.

MIchael

unread,
Apr 11, 2020, 9:37:32 PM4/11/20
to TURN Server (Open-Source project)
I'm having what sounds to be a similar issue. What was your firewall issue?

On Sunday, 12 April 2020 01:26:57 UTC+1, Chris Dawson wrote:
Doh. Simply a firewall issue.

Chris Dawson

unread,
Apr 11, 2020, 10:15:55 PM4/11/20
to MIchael, TURN Server (Open-Source project)
I was using 0.0.0.0/24 instead of 0.0.0.0/0. That opened it up for all connections and then it worked.

--
You received this message because you are subscribed to the Google Groups "TURN Server (Open-Source project)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to turn-server-project-rfc57...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/turn-server-project-rfc5766-turn-server/c425514e-be2c-4b9c-a7ba-9f878603f5bc%40googlegroups.com.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages
Search
Clear search
Close search
Google apps
Main menu