little-traffic-72206
02/13/2025, 10:30 PMgray-monkey-83525
02/13/2025, 10:30 PMdispatchRuleIndividual
to route each caller into a separate room. This setup allows you to manage multiple phone numbers under a single trunk and create individual rooms for each call.
To achieve this, you can set up a dispatch rule for each phone number, specifying the dispatchRuleIndividual
option. You can also use the metadata
or attributes
fields in the dispatch rule to specify the agent_name
that should join the room, as described in the SIP participant attributes documentation.
Would you like more detailed guidance on setting this up?
Sources:
- LiveKit SIP documentation
- SIP participant attributes documentation 👍 0 button 👎 1 button 💡 Hint: Mention @millions-hair-24956 in the thread for followups.little-traffic-72206
02/13/2025, 10:31 PMlittle-traffic-72206
02/13/2025, 10:37 PMgray-monkey-83525
02/13/2025, 10:37 PMlittle-traffic-72206
02/13/2025, 10:46 PMgray-monkey-83525
02/13/2025, 10:46 PMdispatchRuleIndividual
option. Here's a sample JSON configuration for a dispatch rule that handles calls to the phone number `+12125551212`:
{
"name": "Individual Dispatch Rule for +12125551212",
"trunk_ids": [
"<your-trunk-id>"
],
"hide_phone_number": false,
"rule": {
"dispatchRuleIndividual": {
"roomPrefix": "call-",
"pin": ""
}
},
"metadata": "{\"agent_name\": \"specific-agent\"}"
}
In this configuration:
- Replace "<your-trunk-id>"
with the actual trunk ID associated with your SIP trunk.
- The roomPrefix
is set to "call-"
, which will prefix the room names created for each call.
- The metadata
field is used to specify the agent_name
that should join the room, in this case, "specific-agent"
.
This setup will ensure that each call to +12125551212
creates a new room prefixed with "call-"
, and the specified agent will be dispatched to the room.
Would you like more details on any specific part of this configuration?
Sources:
- SIP dispatch rule documentation 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.little-traffic-72206
02/13/2025, 10:51 PM{
"rule": {
"dispatchRuleIndividual": {
"roomPrefix": "call-"
}
},
"roomConfig": {
"agents": [
{
"agentName": "inbound-agent",
"metadata": "job dispatch metadata"
}
]
}
}
gray-monkey-83525
02/13/2025, 10:51 PMroomConfig
section. Here's how you can structure the JSON to include an agent with specific metadata:
{
"name": "Individual Dispatch Rule for +12125551212",
"trunk_ids": [
"<your-trunk-id>"
],
"hide_phone_number": false,
"rule": {
"dispatchRuleIndividual": {
"roomPrefix": "call-"
}
},
"roomConfig": {
"agents": [
{
"agentName": "inbound-agent",
"metadata": "job dispatch metadata"
}
]
}
}
In this configuration:
- The roomConfig
section specifies the agents that should be dispatched to the room.
- The agentName
is set to "inbound-agent"
, which is the name of the agent you want to join the room.
- The metadata
field can be used to pass additional information to the agent, such as "job dispatch metadata"
.
This setup ensures that each call to +12125551212
creates a new room with the specified agent and metadata.
Would you like more details on implementing this configuration?
Sources:
- SIP dispatch rule documentation 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.little-traffic-72206
02/13/2025, 10:55 PMlittle-traffic-72206
02/13/2025, 10:56 PMgray-monkey-83525
02/13/2025, 10:57 PMsip.trunkPhoneNumber
to identify the number dialed.
Here's a general approach:
1. Single SIP Trunk: Configure a single SIP trunk that accepts multiple phone numbers.
2. Dispatch Rule: Use a dispatchRuleIndividual
to route each call into a separate room.
3. Determine Agent: In your application logic, use the sip.trunkPhoneNumber
attribute to determine which agent should join the room. This attribute will contain the phone number that was dialed.
4. Agent Assignment: Based on the sip.trunkPhoneNumber
, dynamically assign the appropriate agent to the room.
Here's a conceptual example of how you might implement this in your application logic:
participant = await ctx.wait_for_participant()
if participant.attributes['sip.trunkPhoneNumber'] == '+12125551212':
agent_name = "2125551212-agent"
# Logic to dispatch the agent to the room
This approach allows you to use a single SIP trunk and dynamically assign agents based on the dialed number.
Would you like more detailed guidance on implementing this logic?
Sources:
- SIP participant attributes documentation 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.little-traffic-72206
02/13/2025, 10:58 PMgray-monkey-83525
02/13/2025, 10:58 PMdispatchRuleIndividual
without specifying trunk_ids
. Here's a JSON configuration for such a dispatch rule:
{
"name": "Universal Dispatch Rule",
"hide_phone_number": false,
"rule": {
"dispatchRuleIndividual": {
"roomPrefix": "call-"
}
}
}
In this configuration:
- The dispatchRuleIndividual
option is used to create a new room for each caller.
- The roomPrefix
is set to "call-"
, which will prefix the room names created for each call.
- The hide_phone_number
is set to false
to ensure the phone number is visible in the participant attributes.
With this setup, you can use the sip.trunkPhoneNumber
attribute in your application logic to determine which agent should join the room, as previously described.
Would you like more details on implementing this configuration?
Sources:
- SIP dispatch rule documentation 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.