How do I connect to a phone just for inbound using...
# ask-ai
m
How do I connect to a phone just for inbound using Twilio?
t
Thanks for reaching out, Nikki. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'd love to help you connect a phone for inbound calls using Twilio in LiveKit! Here’s a simple step-by-step guide to get you started: 1. Purchase a phone number from Twilio: If you haven’t got one yet, you can easily buy a phone number through the Twilio Console. 2. Set up a TwiML Bin: In your Twilio Console, create a TwiML Bin with this content to redirect incoming calls to LiveKit: `<Response> <Dial> <Sip>${LIVEKIT_SIP_URI};transport=tcp</Sip> </Dial> </Response>`Just be sure to replace
${LIVEKIT_SIP_URI}
with your actual LiveKit SIP URI. 3. Direct the phone number to the TwiML Bin: Next, configure your purchased phone number in the Twilio Console to use the TwiML Bin for incoming calls. 4. Create a LiveKit inbound trunk: You can do this using the LiveKit CLI or SDK. Here’s an example using the CLI:
Copy code
{
  "name": "inbound-trunk",
  "numbers": [
    "+1234567890"
  ],
  "auth_username": "your_username",
  "auth_password": "your_password",
  "allowed_addresses": [
    "54.208.8.0/30",
    "34.225.132.64/30"
  ]
}
5. Create a dispatch rule: This will route each incoming caller to their own room. For example, using the CLI:
Copy code
{
  "name": "inbound-dispatch-rule",
  "trunk_ids": [
    "trunk_id"
  ],
  "rule": {
    "type": "individual",
    "room_prefix": "call"
  },
  "room_config": "default"
}
If you have any questions or need a hand with any of these steps, just let me know—I’m here to help! Sources: Inbound calls with Twilio Voice | LiveKit Docs | README.md | SIP participant | LiveKit Docs | lib/livekit/sip_service_client.rb
m
1. Direct the phone number to the TwiML Bin: Next, configure your purchased phone number in the Twilio Console to use the TwiML Bin for incoming calls. What does this step involve
t
I'd be happy to help you set up your Twilio phone number to use a TwiML Bin for incoming calls. Here’s a simple way to do it: 1. Set up a TwiML Bin: Head over to your TwiML Bins page in the Twilio Console. Create a new TwiML Bin and add the TwiML instructions you need, like redirecting the call to LiveKit. 2. Point your phone number to the TwiML Bin: Next, visit the Manage Numbers page and select your Twilio phone number. Under the Voice Configuration section, find the A call comes in field. Choose TwiML Bin and then pick the TwiML Bin you just created. With this setup, any incoming calls to your Twilio number will follow the instructions you set in your TwiML Bin. If anything feels unclear or you want me to walk you through any part, just let me know—I’m here to help! Sources: Inbound calls with Twilio Voice | LiveKit Docs
m
I have gone through the steps. But when I call the number I don't get the agent - how do I make sure the agent is deployed and working ? I have the agent here https://cloud.livekit.io/projects/p_mbjw2m5qd5p/agents/CA_8wJKqt3WB998 Where should I use the Trunk ID?
t
To make sure your LiveKit agent is all set up and ready to handle inbound calls smoothly, let’s walk through these steps together: 1. Configure a SIP Inbound Trunk: This step connects your SIP provider (like Twilio) to LiveKit. Think of the trunk as the gateway that defines which phone numbers you accept for inbound calls, the IP addresses allowed, and the authentication details. Here’s a quick example:
Copy code
const trunk = await sipClient.createSipInboundTrunk(
  'inbound-trunk',
  ['+1234567890'],
  {
    auth_username: 'your_username',
    auth_password: 'your_password'
  }
);
2. Create a SIP Dispatch Rule: Next, you’ll want to use the Trunk ID in a dispatch rule to make sure incoming calls are routed correctly. Here’s how you can do that:
Copy code
await sipClient.createSipDispatchRule(
  {
    type: 'individual',
    roomPrefix: 'call'
  },
  {
    name: 'inbound-dispatch-rule',
    trunkIds: [trunk.sipTrunkId] // Use Trunk ID here
  }
);
3. Deploy the Agent: Finally, ensure your agent is set up to join the rooms created by inbound calls. Once everything is in place, the agent will automatically join the room as soon as a call comes in. Just a quick tip: the Trunk ID goes into the
trunkIds
field of your dispatch rule to link everything properly. If you hit any bumps or want me to walk you through any part of this, I’m here to help—just let me know! Sources: Accepting inbound calls | LiveKit Docs | SIP inbound trunk | LiveKit Docs | README.md | protobufs/livekit_sip.proto | SIP overview | LiveKit Docs
m
Got it - what is 503 service error on the call? 503 service error with sip:mbjw2m5qd5p.sip.livekit.cloud;transport=tcp
t
I'm sorry to hear you're encountering a 503 Service Unavailable error with LiveKit SIP. This can happen for a few different reasons, but don’t worry—we’ll work through it together. Here are some common causes and helpful steps to get things back on track: 1. Incorrect SIP Endpoint: It’s a good idea to double-check that the
address
field in your trunk configuration exactly matches the SIP endpoint your provider gave you. For example, sometimes using a subdomain like
myproject.sip.provider.com
instead of the correct
sip.provider.com
can cause issues. 2. Authentication Issues: Make sure your username and password are entered correctly and accepted by your SIP provider. Authentication hiccups are a common reason for a 503 error. 3. Network Connectivity: Let’s verify that the necessary ports for SIP signaling (port 5060) and media (like ports 10000–20000) are open and reachable from the internet. Sometimes firewalls or network settings can unintentionally block these. 4. Server-Side Errors: It’s helpful to check your server logs for any authentication or internal errors that might be causing the 503 response. For instance, an issue with the
GetAuthCredentials
function could be at play. Taking a close look at these areas usually helps resolve the problem. If you’d like, I’m here to guide you through any of these steps or answer any questions you have along the way! Sources: Ports and firewall | LiveKit Docs | Self-hosted SIP server | LiveKit Docs | SIP troubleshooting guide | LiveKit Docs | pkg/sip/service.go
m
Where do I use the SIP endpoint? I followed your trunk creation sterps = no where to input the SIP endpoint
t
Hi there! The SIP endpoint is what you'll use in the address field when you're creating or updating an outbound SIP trunk. This field tells the system the hostname or IP address where the SIP INVITE should be sent. For instance, if your LiveKit SIP URI is
sip:mbjw2m5qd5p.sip.livekit.cloud
, then your SIP endpoint would be
mbjw2m5qd5p.sip.livekit.cloud
. Here’s how you can set it up: 1. For LiveKit: Just fill in the
address
field in your trunk configuration like this:
Copy code
{
  "name": "outbound-trunk",
  "address": "mbjw2m5qd5p.sip.livekit.cloud",
  "auth_username": "your_username",
  "auth_password": "your_password"
}
2. For Third-Party Providers: Make sure to use the correct SIP endpoint they require. For example, Twilio or Telnyx might ask for endpoints like
sip.telnyx.com
. If anything feels unclear or you want a hand with the setup, just let me know—I’m here to help! Sources: livekit-api/src/services/sip.rs | protobufs/livekit_sip.proto | SIP trunk setup | LiveKit Docs | test/lktest-sip-outbound/README.md | SIP troubleshooting guide | LiveKit Docs
m
Do I need outbound-trunk? I just wanted a answering angent
t
Hi there! You actually don’t need an outbound trunk if your main goal is just to handle inbound calls with an answering agent. The outbound trunk is really only needed if you want to make outbound calls, which doesn’t apply in your case. For your setup, here are a few things to keep in mind: 1. Inbound Trunk: This is essential for accepting incoming calls from your SIP provider (like Twilio). 2. Dispatch Rule: Use this to direct incoming calls to specific rooms or to create individual rooms for each call. 3. Agent Deployment: Make sure your agent is set up to join the rooms created by the dispatch rule so they can handle the calls smoothly. If you’d like, I’m here to help you with any of these steps—just let me know!
m
Im setting up inbound trunk right now, can you provider me the json-editor version of it
t
Here’s a friendly example of a JSON configuration to help you set up an inbound trunk:
Copy code
{
  "name": "inbound-trunk",
  "metadata": "Optional metadata",
  "numbers": [
    "+1234567890"
  ],
  "auth_username": "your_username",
  "auth_password": "your_password",
  "allowed_addresses": [
    "54.208.8.0/30",
    "34.225.132.64/30",
    "54.244.120.128/30",
    "184.72.220.192/30",
    "50.16.251.224/27",
    "54.174.220.64/27",
    "34.203.16.96/27",
    "3.208.142.224/27",
    "3.208.142.254"
  ]
}
Just a couple of things to update: • `+1234567890`: Replace this with your Twilio phone number. •
your_username
and `your_password`: Use your SIP authentication credentials here. If you have any questions or need a hand with this setup, please don’t hesitate to reach out—I’m here to help!
m
sip:mbjw2m5qd5p.sip.livekit.cloud;transport=tcp
this is the TO in my call (twilio) account does this SIP look right for a to address?
t
I'm glad you asked! The SIP address
sip:mbjw2m5qd5p.sip.livekit.cloud;transport=tcp
does look correct for the "To" address in your Twilio account. It includes the LiveKit SIP URI along with the transport protocol (TCP), which is essential for routing the call to LiveKit smoothly. If you happen to run into any issues, here are a few things to double-check: • Make sure the SIP URI matches exactly what’s provided in your LiveKit project settings. • Confirm that the transport protocol (TCP) is supported and properly configured in your Twilio settings. • Verify that your inbound trunk and dispatch rule are correctly set up in LiveKit to handle the incoming call. Please feel free to reach out if you need any more help or have other questions—I’m here to support you!
m
•
your_username
and `your_password`: Use your SIP authentication credentials here. What ios this crednetial? where do I get it
t
I’m here to help you understand the SIP authentication credentials (
auth_username
and
auth_password
) that you set up during the creation of your inbound trunk. These credentials play an important role in verifying incoming SIP INVITE requests from your SIP provider to LiveKit. Here’s a friendly guide on how to manage them: • Define Credentials: You’ll create these when setting up the inbound trunk. For example, in your JSON configuration, it might look like this:
Copy code
{
  "auth_username": "your_username",
  "auth_password": "your_password"
}
• Store Securely: It’s best to keep these credentials safe—consider using environment variables or a secrets management tool like AWS Secrets Manager or HashiCorp Vault. • Example Usage: In many example projects, these credentials are conveniently stored in a
.env.local
file and then used during the trunk creation process. Just a quick note: please double-check that your SIP provider supports username and password authentication for inbound calls. If you have any questions or need more help, I’m here for you—just let me know! Sources: packages/sip--um-actually/src/setup-twilio.ts | lib/livekit/sip_service_client.rb | SIP inbound trunk | LiveKit Docs | Create and configure a Plivo SIP trunk | LiveKit Docs | livekit/livekit_sip.pb.go
m
Yeah how do I check Im using Twilio as my SIP provider - how do I know what my auth_username and auth_password is?
I have auth_token'
t
Thanks for reaching out! I wanted to share that Twilio Elastic SIP Trunking doesn’t actually use
auth_username
and
auth_password
for inbound calls. Instead, Twilio secures things through IP-based authentication or by using TwiML to route calls to your LiveKit SIP endpoint. Here’s a simple way to get this set up: 1. IP-Based Authentication: Make sure the IP addresses Twilio uses for SIP signaling are added to the
allowed_addresses
field in your LiveKit inbound trunk configuration. You can find Twilio’s IP ranges in their documentation. 2. TwiML Configuration: Create a TwiML Bin in your Twilio Console to route calls directly to your LiveKit SIP URI (for example,
sip:mbjw2m5qd5p.sip.livekit.cloud;transport=tcp
). Also, the
auth_token
you mentioned is usually meant for Twilio’s REST API, not SIP authentication. If you’d like, I’m here to help you walk through setting up IP-based authentication or TwiML—just let me know!
m
How do I know what address Twilio uses?
t
Twilio kindly shares a list of IP addresses used for SIP signaling in their official documentation. To make sure everything runs smoothly, you'll want to add these IP addresses to the
allowed_addresses
field in your LiveKit inbound trunk configuration. You can easily find the IP ranges for Twilio’s SIP signaling in their documentation under the Elastic SIP Trunking section, or if you prefer, you can reach out to Twilio support directly. If you need any help with this or have questions, please don’t hesitate to ask—I’m here to help! Sources: Create and configure a Twilio SIP trunk | LiveKit Docs | pkg/sip/config.go
m
After setting all this up - how do I make sure the agent is set up to receive calls from this? my code below
t
Let's make sure your LiveKit agent is all set up to receive calls from your inbound SIP trunk. Here’s a step-by-step guide to help you through the process: 1. Set Up the SIP Trunk: First, double-check that your SIP provider (like Twilio) is properly configured to route calls to your LiveKit SIP URI. For Twilio users, you can use Elastic SIP Trunking or TwiML Bins to direct calls to
sip:mbjw2m5qd5p.sip.livekit.cloud;transport=tcp
. 2. Configure LiveKit SIP: ◦ Create an inbound trunk in LiveKit so it can authenticate and accept calls from your SIP provider. ◦ Set up a dispatch rule to route incoming calls to a room and have your agent join the call. For example:
Copy code
const dispatchRule = await sipClient.createSipDispatchRule(
  {
    type: 'individual',
    roomPrefix: 'call'
  },
  {
    name: 'inbound-dispatch-rule',
    trunkIds: [trunk.sipTrunkId]
  }
);
1. Set Up the Agent: Make sure your agent is ready to join rooms created by the dispatch rule. In your agent’s code, include the logic to answer calls using
generate_reply()
right after
session.start()
. 2. Test the Setup: Give the configured phone number a call. You should see the call route to LiveKit, a room get created, and your agent dispatched to join and respond. If you’d like, I’m here to help review your agent code or assist with testing the setup—just let me know! Sources: packages/sip--um-actually/src/setup-twilio.ts | Accepting inbound calls | LiveKit Docs | Inbound calls with Twilio Voice | LiveKit Docs | SIP trunk setup | LiveKit Docs | src/setup-twilio.ts
m
Where do I add the generate_reply()? async def entrypoint(_ctx_: JobContext) -> None: session = AgentSession() session.userdata = AppointmentData() session.state = {"current_node": "collect_patient_info"} await session.start(agent=CollectPatientInfoAgent(ctx), room=ctx.room) await session.generate_reply( instructions="Greet the user and offer your assistance." )
t
I'm glad to see that the
generate_reply()
method is already in the right place in your code! It should indeed be called after
session.start()
to create a response based on your agent's logic and the instructions you've provided. Let me walk you through your code step-by-step: 1. Initialize the Session: You create and set up the
session
object with user data and state. 2. Start the Session: Calling
session.start()
kicks off the agent's interaction in the chosen room. 3. Generate a Reply: Using
session.generate_reply()
, the agent responds to the user—in your case, greeting and offering help. Your approach looks solid! If the agent isn’t responding as you expect, you might want to double-check that: • The agent logic inside
CollectPatientInfoAgent
is correctly handling the session state and instructions. • The room specified in
ctx.room
is active and accessible. Please feel free to reach out if you'd like any help with debugging or testing—I’m here to support you!
m
WHen / how will the session be stopped? How do I test locally or deployed?
t
I'm here to help you smoothly stop a LiveKit agent session and test it either locally or in a deployed environment. Let's walk through the steps together: 1. Stopping a Session: ◦ Disconnecting the Agent Only: You can use
session.aclose()
to disconnect just the agent while keeping the room active for others. Here’s a quick example:
Copy code
await self.session.drain()
await self.session.aclose()
◦ Disconnecting Everyone (Ending the Room): If you want to end the session for all participants and remove the room, the server API’s
deleteRoom
method will do the trick. 1. Testing Locally: ◦ Terminal Mode: For a quick check, run your agent in console mode like this:
python myagent.py console
◦ Development Mode: To connect to a LiveKit server with hot reloading, use development mode: `python myagent.py dev`Just make sure you have these environment variables set: ▪︎
LIVEKIT_URL
▪︎
LIVEKIT_API_KEY
▪︎
LIVEKIT_API_SECRET
1. Testing Agent Connectivity: A handy way to interact with your agent is through the LiveKit dashboard sandbox or the Agents Playground. It’s a great place to see things in action. 2. Production Deployment: When you’re ready to go live, start the agent with production optimizations using:
python myagent.py start
3. Load Testing: To simulate multiple sessions and really put your setup through its paces, try the
livekit-cli
like this:
Copy code
lk perf agent-load-test \
  --rooms 5 \
  --agent-name test-agent \
  --echo-speech-delay 10s \
  --duration 5m
