Make outbound calls

Create a LiveKit SIP participant to make outbound calls.

Creating a SIP participant

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

Outbound calling requires at least one Outbound Trunk.

  1. Create a sip-participant.json file with the following participant details:

    {
    "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 Caller"
    }
  2. Create the SIP Participant using the CLI. After you run this command, the participant makes a call to the sip_call_to number configured in your outbound trunk. You can monitor the call status using the SIP participant attributes. When the call is picked up by the callee, the sip.callStatus attribute is active.

    lk sip participant create sip-participant.json

Once the user picks up, they will be connected to 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#ww456",
"room_name": "my-sip-room",
"participant_identity": "sip-test",
"participant_name": "Test Caller"
}
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 dial tone while the call is dialing

SIP participants emit no audio by default while the call connects. This can be changed by setting play_dialtone 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 Caller",
"play_dialtone": true
}

If play_dialtone is enabled, the SIP Participant plays a dial tone to the room until the phone is picked up.