Skip to main content

SIP overview

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

Introduction

LiveKit SIP bridges the gap between traditional telephony and modern digital communication. It enables seamless interaction between traditional phone systems and LiveKit rooms. You can use LiveKit SIP to accept calls and make calls. When you add LiveKit Agents, you can use an AI voice agent to handle your inbound and outbound calls.

Concepts

LiveKit SIP extends the core primitives—participant, room, and track—to include two additional concepts specific to SIP: trunks and dispatch rules. These concepts are represented by objects created through the API and control how calls are handled.

SIP participant

Each caller, callee, and AI voice agent that participates in a call is a LiveKit participant. A SIP participant is like any other participant and can be managed using the participant APIs. They have the same attributes and metadata as any other participant, and have additional SIP specific attributes.

For inbound calls, a SIP participant is automatically created for each caller. To make an outbound call, you create a SIP participant using the CreateSIPParticipant API to make the call.

Trunks

LiveKit SIP trunks bridge your SIP provider and LiveKit. To use LiveKit, you must configure a SIP trunk with your telephony provider. The setup depends on your use case—whether you're handling incoming calls, making outgoing calls, or both.

  • Inbound trunks handle incoming calls and can be restricted to specific IP addresses or phone numbers.
  • Outbound trunks are used to place outgoing calls.

Trunks can be region restricted to meet local telephony regulations.

Note

The same SIP provider trunk can be associated with both an inbound and an outbound trunk in LiveKit. You only need to create an inbound or outbound trunk once.

Dispatch rules

Dispatch Rules are associated with a specific trunk and control how inbound calls are dispatched to LiveKit rooms. All callers can be placed in the same room or different rooms based on the dispatch rules. Multiple dispatch rules can be associated with the same trunk as long as each rule has a different pin.

Dispatch rules can also be used to add custom participant attributes to SIP participants.

Service architecture

LiveKit SIP relies on the following services:

  • SIP trunking provider for your phone number. LiveKit SIP supports most SIP providers out of the box.
  • LiveKit server (part of LiveKit Cloud) for API requests, managing and verifying SIP trunks and dispatch rules, and creating participants and rooms for calls.
  • LiveKit SIP (part of LiveKit Cloud) to respond to SIP requests, mediate trunk authentication, and match dispatch rules.

If you use LiveKit Cloud, LiveKit SIP is ready to use with your project without any additional configuration. If you're self hosting LiveKit, the SIP service needs to be deployed separately. To learn more about self hosting, see SIP server.

LiveKit SIP service architecture

Using LiveKit SIP

The LiveKit SIP SDK is available in multiple languages. To learn more, see SIP API.

LiveKit SIP has been tested with the following SIP providers:

Note

LiveKit SIP is designed to work with all SIP providers. However, compatibility testing is limited to the providers below.

SIP features

LiveKit SIP supports the following functionality.

FeatureDescription
DTMFYou can configure DTMF when making outbound calls by adding them to the CreateSIPParticipant request. To learn more, see Making a call with extension codes (DTMF).
SIP REFERYou can transfer calls using the TransferSIPParticipant API. Calls can be transferred to any valid telephone number or SIP URI. To learn more, see Cold transfer.
SIP headersYou can map custom X-* SIP headers to participant attributes. For example, custom headers can be used to route calls to different workflows. To learn more, see Custom attributes.
Noise cancellationYou can enable noise cancellation for callers and callees using Krisp. To learn more, see Noise cancellation for calls.
Region pinningYou can restrict incoming and outgoing calls to a specific region to comply with local telephony regulations. To learn more, see Region pinning for SIP.
Secure trunkingYou can enable encryption for signaling traffic and media using TLS and SRTP for SIP calls. To learn more, see Secure trunking.

Supported protocols

LiveKit SIP supports the following protocols:

ProtocolDescription
TCP, UDP, TLSTransport protocols for SIP signaling.
RTP, SRTPNetwork protocols for delivering audio and video media.

Noise cancellation for calls

Krisp noise cancellation uses AI models to identify and remove background noise in realtime. This improves the quality of calls that occur in noisy environments. For LiveKit SIP applications that use agents, noise cancellation improves the quality and clarity of user speech for turn detection, transcriptions, and recordings.

For incoming calls, see the inbound trunks documentation for the krisp_enabled attribute. For outgoing calls, see the CreateSIPParticipant documentation for the krisp_enabled attribute used during outbound call creation.

Next steps

See the following guides to get started with LiveKit SIP: