Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!
Python
quality: Code comment
Clémence Lesnéa282db064b24
diff --git a/app/helpers/call_llm.py b/app/helpers/call_llm.pyindex c248c72..18759d5 100644--- a/app/helpers/call_llm.py+++ b/app/helpers/call_llm.py@@ -73,6 +73,9 @@ async def load_llm_chat( # noqa: PLR0913stt_complete_gate = asyncio.Event() # Gate to wait for the recognitiondef _stt_callback(text: str) -> None:+ """+ Store the recognition in the buffer.+ """# Skip if no textif not text:return@@ -100,6 +103,9 @@ async def load_llm_chat( # noqa: PLR0913last_response: Job | None = Noneasync def _timeout_callback() -> None:+ """+ Triggered when the phone silence timeout is reached.+ """from app.helpers.call_events import on_realtime_recognize_errorlogger.info("Phone silence timeout triggered")@@ -116,6 +122,9 @@ async def load_llm_chat( # noqa: PLR0913)async def _clear_audio_callback() -> None:+ """+ Triggered when the audio buffer needs to be cleared.+ """# Stop TTS, clear the buffer and send a stop signaltts_client.stop_speaking_async()while not audio_out.empty():@@ -155,6 +164,9 @@ async def load_llm_chat( # noqa: PLR0913await last_response.wait()async def _response_callback() -> None:+ """+ Triggered when the audio buffer needs to be processed.+ """# Wait for the complete recognitionawait stt_complete_gate.wait()