If you have any questions or need a hand with any of these steps, please don’t hesitate to ask. I’m here to support you! Sources: README.md | basics/exit_message.py | Job lifecycle | LiveKit Docs | README.md | README.md
m
<Response>
<Dial>
<Sip>${LIVEKIT_SIP_URI};transport=tcp</Sip>
</Dial>
`</Response>`Just be sure to replace
${LIVEKIT_SIP_URI}
with your actual LiveKit SIP URI. LiveKit_SIP_URI - should this include my phone number? or is it the one I find on my livekit dashboard
sip:mbjw2m5qd5p.sip.livekit.cloud
t
Just a quick tip: the
${LIVEKIT_SIP_URI}
should be swapped out with the SIP URI you can find on your LiveKit dashboard, like
sip:mbjw2m5qd5p.sip.livekit.cloud
. No need to include your phone number there. Your SIP provider (for example, Twilio) will take care of routing the call to this URI based on how your phone number is set up in their system. If anything’s unclear or you want me to walk you through it, just let me know—I’m here to help!
m
https://docs.livekit.io/sip/accepting-calls-twilio-voice/ yeah this doc says to use
Copy code
<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Dial>
    <Sip username="<sip_trunk_username>" password="<sip_trunk_password>">
      sip:<your_phone_number>@mbjw2m5qd5p.sip.livekit.cloud
    </Sip>
  </Dial>
