Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

finops: Avoid generating report if no customer interaction

Clémence Lesnéf34a40b838b0
diff --git a/helpers/call_events.py b/helpers/call_events.py
index a24d467..cf4b0cf 100644
--- a/helpers/call_events.py
+++ b/helpers/call_events.py
@@ -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)