acoustic-spring-24340
06/26/2025, 9:54 AMtall-airline-16756
06/26/2025, 9:54 AMtall-airline-16756
06/26/2025, 9:54 AMdispatch-rule.json
with content like: {
"name": "My dispatch rule",
"rule": {
"dispatchRuleIndividual": {
"roomPrefix": "call"
}
},
"room_config": {
"agents": [
{
"agent_name": "inbound-agent"
}
]
}
}
2. Use the LiveKit CLI to create the dispatch rule by running the following command: lk sip dispatch create dispatch-rule.json
This will apply the dispatch rule for your SIP trunk. Let me know if you need further assistance!
Sources: Accepting incoming calls | LiveKit Docs | Create and configure SIP trunk | LiveKit Docsacoustic-spring-24340
06/26/2025, 10:07 AMtall-airline-16756
06/26/2025, 10:07 AMdispatch-rule.json
) with this simple structure: {
"rule": {
"dispatchRuleDirect": {
"roomName": "open-room"
}
}
}
2. Then, just use the LiveKit CLI to create your dispatch rule with this quick command: lk sip dispatch create dispatch-rule.json
Want to add an extra layer of security with a PIN? No problem! You can modify the JSON file to look like this:
{
"trunk_ids": [],
"rule": {
"dispatchRuleDirect": {
"roomName": "safe-room",
"pin": "12345"
}
}
}
Now, callers will need to enter "12345#" on their phone to connect to the "safe-room." Neat, right? π If you have any questions or need more help, I'm right here β just give me a shout! Sources: SIP dispatch rule | LiveKit Docsacoustic-spring-24340
06/26/2025, 10:10 AMtall-airline-16756
06/26/2025, 10:10 AMexport LIVEKIT_URL=<your livekit server url>
export LIVEKIT_API_KEY=<your api key>
export LIVEKIT_API_SECRET=<your api secret>
2. Next, create an AI voice agent and give it a friendly name. Pro tip: I'm using "inbound-agent" in this example: if __name__ == "__main__":
cli.run_app(
WorkerOptions(
entrypoint_fnc=entrypoint,
prewarm_fnc=prewarm,
# giving this agent a name of: "inbound-agent"
agent_name="inbound-agent",
),
)
3. Now, create an inbound LiveKit trunk with your phone number β easy peasy: {
"trunk": {
"name": "My inbound trunk",
"numbers": [
"+15105550100"
]
}
}
4. Create a dispatch rule to make sure your named agent handles those incoming calls: {
"name": "My dispatch rule",
"rule": {
"dispatchRuleIndividual": {
"roomPrefix": "call"
}
},
"room_config": {
"agents": [
{
"agent_name": "inbound-agent"
}
]
}
}
5. Finally, apply the dispatch rule using the CLI β and you're all set! lk sip dispatch create dispatch-rule.json
And just like that, incoming calls to your phone number will be routed to "inbound-agent". Need any help along the way? I'm right here! π Got questions? Just ask! Sources: Accepting incoming calls | LiveKit Docsacoustic-spring-24340
06/26/2025, 10:15 AMtall-airline-16756
06/26/2025, 10:15 AMdispatch-rule.json
) with your dispatch rule setup.
2. Then, use the LiveKit CLI to update your dispatch rule and link it to specific trunks. Just run this command: lk sip dispatch update --id <dispatch-rule-id> \
--trunks "<trunk-id1>, <trunk-id2>" \
dispatch-rule.json
Just swap out <dispatch-rule-id> with your actual dispatch rule ID, and <trunk-id1> with the trunk ID you want to connect. This way, the rule will only apply to calls coming through that specific trunk. Need any help or want me to break this down further? I'm totally here for you! π Sources: SIP dispatch rule | LiveKit Docsacoustic-spring-24340
06/26/2025, 11:35 AMtall-airline-16756
06/26/2025, 11:35 AM