many-cpu-5552
08/28/2025, 1:49 PM{
"trunk": {
"name": "Accounts Inbound Trunk",
"numbers": [
"10004"
],
"allowed_addresses": [
"0.0.0.0/0"
]
}
}
Dispatch Rule:
{
"dispatch_rule": {
"rule": {
"dispatchRuleIndividual": {
"roomPrefix": "accounts"
}
},
"name": "Accounts Dispatch Rule",
"roomConfig": {
"agents": [
{
"agentName": "accounts-agent",
"metadata": "Accounts Dispatch Rule"
}
]
}
},
"trunk_ids": [
"ST_an2rsLVYkJiP"
]
}
How can I manage SIP Endpoints for multiple departments:
Like
1. 10001@public-ip:5060 For accounts
2. 10002@public-ip:5060 For support
3. 10003@public-ip:5060 For claims
Each with there own agent.tall-airline-16756
08/28/2025, 1:49 PMtall-airline-16756
08/28/2025, 1:50 PMmany-cpu-5552
08/28/2025, 1:51 PMtall-airline-16756
08/28/2025, 1:53 PM{
"dispatch_rule": {
"rule": {
"dispatchRuleIndividual": {
"roomPrefix": "call-"
}
},
"roomConfig": {
"agents": [
{
"agentName": "phone-assistant",
"metadata": "inbound call handler"
}
]
}
}
}
This way, every incoming call will connect to a specific agent in a new room—pretty neat, right?
2. Implement Department Routing Logic
Next, use a centralized phone assistant agent to handle incoming calls and route them based on what the caller chooses (like pressing numbers on their keypad). For example:
• Press 1 for Accounts
• Press 2 for Support
• Press 3 for Claims
From there, the agent can transfer the call to the right department’s SIP endpoint using SIP REFER transfers.
3. Example Routing Logic
You can define department-specific numbers in your environment variables like this:
BILLING_PHONE_NUMBER=+12345678901
TECH_SUPPORT_PHONE_NUMBER=+12345678902
CUSTOMER_SERVICE_PHONE_NUMBER=+12345678903
Then, map the caller’s input (DTMF tones) to these departments and transfer the call accordingly.
4. Recommendations
If each department has its own phone number (like 10001@<public-ip>:5060 for Accounts), you can set up dispatch rules that route calls directly to the right agents or rooms based on the number dialed. It keeps things nice and organized!
If you want, I’m happy to dive into more details or help with any specific setup questions you have—just let me know!
Sources: agent.py | README.md | Agent dispatch | LiveKit Docs | Company directory phone assistant | LiveKit Docs | Inbound calls with Twilio Voice | LiveKit Docsmany-cpu-5552
08/28/2025, 1:57 PMtall-airline-16756
08/28/2025, 1:58 PM{
"1": {
"number": "+12345678901",
"name": "Accounts"
},
"2": {
"number": "+12345678902",
"name": "Support"
},
"3": {
"number": "+12345678903",
"name": "Claims"
}
}
4. Transfer Calls Using SIP REFER
Once the agent catches the DTMF input, use the LiveKit SIP API to transfer the call to the correct department’s SIP endpoint. Something like this:
await livekitApi.sip.transfer_sip_participant({
participant_identity: "caller-id",
room_name: "current-room",
transfer_to: "tel:+12345678901"
});
5. Customize and Scale
Feel free to add more departments by expanding your DTMF mapping, and tweak the agent’s behavior to fit exactly what you need. If you want to get fancy, you can even integrate AI-powered logic with OpenAI or similar tools for a smarter experience.
For more details, check out the LiveKit Phone Assistant Repository and the Company Directory Recipe.
If you have any questions or want help with specific setups, just let me know—I’m happy to assist!
Sources: Company directory phone assistant | LiveKit Docs | README.md | README.md | SIP APIs | LiveKit Docs | lib/livekit/sip_service_client.rbmany-cpu-5552
08/28/2025, 1:59 PMtall-airline-16756
08/28/2025, 2:00 PM{
"name": "Billing Trunk",
"numbers": [
"+1234567890"
]
}
{
"name": "Support Trunk",
"numbers": [
"+0987654321"
]
}
Each trunk acts as a unique entry point for calls headed to a specific department.
2. Configure Dispatch Rules for Call Routing
Dispatch rules help decide where calls go once they come in through a trunk. You can set up different rules for each department like this:
• Direct Routing: Use dispatchRuleDirect to send calls straight to a specific room (like "billing-room").
• Individual Routing: Use dispatchRuleIndividual to create a new room for each caller (for example, "support-call-").
Here’s an example dispatch rule for the Billing department:
{
"dispatch_rule": {
"rule": {
"dispatchRuleDirect": {
"roomName": "billing"
}
},
"trunk_ids": [
"billing_trunk_id"
],
"name": "Billing Department"
}
}
3. Use a Single Trunk with Department-Specific Rules (Optional)
If you prefer to use one main phone number, you can route calls based on the number dialed or a PIN. For example:
{
"dispatch_rule": {
"rule": {
"dispatchRuleDirect": {
"roomName": "billing"
}
},
"trunk_ids": [
"main_trunk_id"
],
"inbound_numbers": [
"+1234567890"
],
"name": "Billing Department",
"pin": "123"
}
}
This way, you can have clear entry points and routing tailored to each department’s needs. If you want, I’m here to help with any part of the setup—just let me know!
Sources: README.md | livekit-protocol/livekit/protocol/sip.py | SIP dispatch rule | LiveKit Docs | sip/sip.go | SIP APIs | LiveKit Docsmany-cpu-5552
08/28/2025, 2:14 PMtall-airline-16756
08/28/2025, 2:15 PM