Skip to content

Commit fab7991

Browse files
BurriKalyanswaroopvarma1
authored andcommitted
feat: support daily room audio recording
1 parent 70f0c1a commit fab7991

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

app/agents/voice/automatic/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,15 @@ async def on_client_message(rtvi, message):
271271
@transport.event_handler("on_first_participant_joined")
272272
async def on_first_participant_joined(transport, participant):
273273
logger.info(f"First participant joined: {participant['id']}")
274+
if config.ENABLE_AUTOMATIC_DAILY_RECORDING:
275+
await transport.start_recording()
274276
await task.queue_frames([context_aggregator.user().get_context_frame()])
275277

276278
@transport.event_handler("on_participant_left")
277279
async def on_participant_left(transport, participant, reason):
278280
logger.info(f"Participant left: {participant['id']}")
281+
if config.ENABLE_AUTOMATIC_DAILY_RECORDING:
282+
await transport.stop_recording()
279283
await task.cancel()
280284

281285
# Route Daily transport messages to RTVI for function confirmations

app/core/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ def get_required_env(var_name: str) -> str:
7171
# Text sanitization
7272
SANITIZE_TEXT_FOR_TTS = os.environ.get("SANITIZE_TEXT_FOR_TTS", "false").lower() == "true"
7373

74+
# Audio recording
75+
ENABLE_AUTOMATIC_DAILY_RECORDING = os.environ.get("ENABLE_AUTOMATIC_DAILY_RECORDING", "false").lower() == "true"
76+
7477
# Search
7578
ENABLE_SEARCH_GROUNDING = os.environ.get("ENABLE_SEARCH_GROUNDING", "true").lower() == "true"
7679
GEMINI_SEARCH_RESULT_API_MODEL = os.environ.get("GEMINI_SEARCH_RESULT_API_MODEL", "gemini-2.5-flash-lite-preview-06-17")

app/main.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
TWILIO_AUTH_TOKEN,
3232
TWILIO_FROM_NUMBER,
3333
BREEZE_BUDDY_CALL_PROVIDER,
34-
MAX_DAILY_SESSION_LIMIT
34+
MAX_DAILY_SESSION_LIMIT,
35+
ENABLE_AUTOMATIC_DAILY_RECORDING
3536
)
3637
from app.schemas import CallStatus, RequestedBy, Workflow
3738
from app.database.accessor.main import create_call_data
@@ -247,13 +248,18 @@ async def bot_connect(request: AutomaticVoiceUserConnectRequest) -> Dict[str, An
247248
platform_integrations = request.platformIntegrations
248249

249250
# 2. Create room + token
251+
252+
daily_room_properties = DailyRoomProperties(
253+
exp=time.time() + MAX_DAILY_SESSION_LIMIT,
254+
eject_at_room_exp=True,
255+
)
256+
257+
# Enable recording only if configured
258+
if ENABLE_AUTOMATIC_DAILY_RECORDING:
259+
daily_room_properties.enable_recording = "cloud"
260+
250261
room = await daily_helpers["rest"].create_room(
251-
params=DailyRoomParams(
252-
properties=DailyRoomProperties(
253-
exp=time.time() + MAX_DAILY_SESSION_LIMIT,
254-
eject_at_room_exp=True,
255-
)
256-
)
262+
params=DailyRoomParams(properties=daily_room_properties)
257263
)
258264

259265
token_params = DailyMeetingTokenParams(

0 commit comments

Comments
 (0)