Skip to content

Configuration Reference

The bridge is configured entirely from environment variables - the same names as the Node.js sibling, so one .env file drives either implementation. The package ships a fully commented .env.example. Four variables are required.

EnvMeaning
WORKER_SHARED_SECRETThe shared secret from StandIn pairing. Must equal what StandIn holds, or the HMAC upgrade is rejected with 401.
LIVEKIT_URLLiveKit server URL (wss://<project>.livekit.cloud or self-hosted).
LIVEKIT_API_KEYLiveKit API key; mints join tokens, dispatches agents, deletes rooms. Server-side only.
LIVEKIT_API_SECRETLiveKit API secret paired with the key.
EnvDefaultMeaning
LIVEKIT_AGENT_NAMEunsetThe agent_name your worker registers with, for explicit dispatch (recommended). Unset falls back to automatic dispatch (an unnamed agent joins every room; prototype-only).
LIVEKIT_ROOM_PREFIXmsteams-Room name prefix; the room is {prefix}{callId} (sanitized, capped at 100 chars to match the Node bridge).
LIVEKIT_DELETE_ROOM_ON_ENDtrueDelete the room at teardown so the agent job ends immediately instead of idling out (billing hygiene).
EnvDefaultMeaning
MAX_CALL_MINUTES0 (off)Bridge-side hard cap per call, in minutes (fractional allowed).
GOODBYE_TEXTa default lineThe goodbye line sent to the agent on teams.goodbye.
GOODBYE_GRACE_MS8000How long the agent gets to speak the goodbye before session.end. The call ends this grace + a fixed 500 ms scheduling buffer after the request.
EnvDefaultMeaning
PORT8080TCP port the bridge listens on.
BIND0.0.0.0Bind address.
TLS_CERT_PATH / TLS_KEY_PATHunsetPEM cert/key for native TLS (wss). When both are set the bridge serves TLS itself; otherwise front the plain WS with a TLS terminator.
HMAC_FRESHNESS_MS60000Two-sided freshness window: a timestamp up to 60 s in the past OR the future is accepted; the replay guard holds a used handshake until the timestamp ages out.
MAX_CONNECTIONS0 (= 64)Max concurrent connections.
MAX_CONNECTIONS_PER_IP0 (= total cap)Per-IP cap. Defaults to the total cap because StandIn dials from a small set of egress IPs.
TRUST_PROXY_XFFfalseTrust the first X-Forwarded-For hop for the per-IP cap. Only enable behind a proxy you control.
PRE_START_TIMEOUT_MS0 (= 10000)Drop a connection that authenticates but never sends session.start.
WORKER_IDLE_TIMEOUT_MS0 (= 90000)Dead-peer window: end the call after this long without any worker message (the worker heartbeats every 30 s). Frees the call id for reconnect and ends the agent job.
LOG_LEVELinfodebug | info | warn | error. An invalid value falls back to info.

The bridge also exposes GET /metrics (Prometheus text format, no auth): calls total/active, call seconds, upgrade rejections by cause, frames relayed each way, backpressure drops, room connect failures, governor fires, goodbye requests, unparseable frames, and callid mismatches. Like GET /healthz it is served on the same port - keep the port private to your network or scrape through your ingress.

The bridge participant’s join token has a fixed 6 h TTL; set MAX_CALL_MINUTES well below that for calls that must end cleanly.