stale-autumn-96899
10/08/2025, 9:38 AMtall-airline-16756
10/08/2025, 9:38 AMtall-airline-16756
10/08/2025, 9:38 AMstale-autumn-96899
10/08/2025, 9:40 AMtall-airline-16756
10/08/2025, 9:40 AMsip_trunk_id by running this command: lk sip outbound list. This will get you started on the right foot.
2. Use the Python Agent Framework: Next, clone the outbound caller Python example. After that, install the necessary dependencies and set your environment variables, including LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET, and SIP_OUTBOUND_TRUNK_ID. This setup is key for your agent to work smoothly.
3. Modify Agent Code: In your agent.py, you’ll want to use the CreateSIPParticipant API to dial numbers. Here’s a little example to help you visualize:
sip_participant = await lkapi.sip.create_sip_participant(
api.CreateSIPParticipantRequest(
room_name=room_name,
sip_trunk_id=os.getenv("SIP_OUTBOUND_TRUNK_ID"),
sip_call_to=phone_number,
participant_identity="phone_user",
)
)
4. Dispatch the Agent: When you’re ready, use the LiveKit CLI or Python API to dispatch your agent and kick off the call. Here’s an example CLI command for you:
lk dispatch create \
--new-room \
--agent-name outbound-caller \
--metadata '{"phone_number": "+1234567890", "transfer_to": "+9876543210"}'
5. Run the Agent Worker: Finally, start the agent worker so it can listen for dispatches by running: python3 agent.py dev. This will keep everything running smoothly.
If you'd like to dive deeper, the Voice AI Telephony Guide and Making Outbound Calls documentation are fantastic resources. And of course, if you have any questions or need a hand with any step, I’m here to help!
Sources: Agents telephony integration | LiveKit Docs | Using Wavix to accept and make calls | LiveKit Docs | README.md | telephony/survey_caller/make_survey_calls.py | Making outbound calls | LiveKit Docsstale-autumn-96899
10/08/2025, 9:43 AMtall-airline-16756
10/08/2025, 9:43 AMLIVEKIT_URL, LIVEKIT_API_KEY, SIP_OUTBOUND_TRUNK_ID)?
Once I have a clearer picture, I'll do my best to guide you through resolving the problem.stale-autumn-96899
10/08/2025, 9:46 AMtall-airline-16756
10/08/2025, 9:46 AMSIP_OUTBOUND_TRUNK_ID is correctly set and starts with ST_. Also, double-check that your authentication credentials (username/password) are accurate and accepted by your SIP provider.
2. Validate Phone Number Format: It’s important that your phone number is in the E.164 format, which includes the country code (for example, +1 if you’re in the US). Removing any non-digit characters and confirming the number has the right amount of digits can make a big difference.
3. Review Error Metadata: Taking a closer look at the error details like sip_status_code and sip_status can really help pinpoint the issue. For instance, a 403 error might suggest an authentication problem, while a 404 could mean the number isn’t valid.
4. Monitor Call Status: Keep an eye on whether the SIP participant is added to the room and watch events such as sip.callStatus to track how the call is progressing.
5. Confirm Service Availability: Lastly, please verify that the SIP service is up and running, and that you have the necessary administrative permissions for SIP operations.
If you happen to have the specific sip_status_code or error message handy, feel free to share it with me. That way, I can give you more personalized guidance to get this resolved smoothly.
Sources: Making outbound calls | LiveKit Docs | agent.py | packages/sip--make-a-call/src/make-call.ts | Secure trunking | LiveKit Docs | pkg/service/sip.gostale-autumn-96899
10/08/2025, 9:48 AMtall-airline-16756
10/08/2025, 9:49 AMauth_username and your auth token as the auth_password when setting up the trunk. Here’s an example configuration to give you a clear idea:
{
"trunk": {
"name": "twilio-outbound",
"address": "twilio.pstn.example.com",
"numbers": [
"+1234567890"
],
"auth_username": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"auth_password": "your_auth_token"
}
}
2. Initiate the Call: Next, you can use the CreateSIPParticipant API to place the call through your configured trunk. Here’s how it might look:
{
"sip_trunk_id": "trunk_abc123",
"sip_call_to": "+1987654321",
"room_name": "meeting-room-1",
"sip_number": "+1234567890"
}
3. Monitor Call Status: It’s important to keep an eye on attributes like sip.callStatus to see how the call is progressing—whether it’s dialing, ringing, or active.
Just a quick reminder to keep your credentials safe and avoid hardcoding them. If you run into any questions or need help with a specific SIP provider or SDK, please don’t hesitate to reach out—I’m here to assist you!
Sources: packages/sip--um-actually/src/setup-twilio.ts | SIP APIs | LiveKit Docs | livekit-api/livekit/api/sip_service.py | lib/livekit/sip_service_client.rb | livekit-protocol/src/livekit.rs