LemonGateway. Voice. CallSession
(lemon_gateway v0.1.0)
View Source
GenServer that manages a single voice call session.
Handles:
- WebSocket connections (Twilio + Deepgram)
- Audio streaming and buffering
- Speech-to-text processing
- LLM response generation
- Text-to-speech synthesis
- Call state management
Summary
Functions
Returns a specification to start this module under a supervisor.
Ends the call session.
Handles incoming audio from Twilio (mulaw 8kHz).
Handles transcript from Deepgram.
Looks up a call session by call SID.
Registers the Deepgram WebSocket connection.
Registers the Twilio WebSocket connection.
Sends a text response to be spoken.
Starts a new call session.
Returns the via tuple for registry lookup.
Types
@type t() :: %LemonGateway.Voice.CallSession{ call_sid: String.t(), conversation_history: list(), current_utterance: String.t(), deepgram_ws_pid: pid() | nil, from_number: String.t(), interruption_detected: boolean(), is_processing: boolean(), is_speaking: boolean(), last_activity_at: DateTime.t(), response_queue: list(), session_key: String.t(), started_at: DateTime.t(), to_number: String.t(), twilio_ws_pid: pid() | nil }
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec end_call(pid()) :: :ok
Ends the call session.
Handles incoming audio from Twilio (mulaw 8kHz).
Handles transcript from Deepgram.
Looks up a call session by call SID.
Registers the Deepgram WebSocket connection.
Registers the Twilio WebSocket connection.
Sends a text response to be spoken.
@spec start_link(keyword()) :: GenServer.on_start()
Starts a new call session.
Returns the via tuple for registry lookup.