sip configuration and provide LIVEKIT_API_KEY / LIVEKIT_API_SECRET. All you need to do on the carrier side is tell Twilio where to send calls.
TL;DR – Create/choose a Twilio Elastic SIP trunk, add Sayna’s SIP domain/IP to the Origination list as a SIP URI (e.g.,sip:sip.sayna.ai;transport=tcp), and make sure Twilio’s source IP ranges are present inSIP_ALLOWED_ADDRESSES.
Prerequisites
sipblock configured in Sayna (room_prefix,allowed_addresses, optionalhooks).- Public DNS record or static IP that routes to your Sayna deployment (Load balancer, ingress, etc.).
- LiveKit credentials so Sayna can create the trunk + dispatch rule automatically.
- Twilio account with Elastic SIP Trunking enabled.
Sayna creates the LiveKit resources (names
sayna-{prefix}-trunk / sayna-{prefix}-dispatch) so you do not need to follow LiveKit’s manual steps from their quickstarts. Focus on the Twilio console configuration only.Step 1 — Expose Sayna’s SIP endpoint
- Pick a hostname such as
sip.yourcompany.comthat resolves to the Sayna service running with SIP enabled. - Ensure TCP 5060/5061 reaches Sayna (or whatever port your reverse proxy exposes for SIP traffic).
- Add Twilio’s regional egress IP ranges to
SIP_ALLOWED_ADDRESSESso Sayna accepts their traffic. Twilio lists these ranges in the Elastic SIP Trunking IP access control documentation — copy the ranges for every region you plan to use.
Step 2 — Create or select a Twilio trunk
- In the Twilio Console, navigate to Elastic SIP Trunking → Trunks.
- Create a new trunk or open an existing one dedicated to Sayna.
- Give it a meaningful name (e.g.,
SaynaBridge).
Step 3 — Configure origination URI
Twilio needs to know where to send inbound SIP INVITE requests. Use the domain/IP where Sayna listens for SIP traffic.- Inside the trunk, go to the Origination tab.
- Click Add new Origination URI.
- Set SIP URI to the Sayna address with TCP enforced:
- (Optional) Specify a Friendly Name like “Sayna Primary”.
- Leave the weight/priority defaults unless you have multiple Sayna regions.
- Save the trunk.
Twilio supports TLS/SRTP as well, but Sayna currently expects TCP. Keep the
;transport=tcp suffix in the URI to avoid UDP-only failures.sip.yourcompany.com whenever the trunk’s phone numbers receive a call. Sayna detects the room_prefix, routes the call into the auto-provisioned LiveKit room, and forwards events/webhooks per your SIP configuration.
Step 4 — Map numbers to the trunk
- Still in the Twilio Console, open Phone Numbers → Manage → Active numbers.
- Assign the desired DID(s) to the trunk you configured.
- Test by dialing the number and watching Sayna logs—the connection should hit the SIP trunk and trigger your WebSocket workflow.
Operational checklist
- Allowed addresses – keep Twilio IP ranges current; Twilio occasionally adds regions.
- Health checks – monitor Sayna logs for
Failed to provision SIP resourcesto catch LiveKit credential issues early. - Recording + hooks – configure
livekit.enable_recordingandSIP_HOOKS_JSONin Sayna if you want downstream webhooks when Twilio callers join/leave. - Twilio failover – add a backup Origination URI (secondary Sayna region) with lower priority if you run multi-region fleets.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Twilio calls immediately fail | Origination URI unreachable or wrong transport | Verify DNS resolves to Sayna, firewall allows TCP 5060/5061, and URI uses ;transport=tcp. |
| Twilio 403/603 responses | Sayna rejected IP | Add the relevant Twilio IP range/CIDR to SIP_ALLOWED_ADDRESSES. |
| Sayna logs “SIP room_prefix is required” | SIP env vars incomplete | Set SIP_ROOM_PREFIX (and other SIP vars) before starting Sayna. |
| Calls reach Sayna but never hit LiveKit | LiveKit credentials missing or invalid | Ensure LIVEKIT_API_KEY/LIVEKIT_API_SECRET are configured so auto-provisioning can join the room. |
| LiveKit room created but no downstream hooks fire | SIP_HOOKS_JSON empty or host mismatch | Populate hooks with the domains you expect in sip.h.to headers. |
Related docs
- SIP configuration – field-by-field breakdown of Sayna’s SIP options (room prefix, hooks, auto-provisioning).
- Twilio guide – reference article that inspired this flow (follow only the Twilio console steps; Sayna handles the LiveKit pieces).