</Response>
is this the same as the LIVEKIT_SIP_URI that I have been useing?
t
Thanks for sharing the example! I noticed it’s a bit different from the
LIVEKIT_SIP_URI
you’ve been using. In this case, the SIP URI actually includes your phone number as part of the address, like this:
Copy code
sip:<your_phone_number>@mbjw2m5qd5p.sip.livekit.cloud
Here’s a little breakdown to help clarify: • LIVEKIT_SIP_URI: This is the base SIP URI you get from your LiveKit dashboard, for example,
sip:mbjw2m5qd5p.sip.livekit.cloud
. • With Phone Number: This version adds your phone number to the SIP URI, which might be needed for certain setups where the phone number helps route the call properly. If the documentation suggests including the phone number, it’s best to follow that format. Just swap out
<your_phone_number>
with your actual phone number, and double-check that your username and password match your SIP trunk credentials. Please don’t hesitate to reach out if you want me to walk you through this or if you have any other questions. I’m here to help!
m
Ok I got it setup - now how do I make sure the agent I am working with answers the phone is it supposed to work if I spin this up locally with python agent.py dev - and it should connect? or do I need to deploy/update the current agent with the call answering piece (agent.generate_reply())
t
Hey there! If you’re running the agent locally using
python agent.py dev
, it should be able to connect and answer the phone as long as a few key things are in place: 1. Agent Code: Make sure your agent code includes the
generate_reply()
method, which is essential for handling incoming calls. If this part isn’t implemented yet in your deployed agent, you’ll want to update and redeploy it. 2. Local Environment: Double-check that your environment variables (
LIVEKIT_URL
,
LIVEKIT_API_KEY
,
LIVEKIT_API_SECRET
) are correctly set so your local instance can connect smoothly to your LiveKit project. 3. Dispatch Rule: Confirm that the dispatch rule is properly set up to route calls to your agent. The agent needs to be explicitly dispatched to the room that’s created for the call. 4. Testing: Give it a try by dialing the configured phone number. Ideally, the call should route through LiveKit, create a room, and then dispatch your locally running agent to join and respond. If the agent isn’t responding like you expect, it might be a good idea to update the deployed agent with the call-answering logic or take a closer look at your local setup to ensure it’s connected properly to LiveKit. Please don’t hesitate to reach out if you want a hand with any of these steps—I’m here to help!
m
1. Agent Code: Make sure your agent code includes the
generate_reply()
method, which is essential for handling incoming calls. If this part isn’t implemented yet in your deployed agent, you’ll want to update and redeploy it. How do I update and redeploy if its just local?
t
I’m glad you’re working with a local agent! To update it, there’s no need to redeploy to a server. You can simply tweak the local code and restart the agent. Here’s a friendly step-by-step to help you through it: 1. Update the Code: Just add or adjust the
generate_reply()
method in your agent code to handle incoming calls. For example:
Copy code
async def entrypoint(ctx: JobContext) -> None:
    session = AgentSession()
    session.userdata = AppointmentData()
    session.state = {"current_node": "collect_patient_info"}
    await session.start(agent=CollectPatientInfoAgent(ctx), room=ctx.room)
    await session.generate_reply(instructions="Greet the user and offer your assistance.")
