SIP Participant

How to make outbound calls by creating LiveKit SIP Participant.

tip:

Inbound calls are handled by Inbound Trunk and Dispatch Rule. See documentation for these resources for examples how to create them and the options available.

Making outbound call

To make outbound calls with SIP Service, create SIP Participant with CreateSIPParticipant API. It returns an SIPParticipantInfo object that describes the created participant.

Outbound calling requires at least one Outbound Trunk.

Create a file at sipParticipant.json with the following content:

{
"sip_trunk_id": "<your-trunk-id>",
"sip_call_to": "<phone-number-to-dial>",
"room_name": "my-sip-room",
"participant_identity": "sip-test",
"participant_name": "Test Call"
}

Then create the SIP Participant using lk:

lk sip participant create sipParticipant.json

This command will make a call to a specified number using number(s) associated with SIP Outbound Trunk. SIP Participant should immediately appear in room my-sip-room.

Making a call with extension codes (DTMF)

To make outbound calls with fixed extension codes (DTMF tones), set dtmf field in CreateSIPParticipant request:

{
"sip_trunk_id": "<your-trunk-id>",
"sip_call_to": "<phone-number-to-dial>",
"dtmf": "*123#www456",
"room_name": "my-sip-room",
"participant_identity": "sip-test",
"participant_name": "Test Call"
}
tip:

Character w can be used to delay DTMF by 0.5 sec.

This example will dial a specified number and will send the following DTMF tones:

  • *123#
  • Wait 1 sec
  • 456

Playing ringtone while the call is dialing

SIP participants emit no audio by default while the call connects. This can be changed by setting play_ringtone field in CreateSIPParticipant request:

{
"sip_trunk_id": "<your-trunk-id>",
"sip_call_to": "<phone-number-to-dial>",
"room_name": "my-sip-room",
"participant_identity": "sip-test",
"participant_name": "Test Call",
"play_ringtone": true
}

SIP Participant will start playing a dialing tone to the room until the phone is picked up.

Listing and managing SIP Participants

SIP Participants act as regular LiveKit Participants, thus all participant management commands apply to them as well.

SIP Participants could be recognized by Participant.Kind == SIP when listing participants in a LiveKit room.