How to setup a inbound caller for my livekit app u...
# ask-ai
f
How to setup a inbound caller for my livekit app using python.
g
To set up an inbound caller for your LiveKit app using Python, you need to configure an inbound SIP trunk and a dispatch rule. Here's a brief overview: 1. Create an Inbound SIP Trunk: Use the
CreateSIPInboundTrunk
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:
Copy code
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.
f
How to connect this with a voice agent pipeline @millions-hair-24956