nextcloud / nextcloud/spreed

Compatibility with Cloudflare Calls (TURN & STUN servers)

Open
#12,394 8 comments 69 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement feature: api 🛠️ feature: integration 📦 feature: WebRTC 🚡 good first issue
Dominant language
PHP
Stars
2.2k
Forks
587
Avg merge
17h 55m
Merged PRs (30d)
350

Description

How to use GitHub
  • Please use the 👍 reaction to show that you are interested into the same feature.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

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 ^^

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing Spreed's existing TURN/STUN configuration and the code that builds the RTCPeerConnection iceServers list. Review the Cloudflare Calls credential-generation API and how credentials would be scoped and returned to users. Done means an agreed integration design and working Cloudflare TURN/STUN support, with coverage for credential retrieval and connection setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
audio-video-rtc, cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.