Skip to content

Voice Calls and TURN ​

Make a Call ​

Click the call button in a web DM and wait for the other user to answer. Both users must be online; calls last at most one hour. P2P is the default, with TURN fallback and a manual relay switch.

TURN helps when direct connections fail or when you prefer relay transport. The Worker handles signaling; audio travels over P2P or TURN. Without TURN configuration, only direct connections are available.

Configure Cloudflare TURN ​

  1. Reuse or create a TURN Key in Cloudflare Realtime.
  2. Store its uid as Repository Secret EDGECHAT_TURN_KEY_ID.
  3. Store its key as Repository Secret EDGECHAT_TURN_API_TOKEN.
  4. Rerun 00 Deploy Worker.
  5. Call between two online web accounts and switch to TURN to verify it.

Provide both Secrets. After deployment the workflow injects them using wrangler secret put. The TURN token belongs to the TURN Key and is separate from the deployment API token. Creating a key through the API requires Calls Write.

Manual Deployment ​

Use the deployed configuration and paste each value at its prompt:

bash
npx wrangler secret put EDGECHAT_TURN_KEY_ID --config wrangler.toml
npx wrangler secret put EDGECHAT_TURN_API_TOKEN --config wrangler.toml

Keep the VOICE_CALL binding and Durable Object migration v4 from the template. Browsers receive temporary TURN credentials only.

Update Credentials ​

For Actions, update both Repository Secrets and redeploy. If omitted, the workflow preserves existing Worker TURN Secrets.

Scope and Costs ​

Calls support online one-to-one web voice, without groups or video. Lock screens, stopped processes, or suspended networks may interrupt them. P2P shares network candidates with the peer; selecting TURN forces relay transport.

TURN traffic uses Cloudflare Realtime billing. Worker, D1, KV, and DO usage is billed separately. See official pricing and the protocol guide.

Built on Cloudflare · Designed for self-hosting