I have a project, and 2 developers who are running...
# ask-ai
l
I have a project, and 2 developers who are running the agent independently. I have created 2 trunks and 2 dispatch rules, but my call keeps going to only one of the 2 dispatch rules. How can I route my calls to the correct agent?
t
Thanks for reaching out, Mukul. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To help you route calls to the right agent smoothly, let’s walk through a few important steps together: 1. Set Agent Name in WorkerOptions: Make sure each agent has a unique
agent_name
set in their
WorkerOptions
. This step is key because it turns off automatic dispatch and lets us route calls explicitly. 2. Create Dispatch Rules: You’ll want to define SIP dispatch rules that clearly specify which agent should take each incoming call. It’s really important that the
agentName
in your dispatch rule exactly matches the
agent_name
in the agent’s setup. 3. Use Appropriate Rule Types: Depending on how you want to route calls, you have some options: - Individual Dispatch: Sends each caller to their own dedicated room. - Direct Dispatch: Routes all callers into a shared room. - Callee Dispatch: Routes calls based on the number being called. 4. Apply Rules: You can use the LiveKit CLI to create these dispatch rules from JSON files. For example:
Copy code
bash lk sip dispatch create dispatch-rule.json
If you find calls still aren’t routing quite right, it’s a good idea to double-check that the
agent_name
and
agentName
match perfectly. And of course, I’m here to help if you want to go over anything else or need a hand! Sources: Agents telephony integration | LiveKit Docs | SIP troubleshooting guide | LiveKit Docs | SIP dispatch rule | LiveKit Docs