Send outbound calls from LiveKit
This guide will help you set up outbound SIP calls using LiveKit and SignalWire. Follow these steps to configure your SIP domain, SWML script, and LiveKit settings efficiently.
Prerequisites
Before getting started, you’ll need the following:
Setup
Create a SWML Script
To create a SWML script, navigate to the Resources tab in your SignalWire Dashboard, click + Add New, and select SWML Script.
- Log in to your SignalWire Dashboard and navigate to the Resources tab on the left-hand sidebar.
- Click Add, select Script, and then choose SWML Script.
- Paste the following SWML code snippet into the editor:
Be sure to replace "+1XXXXXXXXXX" with a phone number from your SignalWire account.
Add SIP address
- Save the SWML script and navigate to the Addresses & Phone Numbers section within the script.
- Click Add and select SIP Address to add your SIP domain application.
- Configure this SIP address based on your requirements, and save it.
- After configuration, note down your unique SIP domain.
Example SIP domain: test-space-live-kit.dapp.signalwire.com.
Now, let’s configure LiveKit for outbound SIP calling. Follow along with LiveKit’s documentation for outbound SIP trunk setup.
Create an outbound trunk
Use the following JSON configuration for creating an outbound SIP trunk, ensuring you update the given fields:
Update placeholders in the above JSON with the following:
Submit this request and save the generated Trunk ID.
If you forget to save the Trunk ID, use LiveKit’s CLI tool to retrieve the trunk configurations.
Create SIP participant
To initiate outbound calls through your configured trunk, you’ll need to create a SIP participant in LiveKit. This process establishes the connection and manages the call flow. For detailed instructions on creating SIP participants and handling outbound calls, refer to LiveKit’s comprehensive guide to Creating a SIP Participant.
If you’re working with LiveKit AI agents for outbound calls, please see the LiveKit AI Agent Telephony Guide.
You’re now ready to make your first outbound SIP call using LiveKit and SignalWire. If you encounter any issues, verify the configurations for both SignalWire and LiveKit.
Next steps
Record calls
Record calls by creating a SWML script with recording logic and slightly modifying your outbound SWML script.
These recordings can be accessed in the Dashboard in Storage > Recordings, or using the Recordings List API endpoint.
View logs
Access call logs in the Logs tab of your SignalWire Dashboard.