lively-coat-10905
11/07/2025, 11:57 AMtall-airline-16756
11/07/2025, 11:58 AMtall-airline-16756
11/07/2025, 11:58 AMusername, password, and your-livekit-sip-uri with your actual LiveKit SIP credentials and URI. This step connects your Twilio number to LiveKit.
3. Direct Phone Number to TwiML Bin: Then, configure your Twilio phone number to use this TwiML Bin for incoming calls. You can do this under the "Voice Configuration" section in the Twilio Console.
4. Create a LiveKit Inbound Trunk: Using the LiveKit SDK, create an inbound SIP trunk. Here’s an example to make it easier:
`import { SipClient } from 'livekit-server-sdk';
const sipClient = new SipClient(LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET);
await sipClient.createSipInboundTrunk(
'inbound-trunk',
[TWILIO_PHONE_NUMBER],
{
auth_username: TWILIO_SIP_USERNAME,
auth_password: TWILIO_SIP_PASSWORD,
}
);`Feel free to reach out if you want me to walk you through this code!
5. Create a Dispatch Rule: Finally, set up a dispatch rule to route incoming callers to LiveKit rooms:
await sipClient.createSipDispatchRule(
{
type: 'individual',
roomPrefix: 'call',
},
{
name: 'inbound-dispatch-rule',
trunkIds: [trunk.sipTrunkId],
}
);
For a full example, including setup scripts and a working project, you can check out the LiveKit SIP Agent Example. It’s a great resource to see everything in action.
If you run into any bumps along the way, double-check that your TwiML Bin and LiveKit SIP credentials are set up correctly. And please don’t hesitate to ask if you need any more help — I’m here to support you!
Sources: Inbound calls with Twilio Voice | LiveKit Docs | README.mdlively-coat-10905
11/07/2025, 12:09 PMtall-airline-16756
11/07/2025, 12:10 PMorigination URL should be pointing to your LiveKit SIP URI using TCP transport (for example, sip:your-livekit-sip-uri;transport=tcp).
2. Associate Phone Number with Trunk: Make sure your Twilio phone number is linked to the SIP trunk. Without this connection, calls won’t be routed to LiveKit.
3. Check SIP Credentials: It’s important that the SIP credentials (username and password) in Twilio exactly match what you have in LiveKit. If they don’t, authentication errors can pop up.
4. Configure LiveKit Inbound Trunk and Dispatch Rule: Take a moment to verify that the inbound SIP trunk and dispatch rule in LiveKit are properly set up to accept and route calls coming from Twilio.
5. Enable Inbound Calls via TwiML: If you’re using Twilio Programmable Voice, please check that the TwiML Bin is correctly configured to redirect calls to your LiveKit SIP URI.
6. Check Regional Compliance: Sometimes calls can fail due to regional regulations. Using region pinning can help make sure you’re compliant with local laws.
If you’re still running into trouble, don’t hesitate to share the exact error message or code you’re seeing (like "403 Forbidden" or "503 Service Unavailable"). I’m here to help you every step of the way!
Sources: src/setup-livekit.ts | packages/sip--um-actually/README.md | SIP troubleshooting guide | LiveKit Docs | Inbound calls with Twilio Voice | LiveKit Docs