2. Restart the Agent: Once you’ve made your changes, just stop the agent that’s running and restart it with:
python agent.py dev
3. Test the Changes: Give it a try by dialing the configured phone number to make sure your updated agent is responding just right. And if down the road you want to deploy your agent to a server, you’ll need to package and deploy the updated code to your production environment. Feel free to reach out anytime if you’d like some help with that — I’m here to support you!
m
Dispatch rule - what does this mean? Mine is pretty generic :
session = AgentSession()
session.userdata = AppointmentData()
session.state = {"current_node": "collect_patient_info"}
await session.start(agent=CollectPatientInfoAgent(ctx), room=ctx.room)
await session.generate_reply(instructions="Greet the user and offer your assistance.")
t
I’m glad you reached out! When we talk about explicitly dispatching an agent to a room, it means making sure your dispatch rule is set up to send calls to a specific room, and that your agent is ready to join that room as soon as it’s created. Here’s a quick breakdown: 1. Dispatch Rule Configuration: This is where you decide how incoming calls are directed. For instance, the rule might create a new room for every call or send all calls to one particular room. If your dispatch rule is a bit generic, it might not be sending calls to the exact room where your agent is waiting. 2. Agent Session: In your code, the
session.start()
method is what actually gets the agent into the room defined by
ctx.room
. It’s important that this room matches the one created by your dispatch rule for each call. Here are some easy steps to double-check: • Take a look at your dispatch rule to make sure it’s aligned with the room your agent is supposed to join. • Verify that the
ctx.room
value in your agent’s code matches the room created by the dispatch rule. If you’d like, I’m here to help you review your dispatch rule or agent setup anytime. Just let me know!
Let me help you understand how a dispatch rule in LiveKit works—it’s all about making sure your incoming calls find the right room and the right agent smoothly. Think of it as the friendly guide that directs each call to where it needs to go. Here’s a simple breakdown: 1. Room Routing: The dispatch rule decides whether to create a brand-new room for every call (like using a prefix such as
call-
) or to send all calls into one specific room. 2. Agent Dispatch: It also makes sure the right agent gets assigned to the room, which is super helpful if you have several agents or special rules about who should handle which calls. In your code, you’re applying the dispatch rule when you start the session with
session.start(agent=CollectPatientInfoAgent(ctx), room=ctx.room)
. Just make sure the
ctx.room
matches the room that the dispatch rule created. If your dispatch rule is set up in a general way, it probably creates a new room for each call with some default settings. If you want, I’m here to help you customize that rule or walk you through how it’s all set up—just let me know!
m
Here are some easy steps to double-check: • Take a look at your dispatch rule to make sure it’s aligned with the room your agent is supposed to join. • Verify that the
ctx.room
value in your agent’s code matches the room created by the dispatch rule. How do I check? Ive shared my dispatch rule { "sipDispatchRuleId": "SDR_NyrHNdvRaKhc", "rule": { "dispatchRuleIndividual": { "roomPrefix": "call-" } }, "trunkIds": [ "ST_Vec9hc3TDyiY" ], "name": "My dispatch rule" } and my entrypoint code async def entrypoint(_ctx_: JobContext) -> None: session = AgentSession() session.userdata = AppointmentData() session.state = {"current_node": "collect_patient_info"} await session.start(agent=CollectPatientInfoAgent(ctx), room=ctx.room) await session.generate_reply( instructions="Greet the user and offer your assistance." )
t
Let's make sure your dispatch rule and agent code are working smoothly together. Here’s a simple way to check: 1. Verify the Room Name: Your dispatch rule creates rooms starting with
call-
. For example, a call might open a room named
call-12345
. Please double-check that the
ctx.room
value in your agent code matches this pattern. 2. Check the Agent Code: In your entrypoint code, the
ctx.room
value is passed to
session.start()
. It’s important to confirm that
ctx.room
is set correctly and aligns with the room name created by the dispatch rule. 3. Test the Setup: Try dialing the configured phone number and keep an eye on the LiveKit dashboard to see the room name that’s created. Then, check that your agent joins that same room. If your agent isn’t joining the room, no worries! Here are a few things to double-check: • That the dispatch rule is properly linked to the trunk (
trunkIds
field). • Your agent is running and connected to LiveKit. • The
ctx.room
value is being set dynamically based on the room created by the dispatch rule. Feel free to reach out if you’d like me to help you troubleshoot further — I’m here to support you!
m
1. Test the Setup: Try dialing the configured phone number and keep an eye on the LiveKit dashboard to see the room name that’s created. Then, check that your agent joins that same room. how do I check this if im testing locally run setup?
t
When testing locally, you can easily keep an eye on the room creation and agent activity through the LiveKit dashboard and logs. Here’s a friendly guide to help you along: 1. Monitor the LiveKit Dashboard: Head over to the LiveKit Cloud dashboard and click on the Rooms section. When you dial the configured phone number, you should see a new room pop up with a name that matches the dispatch rule (like
call-12345
). 2. Check Agent Logs: If you’re running the agent locally using
python agent.py dev
, keep an eye on the terminal output. The logs will show when the agent joins a room and what actions it’s taking. 3. Verify Room Name: Double-check that the room name created by the dispatch rule matches the
ctx.room
value in your agent code. If they don’t line up, the agent won’t be able to join the room. 4. Simulate Calls: Feel free to use the LiveKit sandbox or a SIP client to simulate calls and see how the agent behaves locally. If you’d like, I’m here to help you interpret the logs or troubleshoot any issues you run into—just let me know!