Hey everyone, I am using the Inbound Twilio calls ...
# ask-ai
m
Hey everyone, I am using the Inbound Twilio calls with livekit, I followed the documentation, also limited to my phone number, configured the twinMl bin, and I keep getting 503 error response from LiveKit. Error message: 503 service error with sip:+1{myphone}@{domain}.sip.livekit.cloud the error actually includes the phone and domain, just I hid them for here. Can you please help ?
t
Thanks for reaching out, Dion. 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 out! Could you please share a bit more about your setup? For example: • Are you using a custom domain for your LiveKit deployment? • Have you had a chance to check the TwiML bin configuration to make sure it’s pointing to the right LiveKit SIP endpoint? • Do you have any extra error logs or details from Twilio or LiveKit that might give us some clues? Sources: SIP troubleshooting guide | LiveKit Docs
m
I am using livekit deployment and it also happening only when the number is mentioned
when the number of trunk is empty it doesnt work
t
I'm sorry to hear you're running into the 503 error when the number is mentioned. This can sometimes happen due to a configuration mismatch between Twilio and LiveKit, but don’t worry—we’ll work through it together. Here are some steps that might help: • Verify Twilio SIP Trunk Configuration: Please double-check that the SIP URI is formatted as
sip:${sipHost};transport=tcp
and correctly set as an origination URL in your Twilio trunk. Also, make sure your phone number is linked to the trunk and that the SIP credentials are set up properly. • Check LiveKit Inbound Trunk Configuration: It’s important that your LiveKit inbound trunk has the right phone number, username, and password matching your Twilio setup. Also, verify that a dispatch rule is in place to route incoming calls to the correct rooms. • Validate SIP URI Format: Confirm that the LiveKit SIP URI is properly formatted and accessible. • Review Inbound Method: If you’re using Twilio Programmable Voice instead of Elastic SIP Trunking, please ensure you’ve enabled "Inbound calls with Twilio programmable voice" by setting up TwiML Bins and directing your phone number to the right webhook. • Re-run Setup Scripts: If you can, try running the setup scripts again (
npm run setup:twilio
and
npm run setup:livekit
) to make sure everything is configured correctly. Could you let me know if you’re using Elastic SIP Trunking or Twilio Programmable Voice for inbound calls? Also, have you followed the setup scripts or configured things manually? This will really help me guide you more precisely. Sources: SIP troubleshooting guide | LiveKit Docs | README.md | Inbound calls with Twilio Voice | LiveKit Docs
m
Twilio Programmable Voice. I followed the official documentation setup
I want all the phone numbers to be linked to the same trunk
t
I'm happy to help you link all your phone numbers to the same trunk using Twilio Programmable Voice! Here's a simple way to do it step-by-step: • Create a Single TwiML Bin: Head over to your TwiML Bins page and create a TwiML Bin with this content:
Copy code
<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Dial>
        <Sip username="your_username" password="your_password">
            sip:your-livekit-sip-uri
        </Sip>
    </Dial>
</Response>
• Assign the TwiML Bin to All Phone Numbers: For each of your phone numbers, visit the Manage Numbers page, select the number, and set the "A call comes in" option to the TwiML Bin you just created. • Configure a Single LiveKit Inbound Trunk: Next, set up a LiveKit inbound trunk that accepts calls from any phone number by using the wildcard character (*). Here's an example:
Copy code
const trunk = await sipClient.createSipInboundTrunk(
  'inbound-trunk',
  ['*'], // Accept calls to any phone number
  {
    auth_username: 'your_username',
    auth_password: 'your_password',
  },
);
This way, all your phone numbers will be smoothly routed through the same trunk. If you have any questions or need a hand with any of these steps, please don’t hesitate to ask—I’m here to help!
m
I want to send the phone number as part of sip ?
t
I'm happy to help you include the phone number as part of the SIP in Twilio Programmable Voice with LiveKit! You can do this by adding the phone number in the SIP URI. Here's a simple way to set it up: • Modify the TwiML Bin: Update your TwiML Bin to add the phone number within the SIP URI. For example:
Copy code
<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Dial>
        <Sip username="your_username" password="your_password">
            sip:+1234567890@your-livekit-sip-uri
        </Sip>
    </Dial>
</Response>
• Configure LiveKit Inbound Trunk: Make sure your LiveKit inbound trunk is properly set up to accept calls with the phone number in the SIP URI. Here's an example:
Copy code
const trunk = await sipClient.createSipInboundTrunk(
  'inbound-trunk',
  ['+1234567890'], // Specify the phone number
  {
    auth_username: 'your_username',
    auth_password: 'your_password',
  },
);
• Test the Configuration: Try making a test call to confirm that the phone number is sent as part of the SIP URI and that it routes correctly to LiveKit. This setup will help ensure the phone number is included in the SIP URI for routing or identification. If you have any questions or need more help, please don’t hesitate to reach out—I’m here for you! Sources: Inbound calls with Twilio Voice | LiveKit Docs | README.md | SIP APIs | LiveKit Docs | rpc/sip.pb.go | Preserving Caller ID During SIP Transfers in LiveKit Agents