I have a web app that plays video broadcasted using WebRTC. I'm using a COTURN simple implementation (as described here: https://gabrieltanner.org/blog/turn-server). My turnserver.conf looks like this:
# TURN server name and realm
realm=<server_domain>
server-name=turnserver
# Use fingerprint in TURN message
fingerprint
# IPs the TURN server listens to
listening-ip=0.0.0.0
# External IP-Address of the TURN server
external-ip=<server_public_ip>
# Main listening port
listening-port=3478
# Further ports that are open for communication
min-port=10000
max-port=20000
# Log file path
log-file=/var/log/turnserver.log
# Enable verbose logging
verbose
# Specify the user for the TURN authentification
user=username:password
# Enable long-term credential mechanism
lt-cred-mech
# SSL certificates
cert=<crt_file>
pkey=<key_file>
# 443 for TURN over TLS, which can bypass firewalls
tls-listening-port=443
And I tested this server here: https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ and it works fine.
On my WebApp I'm doing
const test = () => {
const configuration = {
iceServers: [
{ urls: "stun:stun.l.google.com:19302" },
{
urls: "turn:<domain>:3478",
username: "username",
credential: "password",
},
],
};
let pc = new RTCPeerConnection(configuration);
pc.ontrack = function (event) {...}
pc.createOffer()
.then((offer) => {
console.log(offer);
}
But the offer looks like this:
RTCSessionDescription {type: "offer", sdp: "v=0
↵o=- 35287960452273588 2 IN IP4 127.0.0.1
↵s=-…0 0
↵a=extmap-allow-mixed
↵a=msid-semantic: WMS
↵"
which causes the other peer to throw SetRemoteDescription called with no fingerprint
and I'm not sure why is it missing so much information, am I doing something wrong?
Thank you in advance!
When offering you need to have at least one media section. You can either add a Transceiver or do a data channel.
let pc = new RTCPeerConnection()
// Create data channel
pc.createDataChannel('foobar')
// Create a audio or video transceiver
pc.addTransceiver('audio')
pc.addTransceiver('video')