polite-ambulance-60111
02/28/2025, 9:55 PMgray-monkey-83525
02/28/2025, 9:55 PMpolite-ambulance-60111
02/28/2025, 9:56 PMgray-monkey-83525
02/28/2025, 9:56 PMexport LIVEKIT_URL=<your LiveKit server URL>
export LIVEKIT_API_KEY=<your API Key>
export LIVEKIT_API_SECRET=<your API Secret>
2. Create a SIP Trunk: Use the Twilio console or API to create a SIP trunk. Ensure the domain name is set to your Twilio SIP domain.
twilio api trunking v1 trunks create \
--friendly-name "My SIP Domain Trunk" \
--domain-name "<your-sip-domain>.sip.twilio.com"
3. Configure the Trunk: Set up the trunk for inbound or outbound calls. For inbound calls, configure an origination URI to point to your LiveKit SIP endpoint.
twilio api trunking v1 trunks origination-urls create \
--trunk-sid <twilio_trunk_sid> \
--friendly-name "LiveKit SIP URI" \
--sip-url "sip:<your LiveKit SIP URI>" \
--weight 1 --priority 1 --enabled
4. Associate Phone Number: Link a phone number to your SIP trunk.
twilio api trunking v1 trunks phone-numbers create \
--trunk-sid <twilio_trunk_sid> \
--phone-number-sid <twilio_phone_number_sid>
5. Create LiveKit Inbound Trunk: Use the LiveKit CLI to create an inbound trunk.
{
"trunk": {
"name": "Twilio SIP Domain Trunk",
"numbers": [
"+15105550100"
],
"auth_username": "<username>",
"auth_password": "<password>"
}
}
lk sip inbound create inbound-trunk.json
6. Add Dispatch Rule: Route incoming calls to a specific LiveKit room.
{
"name": "My Dispatch Rule",
"trunk_ids": [
"<livekit_trunk_id>"
],
"rule": {
"dispatchRuleIndividual": {
"roomPrefix": "call"
}
}
}
lk sip dispatch create dispatch-rule.json
These steps will set up your Twilio SIP domain to work with LiveKit, allowing you to handle calls through LiveKit rooms.
Sources:
- Configuring a SIP provider trunk
- Accepting incoming calls 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.