nextcloud / spreed

🗨️ Nextcloud Talk – chat, video & audio calls for Nextcloud
https://nextcloud.com/talk
GNU Affero General Public License v3.0
1.6k stars 428 forks source link

Compatibility with Cloudflare Calls (TURN & STUN servers) #12394

Open HyCore opened 3 months ago

HyCore commented 3 months ago

How to use GitHub


Feature request

Which Nextcloud Version are you currently using: (see administration page) Latest (28.0.5)

Is your feature request related to a problem? Please describe. Right now selfhosted TURN & STUN performance aren't great even with a top of the line server, 32 core & more, i often find myself glitched out in calls with my team. That's why when we saw a high performance low latency alternative like Cloudflare calls it would just make sense.

Describe the solution you'd like Integration of Cloudflare Calls TURN service into Spreed. It require a curl to their server like the following:

curl -X POST \
$TURN_SERVICE_API_TOKEN" \
    -H "Content-Type: application/json" -d '{"ttl": 86400}' \
$TURN_SERVICE_ID/credentials/generate

And would answer the credential for each user in Spreed (if they have different ip)

{
  "iceServers": {
    "urls": [
      "stun:stun.cloudflare.com:3478",
      "turn:turn.cloudflare.com:3478?transport=udp",
      "turn:turn.cloudflare.com:3478?transport=tcp",
      "turns:turn.cloudflare.com:5349?transport=tcp"
    ],
    "username": "XXXXX",
    "credential": "YYYYY"
  }
}

and as a last step, if the creds are valid, it return the turn & stun connection to use & work with.

const myPeerConnection = new RTCPeerConnection({
  iceServers: [
    {
      urls: "stun:stun.cloudflare.com:3478",
    },
    {
      urls: "turn:turn.cloudflare.com:3478",
      username: "REPLACE_WITH_USERNAME",
      credential: "REPLACE_WITH_CREDENTIAL",
    },
    {
      urls: "turns:turn.cloudflare.com:443?transport=tcp",
      username: "REPLACE_WITH_USERNAME",
      credential: "REPLACE_WITH_CREDENTIAL",
    },
    {
      urls: "turn:turn.cloudflare.com:3478?transport=tcp",
      username: "REPLACE_WITH_USERNAME",
      credential: "REPLACE_WITH_CREDENTIAL",
    },
  ],
});

I hope such feature would come available in a "near" future :D It would be so great.

Have a nice day ^^

ther3zz commented 1 month ago

I would absolutely love this as well