plugLivekit

Connect your LiveKit real-time voice agents to KrosAI phone numbers for emerging market coverage.

Overview

LiveKit is an open-source platform for building real-time audio/video applications. With KrosAI, you can bridge LiveKit agents to phone calls in Africa and the Middle East.

Prerequisites

  • KrosAI account with verified KYC

  • LiveKit Cloud account or self-hosted instance

  • A LiveKit agent configured and running

  • SIP Trunk configured in LiveKit

  • At least one KrosAI phone number

Setup Steps

1

Configure LiveKit SIP Trunk

  • Navigate to SIPTrunks

  • Create or select a SIP Trunk

  • Copy:

    • Agent ID (your agent's name/ID)

    • SIP Trunk ID

    • SIP URI (e.g., sip:xxxxx.sip.livekit.cloud)

2

Connect LiveKit in KrosAI

  • Go to Settings → Integrations in your KrosAI Dashboard

  • Click Connect next to LiveKit

  • Enter:

    • API Key (from LiveKit)

    • API Secret

    • Server URL (WebSocket URL, e.g., wss://your-app.livekit.cloud)

  • Click Save & Test

3

Create a LiveKit Endpoint

Create Endpoint (curl)
curl -X POST "https://api.krosai.com/v1/endpoints" \
  -H "x-api-key: kros_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "LiveKit Voice Agent",
    "type": "agent",
    "url": "sip:xxxxx.sip.livekit.cloud",
    "provider_config": {
      "provider": "livekit",
      "livekit_agent_name": "my-voice-agent",
      "livekit_sip_trunk_id": "trunk_abc123",
      "livekit_sip_uri": "sip:xxxxx.sip.livekit.cloud"
    }
  }'
4

Attach to Phone Number

Attach Endpoint to Phone Number (curl)
curl -X PATCH "https://api.krosai.com/v1/phone-numbers/pn_abc123" \
  -H "x-api-key: kros_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "endpoint_id": "ep_livekit_xyz"
  }'

Configuration Options

Provider Config Fields

Field
Required
Description

livekit_agent_name

Yes

Your LiveKit agent ID for dispatch

livekit_sip_trunk_id

Yes

Your LiveKit SIP Trunk ID

livekit_sip_uri

Yes

Full SIP URI from LiveKit

Global Settings (Integration Level)

Field
Required
Description

api_key

Yes

LiveKit API Key

api_secret

Yes

LiveKit API Secret

server_url

Yes

WebSocket URL (wss://...)

Agent Verification

chevron-rightImportant: Agent verification behaviorhashtag

LiveKit agents are ephemeral worker processes. They cannot be verified via API before a call. Verification happens at call-time dispatch.

Ensure your agent is:

  • Running and connected to LiveKit

  • Registered with the correct Agent ID

  • Ready to handle SIP calls

Outbound Calls

Webhooks

Receive call events:

Troubleshooting

chevron-rightCall Not Connectinghashtag
  • Verify SIP Trunk is configured in LiveKit

  • Check the SIP URI is correct

  • Ensure your agent is running

  • Review LiveKit logs for SIP errors

chevron-rightAgent Not Dispatchinghashtag
  • Confirm agent is registered with correct ID

  • Check LiveKit worker is connected

  • Verify room permissions in LiveKit

chevron-rightAudio Issueshashtag
  • Check codec compatibility (Opus preferred)

  • Verify SIP trunk audio settings

  • Review network latency

LiveKit Agent Example

Last updated