dry-helmet-74553
07/28/2025, 12:54 PMtall-airline-16756
07/28/2025, 12:54 PMtall-airline-16756
07/28/2025, 12:56 PMfrom livekit import api
async def entrypoint(ctx: JobContext):
req = api.RoomCompositeEgressRequest(
room_name=ctx.room.name,
audio_only=True,
file_outputs=[api.EncodedFileOutput(
file_type=api.EncodedFileType.OGG,
filepath="livekit/my-room-test.ogg",
s3=api.S3Upload(
bucket="<s3 bucket name>",
region="<s3 region>",
access_key="<s3 access key>",
secret="<s3 secret key>",
),
)],
)
lkapi = api.LiveKitAPI()
res = await lkapi.egress.start_room_composite_egress(req)
await lkapi.aclose()
◦ Use LiveKit's Egress API to programmatically start recording.
◦ Example code snippet:
1. Auto-Egress with SIP:
◦ Enable automatic recording by configuring room_config.egress in SIP dispatch rules.
◦ This will automatically start recording based on the egress configuration.
1. Storage Requirements:
◦ Recordings are stored in your chosen cloud storage provider (e.g., Google Cloud Storage, Amazon S3, Azure Blob Storage).
Call Transcriptions
1. Real-time Transcript Access: Example:
from datetime import datetime
import json
async def entrypoint(ctx: JobContext):
def save_transcript():
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
filename = f"transcript_{timestamp}.json"
with open(filename, 'w') as f:
json.dump(session.history, f, indent=2)
ctx.add_shutdown_callback(save_transcript)
◦ Access the session.history property to retrieve the entire conversation history.
◦ Use the add_shutdown_callback method to save the conversation history to a file after the session ends.
1. Event-Based Transcript Capture:
◦ Listen for events like conversation_item_added and user_input_transcribed for real-time updates.
1. Pipeline Node Access:
◦ Use llm_node or transcription_node for real-time transcription access.
Backend API Integration
• When phone calls are routed through SIP into LiveKit rooms, the backend API provides access to transcriptions, recordings, and other features.
Notes:
• Ensure proper storage configuration for recording files.
• Recording starts when the agent enters the room and ends when all participants leave.
This setup allows for both automated and programmatic control over recordings and transcriptions.dry-helmet-74553
07/28/2025, 12:56 PMtall-airline-16756
07/28/2025, 12:57 PMconst fileOutput = new EncodedFileOutput({
filepath: `recording-${roomName}.mp4`,
output: {
case: 's3',
value: new S3Upload({
endpoint: S3_ENDPOINT,
accessKey: S3_KEY_ID,
secret: S3_KEY_SECRET,
region: S3_REGION,
bucket: S3_BUCKET,
}),
},
});
The key is making sure your request has a clear, complete roadmap for where that recording should end up. Think of it like giving precise directions to a friend – the more specific, the better! 😊 Need any help walking through this? I'm right here to help you get it sorted! 🤝 Sources: errors.go | app/api/record/start/route.ts | pkg/errors/errors.godry-helmet-74553
07/28/2025, 12:58 PMtall-airline-16756
07/28/2025, 12:59 PM