Setting up coturn for Jitsi peer-to-peer calls

A self-hosted Jitsi can fail one-to-one calls when the two browsers cannot reach each other directly. This page explains when a coturn relay is needed, how to configure it with credentials issued through Prosody, and how to keep it locked to your own users.

On this page

Why one-to-one Jitsi calls need a coturn relay and who should set it up

When some one-to-one calls on your self-hosted Jitsi connect and others fail, the usual cause is that the two browsers cannot open a direct media path to each other. This is most often caused by symmetric NAT or a strict firewall on one side, which blocks the peer-to-peer route that the browsers try first. coturn is a TURN relay: when direct connection fails, both participants send their media to the relay, which forwards it between them. Jitsi Meet encrypts audio and video in transit with DTLS-SRTP, so the relay carries encrypted media it cannot read, but it still consumes bandwidth and must be sized and reachable from both sides.

The answer to the page question is a coturn service that issues short-lived credentials through Prosody, the XMPP server in your Jitsi stack, so browsers never hold a long-lived TURN password. The service also needs to listen on the ports and TLS endpoints your users' networks allow, which is the part that varies most between sites. Plan who owns this work before you start: someone must control DNS, certificates, firewall rules on both the internal and internet sides, and the Prosody configuration that hands out credentials. Confirm the exact coturn settings, the Prosody keys and the ports against the coturn documentation and the Jitsi handbook versions you run, since both change between releases.

Treat this as a service you operate, not a single setting. A coturn left open to anyone with its address can be used as an open relay to carry traffic for third parties, so access control and credential lifetime are part of the design, not an afterthought. Decide early whether your in-house team has the networking and security skills to run a public-facing relay, or whether an implementation partner should plan, build and verify it with you, with the handover documented for your operators.

How a coturn relay, Prosody and the browsers fit together

The diagram starts with a browser joining a Jitsi meet page served by the web server. The web app asks Prosody for TURN credentials, which Prosody issues as time-limited values derived from a shared secret that is held only by Prosody and coturn. When direct media paths fail, both browsers connect to coturn over UDP 3478 or TCP 5349 and relay traffic from there. Check that the secret never reaches the browser and that the trust boundary between your network and the internet matches your firewall rules.

Credential issuance and relayed media paths around the trust boundary.

Which coturn and Jitsi options to decide before you install

This table compares the build decisions that change a coturn server for Jitsi peer-to-peer calls, with the fit and main trade-off for each option. Read each row before you choose a host, ports or credential model, and confirm exact configuration keys against the coturn and Jitsi versions you plan to run.

DecisionOptionWhen it fitsMain trade-off
Coturn hostSeparate VMProduction calls where TURN traffic and bandwidth should not compete with the web serverAnother machine to patch, monitor and firewall
Coturn hostShared with the Jitsi web serverSmall pilots with light traffic and a single operatorRelay bandwidth and port ranges can affect web serving under load
Public DNS name and certificateDedicated TURN hostname with a valid certificateClients that must use TLS to reach TURN, including networks that filter non-standard portsCertificate renewal must cover the TURN host as well as the web host
STUN and TURN listening port3478/UDP (optional in the quick start)Standard STUN and TURN over UDP for clients with open outbound UDPNetworks that block UDP fall back to TCP or TLS options
TLS listening port5349/TCP (listed as TCP fallback in the quick start)Users behind restrictive firewalls that allow outbound TLSNeeds a valid certificate on the TURN host and extra testing from restricted networks
Shared secret for ephemeral credentialsStatic auth secret that Prosody uses to mint short-lived TURN credentialsPeer-to-peer calls that should authenticate through the Jitsi stack without storing user passwords in TURNThe secret must match in both systems and is a high-value credential to store and rotate
Relay port rangeA bounded UDP range for relayed media, sized to expected concurrent callsKnown user counts where firewall rules and cloud security groups can be scoped tightlyA narrow range limits concurrency, and a wide range widens the attack surface
Bandwidth limitsPer-allocation and total bandwidth caps on the coturn serverShared hosts or multi-tenant networks where one call should not consume all capacityCaps set too low degrade call quality, and caps set too high allow misuse
TCP fallbackOffer TCP or TLS relay transports alongside UDPCorporate networks that allow only TCP or TLS egressMore listening ports, more connections to monitor, and higher relay load

