how to deploy voice agent with livekit cloud - doc...
# ask-ai
c
how to deploy voice agent with livekit cloud - docs
t
Thanks for reaching out, Sai. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To deploy a voice agent with LiveKit Cloud, please follow these steps: 1. Create or sign in to your LiveKit Cloud account at https://cloud.livekit.io/login. 2. Install the LiveKit CLI and authenticate: ◦ Install the LiveKit CLI following the setup guide at CLI Setup Guide. ◦ Authenticate using the command:
lk cloud auth
. 1. Create a voice agent from the template: ◦ Run:
lk app create --template voice-pipeline-agent-python
. ◦ When prompted, enter your OpenAI API Key and Deepgram API Key. 1. Navigate to your agent directory and install dependencies to start your agent: ◦ Use the command:
cd <agent_dir>
. Note: If you prefer not to use the CLI, you can manually clone the repositories and follow the setup instructions in each repository. Sources: OpenAI Realtime API Quickstart | LiveKit Docs | AI Voice Assistant Quickstart | LiveKit Docs
c
" Yes—you can implement outbound calls that each connect to a dynamically created room. The overall approach is similar to handling inbound calls with LiveKit, with the main difference being that you create a SIP participant for the outbound call that specifies the room name. LiveKit will automatically create the room when the first participant joins. For example, you can: • Generate a unique room name (if needed, on your backend) and include it in the SIP participant creation payload. • Configure your TwiML app (or TwiML bin) so that the Dial verb sends the call to your LiveKit SIP endpoint (e.g., using a SIP URI like sip:+[TRUNK_NUMBER]@[YOUR_PROJECT].sip.livekit.cloud). • When the call is forwarded to LiveKit, the SIP participant is created with the provided room name, joining that room automatically. • Your agent or application can then join the same room to interact with the caller. " this is what you said earlier somewhere. how to get access to that trunk number here: async def entrypoint(ctx: JobContext):
t
To access the trunk number for a SIP participant in LiveKit, you can use the
sip.trunkPhoneNumber
attribute. This attribute contains the phone number associated with the SIP trunk: • For inbound trunks, it represents the number dialed by an end user. • For outbound trunks, it is the number a call originates from. Sources: SIP participant | LiveKit Docs
c
can I have sip:[USER_ID_STRING]@[YOUR_PROJECT].sip.livekit.cloud instead?
t
Unfortunately, I couldn't find specific information about using a
USER_ID_STRING
in the SIP URI for LiveKit. It might be best to consult the LiveKit documentation or your implementation team for further clarification on this setup.
c
ok whatever how can I actually access the sip trunk phone number here: async def entrypoint(ctx: JobContext): becase this gets called
t
To access the SIP trunk phone number in the
entrypoint
function of a LiveKit agent, you can retrieve it from the job metadata. Here's an example:
Copy code
async def entrypoint(ctx: JobContext):
    # The phone number to dial is provided in the job metadata
    phone_number = ctx.job.metadata
    <http://logger.info|logger.info>(f"Dialing {phone_number} to room {ctx.room.name}")
The phone number is stored in
ctx.job.metadata
and can be accessed directly within the
entrypoint
function. Sources: Making calls using SIP | LiveKit Docs
c
so if this is called sip:+[TRUNK_NUMBER]@[YOUR_PROJECT].sip.livekit.cloud). phone_number = ctx.job.metadata gives the TRUNK_NUMBER?
t
The sources indicate that
ctx.job.metadata
contains the phone number to dial, but they do not specifically confirm whether it provides the
TRUNK_NUMBER
. You may need to verify this in your implementation or consult your LiveKit configuration to confirm.
c
how do I deploy my voice agent codebase so that when that sip trunk gets dialed my code gets called. what is the setup here
t
To deploy your voice agent codebase so that it gets called when the SIP trunk is dialed, follow these steps: 1. Create an agent using the Voice Agent quickstart as a prerequisite. 2. Set up LiveKit SIP for outgoing calls by: ◦ Creating and configuring a SIP trunk with your trunking provider. ◦ Creating an outbound trunk in LiveKit. 1. Create your voice agent application using the template:
lk app create --template voice-pipeline-agent-python
You can find more templates in the LiveKit examples repository. 2. Modify your agent code to identify SIP participants: ◦ Import the
rtc
module in your
agent.py
file. ◦ Update the
entrypoint
function to handle SIP connections. 1. Create both inbound and outbound trunks in LiveKit to accept and make phone calls using your AI voice agent. Sources: Building an Automated IVR Menu Caller | LiveKit Docs | SIP participant | LiveKit Docs | Create and configure SIP trunk | LiveKit Docs
Unfortunately, I couldn't find specific information about deploying a voice agent directly on LiveKit Cloud or its purpose. LiveKit Cloud is generally used to manage and scale your LiveKit applications, but for detailed deployment options, you may need to consult the LiveKit documentation or your implementation team.
Unfortunately, I couldn't find specific information on how to connect a LiveKit SIP URI to a websocket. You may need to consult the LiveKit documentation or your development team for guidance on this integration.
Unfortunately, I couldn't find specific information about configuring a URL trigger for SIP in the LiveKit dashboard. You may need to explore the dashboard settings or consult the LiveKit documentation for further details.
c
" Yes—you can implement outbound calls that each connect to a dynamically created room. The overall approach is similar to handling inbound calls with LiveKit, with the main difference being that you create a SIP participant for the outbound call that specifies the room name. LiveKit will automatically create the room when the first participant joins. For example, you can: • Generate a unique room name (if needed, on your backend) and include it in the SIP participant creation payload. • Configure your TwiML app (or TwiML bin) so that the Dial verb sends the call to your LiveKit SIP endpoint (e.g., using a SIP URI like sip:+[TRUNK_NUMBER]@[YOUR_PROJECT].sip.livekit.cloud). • When the call is forwarded to LiveKit, the SIP participant is created with the provided room name, joining that room automatically. • Your agent or application can then join the same room to interact with the caller. " this is what you said earlier somewhere. how to get access to that trunk number here: " what should the dispatch rules be to allow custom sip uri like sip:+[TRUNK_NUMBER]@[YOUR_PROJECT].sip.livekit.cloud?
t
Unfortunately, I couldn't find specific information about the dispatch rules required to allow custom SIP URIs like
sip:+[TRUNK_NUMBER]@[YOUR_PROJECT].sip.livekit.cloud
. You may need to consult the LiveKit documentation or your implementation team for guidance on setting up these rules.
c
do I need an inbound trunk to authenticate with livekit sip?
t
An inbound trunk is required to accept incoming calls in LiveKit SIP. While the sources mention that an inbound trunk can be configured to accept calls and can be limited to specific IP addresses or phone numbers, they do not specifically address whether it is required for authentication with LiveKit SIP. You may need to consult the LiveKit documentation or your SIP provider for further clarification on authentication requirements. Sources: SIP overview | LiveKit Docs | Accepting inbound calls | LiveKit Docs
I'm sorry, but I don't have the information you need at the moment. If you would like a member of the LiveKit team to respond, please ask your question in one of the other channels.
c
how can I use the Livekit sip endpoint? sip:<SIP_ID>.sip.livekit.cloud