bland-actor-87445
08/12/2025, 10:09 AMtall-airline-16756
08/12/2025, 10:09 AMtall-airline-16756
08/12/2025, 10:10 AMphone_number,question
+1234567890,Hello! How are you today?
+9876543210,This is a test call.
2. Use the Python Example: You can use a script to read your CSV and make the calls. The script will create a room, dispatch, and a SIP participant for each call. Here’s a quick example:
async def make_survey_call(phone_number, question, row_index):
room_name = f"room_{row_index}"
metadata = json.dumps({"phone_number": phone_number, "question": question})
sip_participant = await lkapi.sip.create_sip_participant(
api.CreateSIPParticipantRequest(
room_name=room_name,
sip_trunk_id=outbound_trunk_id,
sip_call_to=phone_number,
participant_identity="phone_user"))
3. Process the CSV: Just read through your CSV and kick off calls for each row.
4. Set Environment Variables: Make sure you’ve got these set up:
◦ LIVEKIT_API_KEY
◦ LIVEKIT_API_SECRET
◦ LIVEKIT_URL
◦ SIP_OUTBOUND_TRUNK_ID
1. Run the Script: Run your script with all the right dependencies, and don’t forget to handle things like rate limits, errors, and retries so everything goes smoothly.
If you hit any bumps or want me to help you with the implementation, just give me a shout—I’m here for you!tall-airline-16756
08/12/2025, 10:14 AMsample.csv
. Just make sure you have the necessary dependencies and environment variables set up as explained below:
1. Install Dependencies: Simply run pip install livekit python-dotenv
to get started.
2. Create a .env File: Pop in your LiveKit credentials like this:
LIVEKIT_URL=<your_livekit_server_url>
LIVEKIT_API_KEY=<your_api_key>
LIVEKIT_API_SECRET=<your_api_secret>
SIP_OUTBOUND_TRUNK_ID=<your_sip_outbound_trunk_id>
3. CSV File Format: Make sure your sample.csv
looks like this:
Phone Number,Question,Answer,Status
+1231231231,Do you prefer chocolate or vanilla ice cream?,,
Here’s the script for you:
import asyncio
import csv
import json
import os
from dotenv import load_dotenv
from livekit import api
load_dotenv()
async def make_call(phone_number, question, row_index):
room_name = f"bulk-call-{row_index}"
metadata = json.dumps({"phone_number": phone_number, "question": question})
lkapi = api.LiveKitAPI()
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"))
await lkapi.aclose()
async def process_calls():
with open("sample.csv", "r") as f:
reader = csv.DictReader(f)
for i, row in enumerate(reader):
if not row["Answer"]:
await make_call(row["Phone Number"], row["Question"], i+1)
asyncio.run(process_calls())
Just save this as bulk_caller.py
and run it with python3 bulk_caller.py
. If you hit any bumps or have questions, feel free to ask—I’m here to help!bland-actor-87445
08/12/2025, 10:15 AMtall-airline-16756
08/12/2025, 10:15 AMsample.csv
. Just make sure you have everything set up as described below—it’s pretty straightforward!
1. Install Dependencies: Simply run pip install livekit python-dotenv
to get what you need.
2. Create a .env File: Pop in your LiveKit credentials like this:
LIVEKIT_URL=<your_livekit_server_url>
LIVEKIT_API_KEY=<your_api_key>
LIVEKIT_API_SECRET=<your_api_secret>
SIP_OUTBOUND_TRUNK_ID=<your_sip_outbound_trunk_id>
3. CSV File Format: Make sure your sample.csv
looks like this:
Phone Number,Question,Answer,Status
+1231231231,Do you prefer chocolate or vanilla ice cream?,,
Here’s the script for you to use:
import asyncio
import csv
import json
import os
from dotenv import load_dotenv
from livekit import api
load_dotenv()
async def make_call(phone_number, question, row_index):
room_name = f"bulk-call-{row_index}"
metadata = json.dumps({"phone_number": phone_number, "question": question})
lkapi = api.LiveKitAPI()
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"))
await lkapi.aclose()
async def process_calls():
with open("sample.csv", "r") as f:
reader = csv.DictReader(f)
for i, row in enumerate(reader):
if not row["Answer"]:
await make_call(row["Phone Number"], row["Question"], i+1)
asyncio.run(process_calls())
Just save this as bulk_caller.py
and run it using python3 bulk_caller.py
. If you hit any snags or want to chat more about it, I’m here to help!bland-actor-87445
08/12/2025, 5:46 PMtall-airline-16756
08/12/2025, 5:46 PM