Which TURN setup fits your network situation

Most participants on home broadband and open office Wi-Fi can reach each other directly once the browsers exchange candidates, so a one-to-one call often connects without a relay. TURN matters for the minority of sessions where NAT mappings fail. The usual symptom is a call that stalls at connecting or shows a black video for one side, and the failures often cluster on particular remote networks.

  • Symptom: failures that follow a specific carrier, hotel or branch router rather than your whole user base.
  • Ports: coturn on 3478/UDP is usually enough for the relay path. The Jitsi Debian/Ubuntu quick start lists 5349/TCP as the TCP fallback, so confirm both are reachable from outside.
  • When to move on: you do not need the TCP 443 setup unless failures trace to networks that allow only HTTPS.
  • Relay exposure: a TURN server that anyone on the internet can use becomes an open relay, so confirm the credential and allocation controls are in place before you publish the address.
  • Test first: place a call between two external networks, then check the selected candidate pair in the browser's WebRTC statistics to see whether a relay candidate was used.

Check which candidate pair the failed sessions used before you change any firewall rules.

Setting up coturn with ephemeral credentials through Prosody

This sequence gives one-to-one Jitsi calls a TURN fallback when direct media paths fail. Each step ends with a check, so the team knows the relay is issuing short-lived credentials and carrying traffic before users depend on it.

  1. Prepare DNS and a valid certificate

    The network or platform team creates a DNS name for the TURN server, such as turn.example.org, that resolves to the host's public address, and obtains a certificate from a trusted authority for that name. The Jitsi handbook says self-signed certificates cause problems for audio and video, especially on mobile clients, so do not substitute one. Check that the name resolves from outside your network and that the certificate chain validates from a client machine before continuing.

  2. Install coturn and open the required ports

    The operator installs the coturn package on a dedicated host, separate from the Jitsi web and bridge roles, and opens the listening ports in the host firewall and any cloud security group. Confirm the exact port set against the coturn documentation and your Jitsi version, since the Jitsi quick start lists 5349/TCP for TCP fallback and 3478/UDP for STUN as optional. Check that the service starts cleanly and that the listening sockets show up on the host, for example with a socket listing command.

  3. Generate the shared secret and enable time-limited credentials

    The operator generates a long random shared secret and places it in the coturn configuration, enabling the REST API style of time-limited credentials that the coturn project documents. Store the secret in your secrets manager or a root-only file, because anyone who holds it can mint TURN credentials. Confirm the exact configuration keys and file locations for the installed coturn version. Check that the file permissions restrict reads to the service account and that the service reloads without errors.

  4. Lock down relay rules to prevent an open relay

    Before any client uses the server, the operator restricts which peers coturn can relay to, typically by denying private and loopback address ranges and limiting the realm and the allowed port range. Also set a total quota or bandwidth limit per user if your coturn version supports it. Test from an outside host that a TURN allocation to an internal address is refused. A relay that accepts that request is an open relay and must be fixed before you continue.

  5. Configure Prosody to issue ephemeral credentials

    The Jitsi administrator adds the TURN host, port and shared secret to the Prosody and Jitsi web configuration so that authenticated clients receive short-lived TURN credentials with each session. The exact settings are in the Jitsi handbook for your installed release, and the file names and keys must be confirmed against that version before editing. Restart Prosody and the web service. Check that a joined client's session carries TURN server entries with a username that includes an expiry timestamp.

  6. Verify credential expiry and relay use

    The team confirms that a credential stops working after its lifetime by reusing an old username and password pair from a test client, which should be rejected. Then they place a one-to-one call from a network that blocks direct peer media, such as a restricted test segment or a firewall rule that drops UDP between the two clients. Check that the connection statistics show a relayed candidate and that the call completes with audio and video. Keep the test log for the change record.

  7. Monitor the relay and rotate the secret

    The operator watches coturn logs and host bandwidth for unexpected allocations, especially from addresses outside your user base, and sets an alert on unusual relay volume. Plan a rotation procedure for the shared secret that updates coturn and Prosody together, and confirm that a rotation does not break active calls beyond the expected credential refresh. Check that a rotation test passes on a staging host before the same change goes into production.

