millions-gold-86808
03/01/2026, 7:19 AMtall-airline-16756
03/01/2026, 7:19 AMtall-airline-16756
03/01/2026, 7:20 AMlk cloud auth and have your env variables — great, that means your CLI is authenticated to a project. Below I’ll cover what to do next.
Acknowledging what you asked: this covers whether you need a LiveKit Cloud project, how to create API keys / set env vars, how to write/run a worker (agent) that connects to LiveKit Cloud, and how to dispatch jobs to that worker.
1) Create a LiveKit Cloud project (yes — required)
• Go to https://cloud.livekit.io/ and create a project (name it something like my-agent-project).
• From the project dashboard you’ll get the project URL (e.g., wss://<your-project>.livekit.cloud) and you can generate API keys.
2) Ensure API keys / env variables are set
• From the project dashboard generate an API key + secret.
• Put these in your environment or .env:
◦ LIVEKIT_API_KEY=your_api_key
◦ LIVEKIT_API_SECRET=your_api_secret
◦ LIVEKIT_URL=wss://your-project-subdomain.livekit.cloud
• You already ran lk cloud auth — that ties your CLI to the project so CLI commands use the right project.
3) Create an agent (worker) that accepts jobs
• An agent is the worker process that registers with LiveKit Cloud and accepts dispatched jobs.
• Minimal flow for an agent:
◦ Register with LiveKit Cloud as an available agent.
◦ Wait for job dispatches.
◦ Accept a job and run your job handler (e.g., join a room, process audio, run STT/LLM, TTS, etc.).
Example (conceptual Python skeleton):
# agent.py (conceptual)
from livekit.agents import JobContext, JobRequest, WorkerOptions
from livekit.plugins import cli
async def job_handler(job: JobContext):
print(f"Job received for room: {job.room.name}")
# your processing logic here
async def request_handler(req: JobRequest):
await req.accept(job_handler)
if __name__ == "__main__":
cli.run_app(WorkerOptions(request_handler=request_handler))
• This agent registers and waits for dispatches. When a job is dispatched it will call job_handler.
4) Run the worker locally (dev/test)
• Start the worker in dev mode so it connects to LiveKit Cloud and becomes available:
◦ python agent.py dev
• You should see logs indicating the worker registered and is ready.
5) Dispatch a job to your worker
• Two common ways to dispatch:
◦ Using the CLI:
▪︎ lk dispatch create --room my-test-room --agent-name my-worker
▪︎ This creates the room my-test-room and requests an agent named my-worker to handle it.
▪︎ If your agent has no explicit name (uses the default pool), omit --agent-name and it will dispatch to the default pool.
◦ Programmatically via API (conceptual):
from livekit.api import LiveKitAPI
api = LiveKitAPI()
api.agent_dispatch.create_dispatch(room="my-test-room", agent_name="my-worker")
• Matching agent_name ensures the named agent receives the job. If you use a pool, dispatch without name.
6) (Optional) Use named agents for control
• Give your agent an explicit name to target it reliably. When an agent is named it won’t auto-pickup pool dispatches unless you dispatch to that name.
• Example: set agent_name="my-worker" in your agent server config.
7) Deploy a persistent worker (production)
• For a production-ready always-on worker you can deploy the agent instead of running it locally.
• You can create a deployed agent (so it runs in the cloud) using the CLI (e.g., lk agent create --agent-name my-worker) or follow the LiveKit deployment docs to run your agent in your infra.
Quick checklist summary
• Create LiveKit Cloud project ✅
• Generate API key/secret and set LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET ✅
• Implement agent code (job handler + request handler) ✅
• Run agent locally to test (python agent.py dev) ✅
• Dispatch jobs via CLI or API (lk dispatch create ...) ✅
• Optionally deploy agent for production ✅
If you want, I can:
• Provide a complete runnable example (full agent.py) in the language you use (Node/Python/Go).
• Show the exact lk CLI commands/flags for your setup.
• Help you choose between named agents vs. a shared agent pool based on your use case.
Which would you like next: a full runnable example in Python or Node, or the exact CLI commands you should run now?
Sources: Best practices for managing webhook event streams | LiveKit | Agent dispatch | LiveKit Documentation | Job lifecycle | LiveKit Documentationmillions-gold-86808
03/01/2026, 8:08 AMtall-airline-16756
03/01/2026, 8:09 AMmillions-gold-86808
03/01/2026, 12:01 PMtall-airline-16756
03/01/2026, 12:01 PMsip_trunk_id (this is your outbound trunk ID).
2. List trunks:
lk sip outbound list
Server SDK (conceptual Python example):
1. Use the LiveKit API client to create the trunk:
outbound_trunk = await lk_api.sip.create_sip_outbound_trunk(
api.CreateSIPOutboundTrunkRequest(
trunk=api.SIPOutboundTrunkInfo(
name="My Outbound Trunk",
host="<http://sip.provider.com|sip.provider.com>",
username="your_sip_username",
password="your_sip_password"
)
)
)
print(outbound_trunk.sip_trunk_id)
1. Save the returned sip_trunk_id for use in call requests.
Step 2 — Use the outbound trunk ID to make outbound calls When you want to place an outbound call from LiveKit to a PSTN number, include the sip_trunk_id in the SIP participant creation request.
Conceptual example (server-side):
await ctx.api.sip.create_sip_participant(
api.CreateSIPParticipantRequest(
room_name=ctx.room.name,
sip_trunk_id="ST_xxxx", # your outbound trunk ID
sip_call_to="+1234567890",
participant_identity="caller",
wait_until_answered=True
)
)
The sip_trunk_id tells LiveKit which SIP trunk/provider to route the outbound call through.
Step 3 — Verify provider capabilities and settings
• Make sure your SIP provider allows outbound calls and supports any features you need (caller ID passthrough, specific codecs, auth methods).
• If you need to preserve caller ID during transfers or other advanced behaviors, confirm the provider and LiveKit settings support that.
Tips and best practices
• Store the sip_trunk_id in an environment variable (e.g., SIP_OUTBOUND_TRUNK_ID) for reuse.
• Use a named trunk for clearer routing and easier debugging.
• Test calls in a staging project/room before production.
If you’d like, I can:
• Provide a full runnable example for Python or Node that creates a trunk and initiates an outbound call, or
• Give the exact CLI command set you should run now, tailored to your SIP provider details.
Which would you prefer, and do you have your SIP provider details ready (host, username, password)?
Sources: Agents telephony integration | LiveKit Documentation | Outbound Calling Script | LiveKit Documentation | examples/voice_agents | livekit/livekit_composite | DeepWiki | Preserving Caller ID During SIP Transfers in LiveKit Agentsmillions-gold-86808
03/01/2026, 12:15 PMPS C:\Users\Ayush> lk sip outbound create --name "voice_agent_ayush_outbound_trunk" \ --username "voice_agent_ayush" \ --password "****" \ --host "<http://5400ad87.sip.vobiz.ai|5400ad87.sip.vobiz.ai>"
Incorrect Usage: flag provided but not defined: -username
flag provided but not defined: -username
PS C:\Users\Ayush>tall-airline-16756
03/01/2026, 12:15 PM--username, but the LiveKit CLI expects --sip-username and --sip-password.
Two quick fixes:
1) Single-line PowerShell command (recommended for Windows):
lk sip outbound create --name "voice_agent_ayush_outbound_trunk" --sip-username "voice_agent_ayush" --sip-password "****" --host "<http://5400ad87.sip.vobiz.ai|5400ad87.sip.vobiz.ai>"
2) If you want a multi-line command in PowerShell, use the backtick (`) for continuation (not a backslash):
lk sip outbound create `
--name "voice_agent_ayush_outbound_trunk" `
--sip-username "voice_agent_ayush" `
--sip-password "****" `
--host "<http://5400ad87.sip.vobiz.ai|5400ad87.sip.vobiz.ai>"
Additional tips:
• Verify your CLI version with lk version if flags still aren't recognized — older/newer CLI builds can differ.
• You can also create the trunk programmatically via the server SDK (Python/Node/Go) using the create_sip_outbound_trunk API if you prefer.
If you run the corrected command and still get an error, paste the full output here and I’ll help troubleshoot further (CLI version, OS, or exact error).
Sources: Python SDKs | livekit/livekit_composite | DeepWiki | Server-side | livekit/livekit_composite | DeepWikimillions-gold-86808
03/04/2026, 1:48 PMtall-airline-16756
03/04/2026, 1:48 PM488: 32208 SIP trunk or domain is required to use secure media (SRTP) means LiveKit attempted an INVITE with secure media (SRTP), but the outbound trunk you used is not marked to allow SRTP.
• TLS (signaling) and SRTP (media) are separate. Having TLS alone is not enough if your call expects encrypted media.
• Common causes: your trunk was created without the secure flag, or your agent requested SRTP (e.g., krisp_enabled=True) while the trunk doesn’t support SRTP.
Immediate steps to fix
1. Verify current trunk settings
• Run:
lk sip outbound list
• Check that the trunk entry for your trunk shows "secure": true and "use_tls": true. If secure is false, proceed to step 2.
1. Recreate or update the trunk to enable SRTP
• If CLI supports update you can use it; otherwise delete and recreate with --secure and --use-tls.
• For PowerShell (single line):
lk sip outbound create --name "voice_agent_ayush_outbound_trunk" --sip-username "voice_agent_ayush" --sip-password "****" --host "<http://5400ad87.sip.vobiz.ai|5400ad87.sip.vobiz.ai>" --use-tls --secure
• Or multi-line with PowerShell backticks:
lk sip outbound create `
--name "voice_agent_ayush_outbound_trunk" `
--sip-username "voice_agent_ayush" `
--sip-password "****" `
--host "<http://5400ad87.sip.vobiz.ai|5400ad87.sip.vobiz.ai>" `
--use-tls `
--secure
1. Ensure your agent call request matches trunk capabilities
• If you are enabling Krisp or requested secure media in your create_sip_participant call, keep it enabled only if trunk has secure: true.
• Example: if the trunk is secure, krisp_enabled=True is OK. If not, set krisp_enabled=False or remove it.
Example create_sip_participant usage (conceptual):
await ctx.api.sip.create_sip_participant(
api.CreateSIPParticipantRequest(
room_name=ctx.room.name,
sip_trunk_id="ST_xxxxxxx",
sip_call_to="+917020480908",
participant_identity="caller",
krisp_enabled=True # only if trunk has --secure
)
)
1. Test again and share results
• After recreating the trunk with --secure, place a test outbound call.
• If it still fails, paste:
◦ Output of lk sip outbound list
◦ The exact create_sip_participant request you’re making (redact secrets)
◦ Full INVITE/SDP logs if available
Quick checklist
• [ ] Trunk has secure: true (SRTP enabled)
• [ ] Trunk has use_tls: true if you want TLS signaling
• [ ] Agent call flags (krisp_enabled) match trunk SRTP capability
If you want, I can:
• Walk you through the exact commands to delete + recreate the trunk safely
• Inspect the lk sip outbound list output you paste and point out the exact field to change
Which would you like me to do next? Paste the output of lk sip outbound list and your create_sip_participant call (with secrets removed) and I’ll pinpoint the remaining changes.millions-gold-86808
03/04/2026, 2:11 PMtall-airline-16756
03/04/2026, 2:12 PMoutbound_trunk.twilio.json, run this LiveKit CLI command to create the outbound trunk from that file:
• PowerShell / CMD (single line):
lk sip outbound create outbound_trunk.twilio.json
Notes and quick checks
• Ensure your JSON includes "secure": true if you need SRTP (secure media). Example minimal structure:
{
"trunk": {
"name": "voice_agent_ayush_outbound_trunk",
"host": "<http://5400ad87.sip.vobiz.ai|5400ad87.sip.vobiz.ai>",
"sip_username": "voice_agent_ayush",
"sip_password": "your_password",
"use_tls": true,
"secure": true
}
}
• After creation, verify the trunk and confirm secure: true with:
lk sip outbound list
• Use the returned sip_trunk_id in your create_sip_participant calls. If your agent uses krisp_enabled=True or otherwise requests secure media, secure must be true on the trunk to avoid the SRTP error you saw.
If the command returns an error, paste the CLI output and the top-level keys of your JSON (redact secrets) and I’ll help troubleshoot.
Sources: Agents telephony integration | LiveKit Documentation | Making calls overview | LiveKit Documentation | Python SDKs | livekit/livekit_composite | DeepWiki | sip | livekit/livekit_composite | DeepWiki | Building an Automated IVR Menu Caller | LiveKit Documentationmillions-gold-86808
03/04/2026, 2:15 PMtall-airline-16756
03/04/2026, 2:16 PMuse_tls) and (2) the CLI complained the file isn’t valid JSON. Let’s resolve both so you can create the trunk and avoid the SRTP error.
1) Fix the JSON fields
• Replace the invalid field use_tls with tls_enabled.
• Use the correct property names LiveKit expects. A minimal valid structure looks like this:
{
"trunk": {
"name": "voice_agent_ayush_outbound_trunk",
"host": "<http://5400ad87.sip.vobiz.ai|5400ad87.sip.vobiz.ai>",
"sip_username": "voice_agent_ayush",
"sip_password": "your_password",
"tls_enabled": true,
"secure": true
}
}
Notes:
• `tls_enabled`: enables TLS for signaling (use this instead of use_tls).
• `secure`: enables SRTP (secure media). Set this true if your agent/flow requests secure media (e.g., krisp_enabled=True).
• Make sure keys are exactly quoted and there are no trailing commas.
2) Validate JSON file locally
• Use a quick JSON validator or run a PowerShell command to check formatting:
Get-Content .\outbound-trunk.twilio.json | ConvertFrom-Json
If that command throws an error, fix the JSON until it parses.
3) Create the trunk from the file
• Once the JSON is valid, run:
lk sip outbound create outbound-trunk.twilio.json
• Then verify the trunk was created and that tls_enabled and secure are true:
lk sip outbound list
4) If you still see errors
• Paste the top-level keys of your JSON file here (redact passwords). I’ll check them for invalid fields.
• If lk sip outbound create fails again, paste the full CLI error output and the output of lk sip outbound list.
Optional quick test JSON you can copy/paste (replace credentials):
{
"trunk": {
"name": "Test Trunk",
"host": "<http://5400ad87.sip.vobiz.ai|5400ad87.sip.vobiz.ai>",
"sip_username": "voice_agent_ayush",
"sip_password": "REPLACE_ME",
"tls_enabled": true,
"secure": true
}
}
If you want, paste your current JSON file contents (with secrets removed) and I’ll correct it for you.
Sources: Agents telephony integration | LiveKit Documentation | Making calls overview | LiveKit Documentation | Support data sovereignty in India | LiveKit | Understanding TLS in SIP | LiveKitmillions-gold-86808
03/04/2026, 2:19 PMSIP error for
call_id=2: twirp
error unknown: INVITE
failed: sip status:
488: 32208 SIP trunk
or domain is required
to use secure media
(SRTP). (SIP 488
32208 SIP trunk or
domain is required to
use secure media
(SRTP).)tall-airline-16756
03/04/2026, 2:20 PMkrisp_enabled=True).
What I need from you (quick checks)
1. Run and paste (redact secrets):
◦ lk sip outbound list
This shows whether the trunk’s fields include tls_enabled: true and secure: true.
1. Paste the top-level keys of your trunk JSON (redact passwords). Example keys I need to see:
◦ host / sip_server / sip_username / sip_password / tls_enabled / secure / sip_uri
(just the keys/values, not the secrets)
What to do now (exact steps)
1) Verify trunk fields
• Ensure your trunk shows both:
◦ tls_enabled: true (signaling over TLS)
◦ secure: true (SRTP / secure media)
• Command to list trunks:
lk sip outbound list
2) If trunk is missing secure: true, delete and recreate it with those flags in JSON or CLI.
CLI create (single line PowerShell)
lk sip outbound create --name "voice_agent_ayush_outbound_trunk" --sip-username "voice_agent_ayush" --sip-password "****" --host "<http://5400ad87.sip.vobiz.ai|5400ad87.sip.vobiz.ai>" --tls-enabled --secure
Notes:
• Some CLI versions accept --tls-enabled as a boolean flag; if your CLI expects a file, use JSON with exact fields (see below).
• If your CLI does not accept `--tls-enabled`/`--secure` flags inline, use a JSON file.
JSON format (use this exact shape; replace secrets)
{
"trunk": {
"name": "voice_agent_ayush_outbound_trunk",
"host": "<http://5400ad87.sip.vobiz.ai|5400ad87.sip.vobiz.ai>",
"sip_username": "voice_agent_ayush",
"sip_password": "REDACTED",
"tls_enabled": true,
"secure": true
}
}
Then create from file:
lk sip outbound create outbound-trunk.twilio.json
3) Ensure your call request matches trunk capabilities
• If your create_sip_participant call sets krisp_enabled=True or otherwise requests encrypted media, keep secure: true on the trunk.
• If you cannot enable SRTP on the trunk (provider limitation), set krisp_enabled=False in the call request so media is not forced to SRTP.
Example call (only if trunk is secure):
await ctx.api.sip.create_sip_participant(
api.CreateSIPParticipantRequest(
room_name=ctx.room.name,
sip_trunk_id="ST_xxxxx",
sip_call_to="+917020480908",
participant_identity="caller",
krisp_enabled=True
)
)
If trunk is NOT secure, set krisp_enabled=False.
4) Confirm your SIP provider supports SRTP/TLS
• The provider (Vobiz) must accept SRTP or sRTP-capable endpoints. If the provider does not support SRTP, LiveKit cannot negotiate secure media with it — in that case you must either:
◦ Use a provider that supports SRTP, or
◦ Make the call without SRTP (set secure:false and krisp_enabled:false) if acceptable.
If it still fails, please provide:
• Output of lk sip outbound list
• The top-level contents of your trunk JSON (with secrets redacted)
• The exact create_sip_participant call you make (redact secrets)
I’ll inspect those and tell you exactly what to change next. If you prefer, paste lk sip outbound list now and I’ll point to the exact field to update.millions-gold-86808
03/04/2026, 2:25 PMtall-airline-16756
03/04/2026, 2:25 PMkrisp_enabled=True).
• Your lk sip outbound list not showing `tls`/`secure` fields suggests either the trunk was created without those fields or your CLI/version doesn’t surface them.
What I need from you to diagnose quickly
1. Output of:
◦ lk version
◦ lk sip outbound list
(Redact secrets; paste the outputs here.)
1. The top-level keys of your trunk JSON file (outbound-trunk.twilio.json). Paste it here with passwords removed. Example I need to see:
◦ host/sip_server or sip_uri
◦ sip_username or username
◦ sip_password (redact value)
◦ Any boolean flags you used (tls_enabled, secure, use_tls, etc.)
1. The exact create_sip_participant request you call from your agent (redact secrets).
Immediate checks and actions to try now 1) Check CLI version
• Run: lk version
• If your CLI is out-of-date, flag names and JSON schema can differ. If it’s old, update the CLI and try listing trunks again.
2) Confirm trunk listing
• Run: lk sip outbound list
• If that output still lacks tls_enabled / secure, proceed to recreate the trunk using a JSON file with the exact recommended fields below.
3) Recreate trunk from a validated JSON (recommended)
• Use this exact JSON shape (replace values, redact password here before pasting):
{
"trunk": {
"name": "voice_agent_ayush_outbound_trunk",
"host": "<http://5400ad87.sip.vobiz.ai|5400ad87.sip.vobiz.ai>",
"sip_username": "voice_agent_ayush",
"sip_password": "REDACTED",
"tls_enabled": true,
"secure": true
}
}
• Save as outbound-trunk.twilio.json (ensure valid JSON).
• Create trunk:
lk sip outbound create outbound-trunk.twilio.json
• Then immediately run:
lk sip outbound list and paste the result here.
Notes about flags/field names
• Use tls_enabled (not use_tls) to enable signaling over TLS.
• Use secure: true to mark the trunk as SRTP-capable (secure media).
• If your CLI doesn’t accept these or still hides them, the CLI version likely differs from the docs — tell me lk version and I’ll adapt.
4) Align your agent call request
• If the trunk is secure: true, then krisp_enabled=True is OK.
• If the trunk cannot be made secure (provider limitation), set krisp_enabled=False or remove that flag so LiveKit won’t request SRTP.
If the provider cannot support SRTP
• You must either:
◦ Use a SIP provider that supports SRTP/TLS, or
◦ Make the call without secure media (set secure:false on trunk and krisp_enabled=false in call) — accept the tradeoff.
If you’d like, I can:
• Inspect your JSON and the lk sip outbound list output and correct fields for you.
• Give the exact removal + recreate commands to ensure a clean trunk.
Next step Please paste:
• Output of lk version
• Output of lk sip outbound list
• Your outbound-trunk JSON top-level (secrets removed)
• Your create_sip_participant call (redact keys)
I’ll point out exactly which field to change or give the exact commands to delete & recreate the trunk so this SRTP error stops.millions-gold-86808
03/04/2026, 2:27 PMtall-airline-16756
03/04/2026, 2:27 PMmillions-gold-86808
03/04/2026, 2:49 PMmillions-gold-86808
03/04/2026, 4:32 PMmillions-gold-86808
03/04/2026, 4:33 PM