From ac7c1e6d0d3e893d86eaefe83970ef909fde756c Mon Sep 17 00:00:00 2001 From: bromnhub <241785706+bromnhub@users.noreply.github.com> Date: Wed, 17 Dec 2025 05:03:39 -0500 Subject: [PATCH] refactor: Improve participant data access in is_playable_speaker --- vapi_python/daily_call.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vapi_python/daily_call.py b/vapi_python/daily_call.py index f4a7911..222024e 100644 --- a/vapi_python/daily_call.py +++ b/vapi_python/daily_call.py @@ -9,10 +9,11 @@ def is_playable_speaker(participant): - is_speaker = "userName" in participant["info"] and participant["info"]["userName"] == "Vapi Speaker" - mic = participant["media"]["microphone"] - is_subscribed = mic["subscribed"] == "subscribed" - is_playable = mic["state"] == "playable" + info = participant.get("info", {}) + is_speaker = info.get("userName") == "Vapi Speaker" + mic = participant.get("media", {}).get("microphone", {}) + is_subscribed = mic.get("subscribed") == "subscribed" + is_playable = mic.get("state") == "playable" return is_speaker and is_subscribed and is_playable