Skip to content

Commit

Permalink
finops: Avoid generating report if no customer interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlesne committed May 17, 2024
1 parent 107eb46 commit f34a40b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions helpers/call_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,16 @@ def _post_call_intelligence(
"""
Shortcut to run all post-call intelligence tasks in background.
"""
if (
len(call.messages) >= 3
and call.messages[-3].action == MessageActionEnum.CALL
and call.messages[-2].persona == MessagePersonaEnum.ASSISTANT
and call.messages[-1].action == MessageActionEnum.HANGUP
):
_logger.info(
"Call ended before any interaction, skipping post-call intelligence"
)
return
background_tasks.add_task(_post_call_next, call)
background_tasks.add_task(_post_call_sms, call)
background_tasks.add_task(_post_call_synthesis, call)
Expand Down

0 comments on commit f34a40b

Please sign in to comment.