sip block is absent, no trunks are provisioned, webhook forwarding is skipped, and the runtime avoids emitting SIP-specific logs. Configure the section below only when you need SIP-enabled LiveKit rooms.
LiveKit SIP support requires valid
LIVEKIT_API_KEY and LIVEKIT_API_SECRET values. Provisioning is idempotent—restarts never duplicate trunks or dispatch rules.Configuration methods
YAML example
Environment variables
| Variable | Required | Description |
|---|---|---|
SIP_ROOM_PREFIX | Yes | Prefix every SIP-related LiveKit room must start with (alphanumeric, -, _). |
SIP_ALLOWED_ADDRESSES | No | Comma-separated IPv4 addresses/CIDRs. Whitespace is trimmed. |
SIP_HOOKS_JSON | No | JSON array of { "host": "example.com", "url": "https://..." } objects. HTTPS required. |
Precedence
Validation rules
Room prefix
- Cannot be empty
- Only alphanumeric,
-,_ - Examples:
sip-,room_42
Allowed addresses
- List cannot be empty when SIP block exists
- Each entry must resemble IPv4 or CIDR (
X.X.X.X/Y) - IPv6 not supported yet
Hooks
- Hostnames must be unique (case-insensitive)
- URLs must start with
https:// - Rejects insecure
http://hooks
Auto-provisioning workflow
When SIP config and LiveKit credentials are present, Sayna provisions everything automatically during startup.1
Trunk creation
Creates
sayna-{room_prefix}-trunk with your allowed_addresses list.2
Dispatch rule
Creates
sayna-{room_prefix}-dispatch that routes SIP calls into LiveKit rooms matching the prefix (max 3 participants by default).3
Idempotent guards
Existing resources are reused; provisioning failures abort startup with clear logs so you can fix credentials or LiveKit connectivity issues.
LIVEKIT_API_KEYLIVEKIT_API_SECRET- Valid
sipblock or env vars
Runtime behavior
Room prefix matching
Any LiveKit room whose name begins withroom_prefix is treated as SIP. This heuristic drives routing logic, logging, and webhook forwarding.
IP filtering
allowed_addresses becomes the allowlist enforced by LiveKit. Use it to restrict inbound SIP traffic to trusted carriers or local networks.
Webhook forwarding
When LiveKit delivers webhooks, Sayna optionally forwards the exact JSON payload to downstream HTTPS hooks based on the SIPTo header:
- Inspect
participant.attributes["sip.h.to"](populated by LiveKit SIP). - Parse the host portion (e.g.,
sip:[email protected]→sip1.example.com). - Match the host to entries in
hooks(case-insensitive). - Post the payload to
hook.urlusing the sharedReqManagerso pooling/limits match the rest of the platform. - If no hook matches, log the omission but still respond
200 OKto LiveKit.
Runtime hook management
You can inspect and update the forwarding table without restarting the server:GET /sip/hooksreturns the cached list of{ host, url }entries.POST /sip/hooksreplaces hooks with matching hosts (case-insensitive) and adds new ones, then persists the result. Runtime additions reuse the global hook secret; per-hook secrets are not stored.
AUTH_REQUIRED=true if you enforce auth globally. Always use unique hosts and HTTPS URLs or the request will be rejected.
Reference configurations
Single carrierAccessing config in code
Troubleshooting
| Error | Cause | Fix |
|---|---|---|
SIP room_prefix is required when SIP configuration is present | Allowed addresses or hooks were specified without a prefix. | Set SIP_ROOM_PREFIX or the YAML equivalent. |
SIP hook URL must be HTTPS | Hook used http://. | Update to https:// for every entry. |
Duplicate SIP hook host | Same host appears twice (case-insensitive). | Ensure each host is unique. |
SIP allowed_address '...' does not look valid | Invalid IPv4/CIDR string. | Replace with real IPv4 or x.x.x.x/y CIDR. |
Related docs
- Configure Twilio SIP – walk through Twilio Elastic SIP Trunking setup using Sayna’s SIP endpoint.
- Authentication – protect webhook receivers and REST APIs.
- Deployment guide – configure LiveKit credentials alongside SIP env vars.