some-hydrogen-97536
06/05/2025, 8:42 PMtall-airline-16756
06/05/2025, 8:42 PMtall-airline-16756
06/05/2025, 8:42 PMfrom datetime import datetime
import json
async def entrypoint(ctx: JobContext):
# Add this code to save transcripts when the call ends
async def write_transcript():
current_date = datetime.now().strftime("%Y%m%d_%H%M%S")
# Create a JSON file with the conversation history
filename = f"/tmp/transcript_{ctx.room.name}_{current_date}.json"
with open(filename, 'w') as f:
json.dump(session.history.to_dict(), f, indent=2)
print(f"Transcript for {ctx.room.name} saved to {filename}")
# Register the callback to run when the room closes
ctx.add_shutdown_callback(write_transcript)
# Rest of your entrypoint code follows...
2. This code saves the conversation history to a JSON file when the call ends. You can then configure S3 egress to upload this file to your S3 bucket. For optimal results, it's recommended to delete the room when the call ends to ensure proper cleanup and avoid extra audio in recordings. Sources: Session recording and transcripts | LiveKit Docs