freezing-action-35171
02/28/2025, 9:04 PMgray-monkey-83525
02/28/2025, 9:04 PMfreezing-action-35171
02/28/2025, 9:06 PMfreezing-action-35171
02/28/2025, 9:10 PMgray-monkey-83525
02/28/2025, 9:10 PMpstn.twilio.com
.
- Configure Origination URI: Set the origination URI to point to your LiveKit SIP server. For example, sip:<your-project-id>.sip.livekit.cloud;transport=tcp
.
2. LiveKit SIP Configuration:
- Set Up Environment Variables: Configure the LiveKit CLI with your server URL, API key, and secret.
export LIVEKIT_URL=<your LiveKit server URL>
export LIVEKIT_API_KEY=<your API Key>
export LIVEKIT_API_SECRET=<your API Secret>
- Create Inbound Trunk: Use the LiveKit CLI to create an inbound trunk. Create a JSON file (inbound-trunk.json
) with your phone number and authentication details.
{
"trunk": {
"name": "Twilio inbound trunk",
"numbers": [
"+15105550100"
],
"auth_username": "<username>",
"auth_password": "<password>"
}
}
Run the command: lk sip inbound create inbound-trunk.json
.
- Create Dispatch Rule: Create a dispatch rule to route calls to a LiveKit room. Create a JSON file (dispatch-rule.json
) with the trunk ID and room prefix.
{
"name": "My dispatch rule",
"trunk_ids": [
"<livekit_trunk_id>"
],
"rule": {
"dispatchRuleIndividual": {
"roomPrefix": "call"
}
}
}
Run the command: lk sip dispatch create dispatch-rule.json
.
3. Audio Track Publication:
- Ensure your agent publishes an audio track as soon as it joins the room. This can be a silent track for testing purposes.
- Use the LiveKit SDK to publish an audio track. Here's a basic example in Python:
from livekit import rtc
async def publish_audio_track(room):
# Create a local audio track
audio_track = rtc.LocalAudioTrack.create()
# Publish the audio track to the room
await room.local_participant.publish_track(audio_track)
# Connect to the room and publish the track
room = await rtc.connect("wss://<your-livekit-url>", token="<your-token>")
await publish_audio_track(room)
Would you like more information on any specific step?
Sources:
- LiveKit SIP Quickstart
- LiveKit SIP Overview 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.freezing-action-35171
02/28/2025, 9:13 PMgray-monkey-83525
02/28/2025, 9:13 PMauth_username
and auth_password
used in the inbound-trunk.json
file are meant for authenticating the SIP trunk with your SIP provider, such as Twilio. These credentials should be configured in your SIP provider's settings to ensure that the LiveKit server can authenticate incoming calls.
1. Twilio Configuration: In Twilio, you typically set up authentication credentials when configuring your SIP trunk. This involves creating a credential list with a username and password that you will use in your LiveKit configuration.
2. LiveKit Configuration: Use the same auth_username
and auth_password
in your inbound-trunk.json
file to ensure that LiveKit can authenticate incoming calls from Twilio.
If you haven't set up these credentials in Twilio, you should do so in the Twilio console under the SIP trunk settings. Would you like more detailed guidance on setting up these credentials in Twilio?
Sources:
- LiveKit SIP Quickstart 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.freezing-action-35171
02/28/2025, 9:15 PMgray-monkey-83525
02/28/2025, 9:15 PMauth_username
and auth_password
) is not strictly necessary unless your SIP provider requires it for security purposes. However, it is a good practice to use authentication to prevent unauthorized access to your SIP trunk.
1. Inbound Trunk Authentication: If your SIP provider, such as Twilio, supports or requires authentication for inbound calls, you should configure these credentials in both your SIP provider's settings and in the inbound-trunk.json
file used by LiveKit. This ensures that only authenticated requests are accepted by your LiveKit instance.
2. Twilio Configuration: While Twilio typically requires authentication for outbound calls, you can also set up authentication for inbound calls if desired. This involves creating a credential list in Twilio and using those credentials in your LiveKit configuration.
If your current setup does not require authentication for inbound calls, you can proceed without it. However, if you encounter issues or want to enhance security, consider setting up these credentials.
Would you like more information on configuring authentication for inbound calls?
Sources:
- LiveKit SIP Quickstart 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.freezing-action-35171
02/28/2025, 9:18 PMgray-monkey-83525
02/28/2025, 9:18 PMsip:<your-project-id>.sip.livekit.cloud;transport=tcp
.
- Configure Authentication: If you choose to use authentication, create a credential list in Twilio with a username and password.
2. LiveKit Setup:
- Set Up Environment Variables: Configure the LiveKit CLI with your server URL, API key, and secret.
export LIVEKIT_URL=<your LiveKit server URL>
export LIVEKIT_API_KEY=<your API Key>
export LIVEKIT_API_SECRET=<your API Secret>
- Create Inbound Trunk: Use the LiveKit CLI to create an inbound trunk. Create a JSON file (inbound-trunk.json
) with your phone number and authentication details.
{
"trunk": {
"name": "Twilio inbound trunk",
"numbers": [
"+15105550100"
],
"auth_username": "<username>",
"auth_password": "<password>"
}
}
Run the command: lk sip inbound create inbound-trunk.json
.
- Create Dispatch Rule: Create a dispatch rule to route calls to a LiveKit room. Create a JSON file (dispatch-rule.json
) with the trunk ID and room prefix.
{
"name": "My dispatch rule",
"trunk_ids": [
"<livekit_trunk_id>"
],
"rule": {
"dispatchRuleIndividual": {
"roomPrefix": "call"
}
}
}
Run the command: lk sip dispatch create dispatch-rule.json
.
3. Agent Setup:
- Create an AI Voice Agent: Use the LiveKit CLI to create an AI voice agent that will join the room and interact with the caller.
- Publish Audio Track: Ensure the agent publishes an audio track upon joining the room. This can be a silent track for testing purposes.
4. Testing:
- Make a Call: Dial the Twilio phone number. The call should be routed through the SIP trunk to the LiveKit room.
- Agent Interaction: The LiveKit agent should join the room and interact with the caller.
Would you like more detailed steps on any specific part of this setup?
Sources:
- LiveKit SIP Quickstart
- LiveKit SIP Overview 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.freezing-action-35171
02/28/2025, 10:39 PMgray-monkey-83525
02/28/2025, 10:39 PM