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

fix: Create new call if initiate is different

Clémence Lesné99ef6f3dfb9a
diff --git a/main.py b/main.py
index a43cadf..0ecc111 100644
--- a/main.py
+++ b/main.py
@@ -483,7 +483,9 @@ async def _communicationservices_event_url(
If the caller has already called, use the same call ID, to keep the conversation history. Otherwise, create a new call ID.
"""
call = await _db.call_asearch_one(phone_number)
- if not call:
+ if not call or (
+ initiate and call.initiate != initiate
+ ): # Create new call if initiate is different
call = CallStateModel(
initiate=initiate
or CallInitiateModel(