.
This commit is contained in:
@@ -60,7 +60,7 @@ def latest_recording_for_call(session, *, call_id: str) -> CallRecordingRow | No
|
||||
|
||||
def _voice_session_recently_active(session, *, link: AsteriskCallLinkRow, now: datetime) -> bool:
|
||||
bridge = _bridge_app()
|
||||
if str(link.ai_state or "").strip() not in {
|
||||
non_terminal_states = {
|
||||
"queued",
|
||||
"greeting",
|
||||
"active",
|
||||
@@ -69,15 +69,18 @@ def _voice_session_recently_active(session, *, link: AsteriskCallLinkRow, now: d
|
||||
"listening",
|
||||
"handoff_requested",
|
||||
"handoff_required",
|
||||
}:
|
||||
return False
|
||||
}
|
||||
link_ai_state = str(link.ai_state or "").strip()
|
||||
voice_session_id = str(link.voice_session_id or "").strip()
|
||||
if not voice_session_id:
|
||||
if not voice_session_id and link_ai_state not in non_terminal_states:
|
||||
return False
|
||||
voice_session = session.execute(
|
||||
select(VoiceAISessionRow).where(VoiceAISessionRow.session_id == voice_session_id)
|
||||
).scalar_one_or_none()
|
||||
if voice_session is None:
|
||||
return link_ai_state in non_terminal_states
|
||||
effective_ai_state = link_ai_state or str(voice_session.status or "").strip()
|
||||
if effective_ai_state not in non_terminal_states:
|
||||
return False
|
||||
recent_points = [
|
||||
bridge._parse_iso(voice_session.last_media_frame_at),
|
||||
|
||||
Reference in New Issue
Block a user