feat: add call history API endpoints and TTS service client
Adds read-only access to persisted call records for the dashboard and implements a client for the Rhema text-to-speech service. - api/call_history.py: New router providing paged call lists and detailed call records with transcript metadata. - services/tts.py: Async client for OpenAI-compatible TTS endpoints (Rhema/Kokoro) used for call-flow steps.
This commit is contained in:
@@ -30,6 +30,7 @@ class CallManager:
|
||||
self.event_bus = event_bus
|
||||
self._active_calls: dict[str, ActiveCall] = {}
|
||||
self._call_legs: dict[str, str] = {} # SIP leg ID -> call ID mapping
|
||||
self._on_call_ended = None # async callback(call: ActiveCall, final_status)
|
||||
|
||||
# ================================================================
|
||||
# Call Lifecycle
|
||||
@@ -164,6 +165,11 @@ class CallManager:
|
||||
},
|
||||
message=f"📵 Call ended: {call.remote_number} ({call.duration}s, hold: {call.hold_time}s)",
|
||||
))
|
||||
if self._on_call_ended is not None:
|
||||
try:
|
||||
await self._on_call_ended(call, status)
|
||||
except Exception as e:
|
||||
logger.warning(f"on_call_ended hook failed for {call_id}: {e}")
|
||||
return call
|
||||
|
||||
# ================================================================
|
||||
|
||||
Reference in New Issue
Block a user