SIP Overview

Connect LiveKit to a telephone system using SIP (Session Initiation Protocol).

Introduction

LiveKit SIP bridges the gap between traditional telephony and modern digital communication. It enables seamless interaction between traditional phone systems and LiveKit rooms.

Key features include:

  • Dial-In: Accept incoming calls from phone numbers directly into a LiveKit room.
  • Dial-Out via API: Initiate calls to phone numbers using an API.
  • DTMF Tone Transmission: Send and receive Dual-tone multi-frequency (DTMF) signals during calls.

In order to use LiveKit SIP, you need to provide a SIP trunk provider. We've tested with Twilio and Telnyx.

For LiveKit Cloud customers, SIP is ready to use with your project without additional configuration. When self-hosting LiveKit, SIP service needs to be deployed separately.

See SIP Quickstart for a guided tutorial.

Concepts

LiveKit SIP is built around three core concepts. These concepts are represented by objects created through the API and affect how your calls are handled.

Trunks

SIP Trunks are used to authenticated SIP traffic in and out. An Inbound Trunk can be configured to accept traffic from certain IPs or phone numbers. An Outbound Trunk is where outbound call configuration is set.

Dispatch Rules

Dispatch Rules control how inbound calls are handled and determine which room a call is placed into. Calls can be placed into rooms directly or be prompted for PINs. The logic of SIP Dispatch Rules can be influenced by call attributes, such as the calling number and the called number.

SIP Participants

A SIP Participant represents an active SIP session. For each inbound call, a SIP Participant is created automatically. To start an outbound call, use the CreateSIPParticipant to create a SIP Participant. You can disconnect or send DTMF to SIP Participants at any time.

Service architecture

SIP Service

Workflow

Inbound SIP

Steps required to accept an inbound SIP call.

  1. SIP Trunk Provider setup
    1. Purchase a phone number from a SIP Provider like Twilio or Telnyx
    2. Configure the SIP Trunk on the Provider to send SIP traffic to your LiveKit SIP Instance
      • The URL for LiveKit Cloud SIP is available in the console. The URL is different for every project
  2. LiveKit SIP configuration
    1. Create an Inbound Trunk via API (or CLI) to accept your inbound SIP Traffic. The phone number(s) associated with the Trunk will accept calls from the user.
    2. Create a Dispatch Rule via the LiveKit CLI to route your inbound SIP traffic to a LiveKit Room
  3. Accepting a call
    1. Users calls the phone number registered via your SIP Trunk Provider
    2. SIP Trunk Provider makes the connection to the LiveKit SIP instance
    3. LiveKit SIP authenticates the inbound call from the SIP Inbound Trunk you created
    4. LiveKit SIP routes the inbound call according to the SIP Dispatch Rule you created
    5. LiveKit SIP joins the LiveKit room and makes the phone call available as a LiveKit room participant

Outbound SIP

Steps required to make an outbound SIP call.

  1. SIP Trunk Provider setup
    1. Purchase a phone number from a SIP Provider like Twilio or Telnyx
    2. You configure the SIP Trunk on the Provider to send SIP traffic to accept SIP traffic from the LiveKit SIP service
      • The URL for LiveKit Cloud SIP is available in the console. The URL is different for every project
  2. LiveKit SIP configuration
    1. Create an Outbound Trunk via API (or CLI). The phone number(s) associated with the Trunk will be used to dial out to the user.
  3. Making a call
    1. Create a SIP Participant with the user's phone number via API (or CLI) to make your outbound call
    2. LiveKit SIP sends an INVITE to your SIP Provider
    3. If the SIP Provider accepts, the LiveKit SIP joins the LiveKit room and makes the phone call available as a LiveKit room participant

What's next

Give it a try yourself with our SIP Quickstart guide.