Keeping the TURN server from becoming an open relay

A coturn server that accepts anyone can carry traffic for strangers, reach internal hosts and run up your bandwidth bill. The controls below work together: Prosody issues short-lived credentials, coturn refuses anything without them, and the relay is fenced off from networks it has no business reaching. Test each one from outside your network before you call the server finished.

Credentials minted only by Prosody

Use the shared secret and ephemeral credential scheme so that Prosody generates a time-limited username and password for each call and coturn validates them against the same secret. Nobody gets a static TURN account on the client side. Check that the TURN secret lives only on the Prosody and coturn hosts, that it is not in any client-side configuration, and that a credential copied from a browser stops working after its lifetime ends.

Jitsi quick start

Refusing unauthenticated allocations

Configure coturn so that every allocation request must carry valid long-term credentials, and reject requests that omit them. An anonymous allocation is the simplest way for a stranger to use your server as a relay. From outside your network, send an allocation request with no credentials and with an expired credential. Both should fail, and the server log should show the rejection.

Blocking access to internal networks

Configure denied peer address ranges so the relay cannot forward traffic to private networks, loopback, link-local and cloud metadata addresses, and any subnet that holds your internal services. Without this, a valid user can point the relay at hosts you never meant to expose. Test by attempting a relayed connection to an internal address from a test client and confirming it is refused.

Limiting relay ports and bandwidth

Restrict the relay port range to the ports your bridge and clients actually need, and set per-user bandwidth and total allocation limits so that one account cannot saturate the link. Relay traffic is the expensive part of a TURN server, so these limits protect both availability and your hosting bill. Confirm the limits with a load test that opens several allocations under one credential and checks that the extra ones are refused.

Logging allocations and reviewing them

Turn on coturn logging for allocation creation, refusal and termination, and ship the log to a store your security team can search. Relay logs show which credential was used, from which address and to which peer, which is what you need when a call or an abuse report is investigated. Check that logs record refused requests as well as successful ones, and that retention matches your organization's policy.

Patching coturn and keeping it off the admin plane

Track coturn releases from your distribution or the project and apply security updates on a set schedule. Run the TURN host in its own network segment, with no access from the management network and no shared administrator accounts with Prosody or the bridge. Verify from outside that only the intended TURN ports answer, and that administrative interfaces are not reachable from the internet.

How ports, TLS and firewall rules affect TURN reachability

The firewall and the coturn relay range must agree, because a change to one often breaks the other. The Jitsi Debian/Ubuntu quick start opens 80/TCP and 443/TCP for the web server, 10000/UDP for the videobridge media, and lists 5349/TCP for TCP fallback and 3478/UDP for STUN as optional. On a coturn host, the listening ports (typically 3478 for STUN and TURN, and 5349 for TURN over TLS) must be reachable inbound from client networks, while the relay port range that coturn allocates for each allocation should be open outbound to the internet and restricted to what the relay actually needs. Confirm the exact relay range, listening ports and any port reuse with your coturn configuration before you write firewall rules, and confirm that the ports on the TURN host do not collide with the web server or the videobridge already on that machine.

