flaky-beard-91685
02/17/2025, 11:31 AMgray-monkey-83525
02/17/2025, 11:31 AMCreateSIPInboundTrunk
API to configure an inbound trunk. This involves specifying the phone numbers that will be accepted by the trunk. You can do this programmatically using the LiveKit Python SDK.
2. Configure a Dispatch Rule: Use the CreateSIPDispatchRule
API to define how incoming calls are routed. For example, you can route each caller into an individual room using the dispatchRuleIndividual
option.
Here's a basic example of how you might set this up in Python:
from livekit import api
from livekit.protocol import sip as proto_sip
# Initialize the LiveKit API client
lkapi = api.LiveKitAPI()
# Create an inbound trunk
inbound_trunk = proto_sip.CreateSIPInboundTrunkRequest(
trunk=proto_sip.SIPInboundTrunkInfo(
name="Demo inbound trunk",
numbers=["+15105550100"]
)
)
trunk_info = lkapi.sip.create_sip_inbound_trunk(inbound_trunk)
# Create a dispatch rule
dispatch_rule = proto_sip.CreateSIPDispatchRuleRequest(
rule=proto_sip.SIPDispatchRuleInfo(
name="Demo Dispatch Rule",
trunk_ids=[trunk_info.trunk_id],
rule=proto_sip.DispatchRuleIndividual(roomPrefix="call-")
)
)
lkapi.sip.create_sip_dispatch_rule(dispatch_rule)
Would you like more detailed guidance on any specific part of this setup?
Sources:
- SIP inbound trunk
- SIP dispatch rule
- SIP APIs 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.flaky-beard-91685
02/17/2025, 11:32 AM