when making calls through FreePBX, livekit sip ret...
# ask-ai
a
when making calls through FreePBX, livekit sip returns a "503 Try again later". why is this? the call is not connecting to the agent
t
Thanks for reaching out, Abdul. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
A "503 Try again later" error from LiveKit SIP typically indicates an authentication failure during call processing. This can happen due to: • Authentication credential mismatch: Ensure the username and password in your LiveKit SIP trunk configuration match what FreePBX expects. • Incorrect SIP trunk setup: Verify that the SIP trunk is configured to accept traffic from LiveKit SIP. • Network connectivity issues: Check for proper NAT traversal and ensure there are no network blocks. To resolve this, review your SIP trunk credentials and configuration on both FreePBX and LiveKit. Additionally, check the logs on both systems to pinpoint the exact issue. Let me know if you need guidance on configuring the SIP trunk or further troubleshooting steps. Sources: livekit/livekit_sip.pb.go | pkg/sip/inbound.go | SIP Integration | livekit/livekit_composite | DeepWiki | Making outbound calls | LiveKit Docs
c
I would appreciate any help on how to integrate my livekit agent with my asterisk/freebpbx environment. So I want all inbound calls to 055XXXXXX to trigger my livekit agent. Also would like my agent to transfer call back to my asterisk/freepbx ring group when a caller request to speak with a human agent. Currently I have configured an inbound trunk with the number on livekit cloud. Have also created a dispatch rule for that trunk. On the pbx, i have create a trunk (Livekit-AI-agent) and configured the host as the sip uri for my livekit project. I have an inbound route and have set the destination to a custom destination the points to livekit uri. With all this done, inbound calls fail to trigger the agent.
t
Hey there! To help you set up LiveKit SIP with your Asterisk/FreePBX system smoothly, could you share a bit more info? • Which version of Asterisk/FreePBX are you currently running? • Are you planning for LiveKit SIP to authenticate with Asterisk, or will you go with IP-based authentication? • What kind of call flow are you aiming for? For example: ◦ Inbound → Asterisk → LiveKit Agent → Transfer to Ring Group ◦ Inbound → Asterisk Ring Group → If no answer → LiveKit Agent • When transferring back to the ring group, do you prefer it to be blind (immediate) or attended (with an announcement)? • Are there any particular SIP headers or network/firewall settings we should keep in mind? Once I have these details, I’ll be able to guide you with the exact steps to get everything working just right. Sources: Create and configure SIP trunk | LiveKit Docs | lib/livekit/sip_service_client.rb | src/setup-livekit.ts | SIP APIs | LiveKit Docs | SIP overview | LiveKit Docs
c
My Asterisk version is 20.5.0 and Incredible PBX 2027-D 16.0.40.4. I intend to have authentication via password and username for livekit and asterisk. I prefer this flow : Inbound → Asterisk → LiveKit Agent → Transfer to Ring Group I don't have any firewall setting nor sip headers configured and do not intend to do so.
t
To get LiveKit SIP working smoothly with your Asterisk/FreePBX setup for inbound calls and transferring to a ring group, here’s a friendly step-by-step guide: • Create an Inbound Trunk in LiveKit: ◦ Start by setting up a trunk using your phone number, along with a username and password for authentication. ◦ Here’s an example configuration to help you out:
Copy code
{
  "trunk": {
    "name": "asterisk-inbound-trunk",
    "numbers": [
      "+15105550100"
    ],
    "auth_username": "your_sip_username",
    "auth_password": "your_sip_password",
    "allowed_addresses": [
      "192.168.1.100/32"
    ]
  }
}
• Create a Dispatch Rule: ◦ Next, set up a rule to route calls to a LiveKit room. Here’s an example:
Copy code
{
  "dispatch_rule": {
    "rule": {
      "dispatchRuleIndividual": {
        "roomPrefix": "call-"
      }
    },
    "name": "asterisk-dispatch-rule",
    "trunkIds": [
      "trunk_id"
    ]
  }
}
• Configure Asterisk SIP Trunk: ◦ Then, configure a SIP trunk in Asterisk using the LiveKit SIP URI as your host. ◦ Make sure to use the same username and password you set up in LiveKit. • Call Transfer: ◦ Finally, you can transfer calls back to your Asterisk ring group using the LiveKit API. Here’s a handy example:
Copy code
sip_client.transfer_sip_participant(
  room_name,
  participant_identity,
  "sip:ringgroup@asterisk_host",
  play_dialtone: false
)
If you want me to walk you through any of these steps in more detail, just let me know—I’m here to help! Sources: SIP inbound trunk | LiveKit Docs | livekit-api/src/services/sip.rs | cmd/lk/sip.go | src/setup-livekit.ts | lib/livekit/proto/livekit_sip_pb.rb
c
I'm very much interested in a more detailed steps on how to configure the asterisk sip trunk and routing the inbound calls to join the livekit room. and also the trunks to receive transfer calls from livekit agent.
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
c
I want steps to Configure Asterisk SIP Trunk in details.