Clients that only reach TCP depend on TLS on the TURN name. A TURN service reached over TCP on 5349 presents a certificate, so the certificate must match a DNS name that the client resolves, and it must be trusted by the client's browser or operating system. The Jitsi handbook notes that HTTPS with a proper domain certificate is necessary for working audio and video and warns that self-signed certificates cause problems, especially with mobile clients. Plan the TURN name and its certificate with the same care as the meeting domain, and test the TLS path from a restricted network, not only from your office, because a corporate proxy or firewall may block 5349 while allowing 443.

Treat each firewall change as a test event. After opening or closing a port, or changing the relay range, place a one-to-one call from a network that must use TURN, and check the browser's connection type in its statistics. If you restrict outbound relay traffic to limit abuse, confirm that allocations still succeed for legitimate peers. Record the firewall rules, the relay range and the certificate expiry date together, so that the next person who edits one of them can see what depends on it.

Limits to confirm before you rely on a coturn relay

A coturn relay only helps if the versions, credential method, capacity and ownership of the setup line up. The cards below cover what to confirm in your own environment before you route one-to-one calls through it, and who on your side or your partner's side confirms each point.

Coturn and Jitsi versions

Record the exact coturn package or container version and the Jitsi Meet build you run, then check that both are current enough for the TURN credential handling you plan to use. Confirm the coturn release notes and the Jitsi release notes for your build, since the two projects change independently. The platform team owns this check and repeats it at every upgrade.

Jitsi Meet repository

Credential method and Prosody settings

Ephemeral credentials depend on a shared secret and on Prosody and Jicofo passing the right settings to clients. Verify that your Jitsi release and Prosody configuration support the method you choose, and that the shared secret is set in both places. The team that runs the Jitsi server confirms this in a test call from a network where direct media fails.

Debian quick start

Bandwidth and concurrent relay capacity

A relay carries the full media stream for every call it handles, so bandwidth and concurrent sessions set the real limit, not the server's CPU alone. Estimate peak simultaneous one-to-one calls from your own usage data, then load test the coturn host with that profile. Confirm the uplink from the server and the number of allocations the host can hold before users depend on it.

Open relay prevention controls

A TURN server that accepts relay requests from anyone can be abused to send traffic to arbitrary destinations. Confirm that your configuration restricts relayed peers, requires authenticated allocations, and blocks private address ranges according to the coturn documentation for your version. The security team should test this from outside your network before launch.

Configuration management for the relay

The Jitsi scalable setup guide warns that building scalable infrastructure is not a task for beginning Jitsi administrators and recommends configuration management tools such as Ansible or Puppet. Decide whether your team will manage coturn, Prosody and Jicofo settings in code, because hand-edited files drift between the TURN host and the Jitsi servers. Your operations lead confirms the tooling and who reviews changes.

Scalable setup guide

Quotes follow a written scope

DeployOpen does not publish a price list, and a quote follows from a written scope that names the coturn hosts, Jitsi servers, testing and handover. Ask for the scope to list what is one-time work, such as build and testing, and what recurs, such as monitoring, upgrades and retesting. Your procurement team confirms the scope before any work starts.

What coturn for Jitsi costs, how long it takes and what you must provide

What drives the cost of a coturn build for Jitsi?

The main driver is how many network zones the TURN service must serve, because each zone adds firewall rules, addressing decisions and tests from that side. Certificate and DNS work follows, since TURN over TLS needs a name and a certificate that clients trust, and a second name is needed if you also plan TCP 443 access. Testing from restricted networks and the monitoring you want in place add further effort. A quote should break these out so you can see which items you can drop or do in-house.

Which parts of a coturn setup are one-time and which recur?

The one-time work covers the initial build, the Prosody integration that issues ephemeral credentials, port and firewall configuration, TLS setup and the testing that proves one-to-one calls fall back to TURN when direct connections fail. The recurring work covers operating system and coturn patching, certificate renewal, credential and configuration review after Jitsi upgrades, and periodic capacity review as call volume changes. Ask any partner to state which items are fixed and which are retainer work before you sign.

