SIP Overview

Connect LiveKit to a telephone system using SIP

Introduction

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

Key capabilities 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 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 is deployed as a separate service.

See SIP Quickstart for a guided tutorial.

Concepts

LiveKit SIP is powered by three core concepts. The objects are created via the API and influence how your calls will be handled.

SIP Trunks

SIP Trunks are used to authenticated SIP traffic in and out. A SIP Trunk can be configured to only accept traffic from certain IPs or phone numbers. A SIP Trunk is also where outbound call configuration is configured.

SIP Dispatch Rules

SIP Dispatch Rules control how inbound calls are handled. A SIP Dispatch rule controls what room a call is placed into. Calls can be placed into rooms directly or be prompted for pins. SIP Dispatch Rules logic can be influenced by metadata of the call like what number is calling and who was called.

SIP Participants

SIP Participants are a representation of an active SIP Session. For each inbound call a SIP Participant will be created. To start an outbound call you create a SIP Participant. You can then disconnect or send DTMF on these SIP Participants at any time.

Service architecture

SIP Service

Workflow

Inbound SIP

Steps require to accept an inbound SIP call.

  1. You purchase a SIP trunk from a SIP provider like Twilio or Telnyx
  2. You configure the SIP Trunk 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
  3. You create a SIP Trunk via API (or CLI) to accept your inbound SIP Traffic
  4. You create a SIP Dispatch Rule via the LiveKit CLI to route your inbound SIP traffic to a LiveKit Room
  5. Your users calls the phone number registered via your SIP Provider
  6. Your SIP provider makes the connection to the LiveKit SIP instance
  7. The SIP service authenticates the inbound call from the SIP Trunk you created
  8. The SIP service routes the inbound call according to the SIP Dispatch Rule you created
  9. The SIP Service joins the LiveKit room and makes the phone call available as a LiveKit room participant

Outbound SIP

Steps require to make an inbound SIP call.

  1. You purchase a SIP trunk from a SIP provider like Twilio or Telnyx
  2. You configure the SIP Trunk 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
  3. You create a SIP Trunk via API (or CLI). The phone number associated to the Trunk will be used to dial out to the user.
  4. You create a SIP Participant with the user's phone number via API (or CLI) to make your outbound call
  5. The SIP Service sends a SIP Invite to your SIP Provider
  6. If the SIP provider accepts the SIP service joins the LiveKit room and makes the phone call available as a LiveKit room participant

API

For further documentation and examples see SIP Trunk and SIP Dispatch Rule. This pages will show you how to create these resources and the options available.