I’m trying to setup LiveKit and my AI Agent to be ...
# ask-ai
b
I’m trying to setup LiveKit and my AI Agent to be accessible via a Twilio number, but when I call Twilio it keeps telling me I need to set the Voice URL. What am I doing wrong?
g
To set up LiveKit with a Twilio number, ensure that your SIP trunk is correctly configured. You need to associate your Twilio number with a SIP trunk that routes calls to your LiveKit instance. This involves setting up an inbound SIP trunk and dispatch rules in LiveKit to handle incoming calls. Make sure your Twilio number is linked to the SIP trunk and that the SIP URI is correctly configured in Twilio's console. If Twilio is prompting for a Voice URL, it might be expecting a TwiML application or webhook URL. However, for SIP integration, you should ensure that the SIP trunk is set up to route calls directly to LiveKit. Check the LiveKit SIP Quickstart guide for detailed steps on configuring SIP trunks and dispatch rules. Would you like more detailed guidance on any specific step? Sources: - LiveKit SIP Quickstart guide πŸ‘ 0 button πŸ‘Ž 0 button πŸ’‘ Hint: Mention @runllm in the thread for followups.
b
@millions-hair-24956 Ok, I have the Twilio SPI trunk routing to LiveKit now but LiveKit does not seem to be answering. The SIP address seems to be correct in Twilio. How can I debug this?
g
To debug why LiveKit is not answering the SIP calls from Twilio, follow these steps: 1. Verify SIP Trunk Configuration: Ensure that the SIP trunk is correctly configured in LiveKit. Check that the inbound trunk and dispatch rules are set up properly. The trunk should be associated with the correct phone number and dispatch rules should route calls to the intended LiveKit room. Refer to the LiveKit SIP inbound trunk documentation for guidance. 2. Check LiveKit Logs: Look at the LiveKit logs to see if there are any errors or indications of incoming calls. This can help identify if the calls are reaching LiveKit and if there are any issues with the room or participant setup. 3. Twilio Logs: Review the Twilio call logs to ensure that the calls are being routed correctly to the LiveKit SIP address. Check for any error messages or status codes that might indicate why the call is not being answered. 4. Network Configuration: Ensure that your network configuration allows SIP traffic to reach LiveKit. This includes checking firewall settings and ensuring that the necessary ports are open. Refer to the

AWS inbound rules imageβ–Ύ

for port configuration guidance. 5. Test with a Softphone: As a troubleshooting step, try connecting a softphone to the LiveKit SIP endpoint to see if it can connect successfully. This can help isolate whether the issue is with Twilio or LiveKit. Would you like more detailed guidance on any of these steps? Sources: - LiveKit SIP inbound trunk documentation - Figure Image πŸ‘ 0 button πŸ‘Ž 0 button πŸ’‘ Hint: Mention @runllm in the thread for followups.
b
@millions-hair-24956 How do I check the LiveKit logs?
g
To check the LiveKit logs, you can use the following methods depending on your deployment setup: 1. Self-hosted Deployment: If you are running LiveKit on your own server, you can access the logs by SSHing into your server and using Docker commands. Run
sudo docker-compose logs
in the directory where your LiveKit Docker Compose file is located. This will display the logs for all services defined in your Docker Compose setup. 2. Systemd Service: If LiveKit is set up as a systemd service, you can check the logs using the
journalctl
command. Run
journalctl -u livekit-docker
to view the logs for the LiveKit service. 3. LiveKit Cloud: If you are using LiveKit Cloud, logs might be accessible through the LiveKit Cloud console or dashboard, depending on the features provided by the service. For more detailed troubleshooting steps, refer to the LiveKit self-hosting troubleshooting guide. Would you like more detailed guidance on any specific method? Sources: - LiveKit self-hosting troubleshooting guide πŸ‘ 0 button πŸ‘Ž 0 button πŸ’‘ Hint: Mention @runllm in the thread for followups.
b
@millions-hair-24956 I’m guessing it’s a dispatch rule problem, but I don’t see how to determine the issue. I can see a call coming in in the sessions console in LiveKit, but my AI agent never connects.
g
If you see the call in the LiveKit sessions console but the AI agent is not connecting, it likely indicates an issue with the dispatch rule configuration. Here are steps to troubleshoot and resolve the issue: 1. Verify Dispatch Rule Configuration: Ensure that the dispatch rule is correctly set up to route calls to the appropriate room. The dispatch rule should specify the correct trunk ID and room name. If you are using a
dispatchRuleIndividual
, ensure that it is configured to create a new room for each caller. Refer to the LiveKit SIP dispatch rule documentation for details. 2. Check Agent Configuration: Ensure that your AI agent is configured to automatically join the room specified in the dispatch rule. The agent should be running and registered with LiveKit, ready to join any new room created by the dispatch rule. 3. Logs and Debugging: Check the logs for both LiveKit and your AI agent to see if there are any error messages or indications of why the agent is not joining the room. This can provide insights into whether the issue is with the dispatch rule or the agent configuration. 4. Room Name Consistency: Ensure that the room name used in the dispatch rule matches the room name your agent is configured to join. Any mismatch can prevent the agent from connecting. Would you like more detailed guidance on any of these steps? Sources: - LiveKit SIP dispatch rule documentation πŸ‘ 0 button πŸ‘Ž 0 button πŸ’‘ Hint: Mention @runllm in the thread for followups.
b
@millions-hair-24956 Ok, I figured it out. I needed to totally restart my agent and now it’s working. Thanks!
g
I'm glad to hear that restarting your agent resolved the issue! If you have any more questions or need further assistance with LiveKit, feel free to ask. Happy to help! πŸ‘ 0 button πŸ‘Ž 0 button πŸ’‘ Hint: Mention @runllm in the thread for followups.