How long does a coturn build for Jitsi take?

Duration depends on the same factors as cost: the number of network zones, how quickly DNS and firewall changes are approved, and how many restricted networks must be tested. No duration is fixed here, so treat any figure you are given as an estimate tied to the written scope. Your schedule will move most with the change approvals on your side, so start those requests early and ask the partner to list which steps wait on your teams.

Can our in-house team set up coturn for Jitsi without outside help?

Yes, if your team has Linux server administration experience, can manage DNS and TLS certificates, and can work with the Prosody configuration that a Jitsi deployment uses. The Jitsi scalable setup guide warns that building a scalable infrastructure is not a task for beginning Jitsi administrators, and the same caution applies to TURN. Choose an outside partner when the team lacks those skills, when restricted-network testing needs a separate lab, or when you want a fixed-scope handover with documentation.

What must our team provide before the work starts?

Plan to provide DNS access for the names clients will use, the ability to open and test the ports the TURN service needs, and firewall change requests for each network zone. You also need a test network that resembles the restricted environments your users work from, and access to the Prosody configuration so credential integration can be verified against your running Jitsi. Confirm who holds each of these access rights and how long approvals take in your organization.

How does the written scope determine the quote?

DeployOpen works on fixed-scope engagements, so scope, deliverables and timelines are agreed in writing before work starts, and the quote follows from that written scope. The scope should name the network zones, the names and certificates, the Prosody integration, the test networks, the monitoring and the handover documents. Any item left out of the scope is a change to negotiate later. DeployOpen does not publish a price list, so compare quotes by checking that each one covers the same items.

Why must TURN stay closed to anyone without valid credentials?

A TURN server that accepts relay requests from anyone can be used by outsiders to relay their traffic through your bandwidth, so the server must issue and check credentials for each user. Jitsi's ephemeral credential approach through Prosody is meant to give each call a short-lived login, which limits the damage from a leaked value. Ask a partner how the build restricts relayed addresses, enforces time-limited credentials and tests that an unauthenticated request is refused.

What operational risks should we review before accepting a coturn build?

The main risks are an open relay left by a misconfigured credential check, certificates that expire and break TLS-based TURN, firewall rules that block the relay range, and configuration drift after Jitsi upgrades change the Prosody setup. Each risk should have a named owner, a monitoring signal and a test you can repeat. The Jitsi handbook also warns that self-signed certificates cause problems, particularly with mobile clients, so the certificate plan belongs in the review.

How DeployOpen scopes and delivers a coturn setup for Jitsi

DeployOpen approaches coturn for Jitsi peer-to-peer calls as a scoped piece of infrastructure work inside your own network and cloud accounts. We agree the written scope first, then build, test and document the TURN service so your team can run it after handover.

How we scope

  • Map which users, networks and call paths currently fail to connect directly and need TURN relay.
  • Confirm the Jitsi deployment layout, Prosody credential method, DNS names and certificate sources before any build starts.
  • Agree in writing the coturn hosts, ports, TLS settings and relay restrictions that form the fixed scope.

How we build

  • Configure coturn with time-limited credentials issued through Prosody, matching the shared secret used by your Jitsi services.
  • Open only the ports the design requires, and set peer address and relay limits so the server cannot act as an open relay.
  • Test one-to-one calls from inside and outside your network, including a restricted network where direct paths are blocked.

How we hand over

  • Document the final configuration, firewall rules, certificate renewal steps and the credential flow between Prosody and coturn.
  • Provide a verification checklist your team can rerun after upgrades, certificate renewals or network changes.
  • Walk your operators through logs and failure signs so they can spot unauthorized relay use early.

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer once the handover is complete.
  • Retest the TURN configuration after Jitsi or coturn updates, since the relay and credential settings can change.
  • Confirm with your team which support tier, response expectations and update windows fit your environment before signing.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.