<@U084APK40NS> how should we do inbound trunking w...
# ask-ai
b
@millions-hair-24956 how should we do inbound trunking when my sip provider is twilio
g
To set up inbound trunking with Twilio as your SIP provider, follow these steps: 1. Set Up Environment Variables: Configure the LiveKit CLI with your server details by setting environment variables for
LIVEKIT_URL
,
LIVEKIT_API_KEY
, and
LIVEKIT_API_SECRET
(source). 2. Create a SIP Trunk: Use the Twilio CLI to create a SIP trunk. Ensure the domain name ends with
pstn.twilio.com
. For example:
Copy code
twilio api trunking v1 trunks create --friendly-name "My test trunk" --domain-name "my-test-trunk.pstn.twilio.com"
(source). 3. Configure the Trunk: Set up the trunk for inbound calls by configuring an origination URI. Use the following command:
Copy code
twilio api trunking v1 trunks origination-urls create --trunk-sid <twilio_trunk_sid> --friendly-name "LiveKit SIP URI" --sip-url "sip:<your SIP host>" --weight 1 --priority 1 --enabled
(source). 4. Associate Phone Number: Link your phone number to the SIP trunk using the Twilio CLI:
Copy code
twilio api trunking v1 trunks phone-numbers create --trunk-sid <twilio_trunk_sid> --phone-number-sid <twilio_phone_number_sid>
(source). 5. Create an Inbound Trunk in LiveKit: Create a JSON file (
inbound-trunk.json
) with your trunk details and use the LiveKit CLI to create the inbound trunk:
Copy code
{
  "trunk": {
    "name": "Twilio inbound trunk",
    "numbers": [
      "+15105550100"
    ],
    "auth_username": "<username>",
    "auth_password": "<password>"
  }
}
Copy code
lk sip inbound create inbound-trunk.json
(source). 6. Add a Dispatch Rule: Create a dispatch rule to route calls to a LiveKit room. Create a
dispatch-rule.json
file:
Copy code
{
  "name": "My dispatch rule",
  "trunk_ids": [
    "<livekit_trunk_id>"
  ],
  "rule": {
    "dispatchRuleIndividual": {
      "roomPrefix": "call"
    }
  }
}
Apply the rule using the CLI:
Copy code
lk sip dispatch create dispatch-rule.json
(source). Would you like more detailed guidance on any of these steps? Sources: - Accepting incoming calls - Configuring a SIP provider trunk 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.