3.6.2 raia_robot — Voice Chat & Voicemail Setup
This guide explains how RAIA (Real estate Artificial Intelligence Agent) processes voice notes and voicemail drops. Staff can speak directly to @raia_robot, and it automatically transcribes their words. RAIA (Real estate Artificial Intelligence Agent) then replies in a natural voice, mea
This guide explains how RAIA (Real estate Artificial Intelligence Agent) processes voice notes and voicemail drops. Staff can speak directly to @raia_robot, and it automatically transcribes their words. RAIA (Real estate Artificial Intelligence Agent) then replies in a natural voice, mea
RAIA (Real estate Artificial Intelligence Agent) Robot Voice Setup — Voice Chat & Voicemail Pipeline
This guide explains how RAIA (Real estate Artificial Intelligence Agent) processes voice notes and voicemail drops — staff can speak directly to @raia_robot, and it automatically transcribes and replies in a natural voice, enabling hands-free property management.
This guide explains how RAIA (Real estate Artificial Intelligence Agent) processes voice notes and voicemail drops. Staff can speak directly to @raia_robot, and it automatically transcribes their words. RAIA (Real estate Artificial Intelligence Agent) then replies in a natural voice, meaning you can manage your properties hands-free while driving or walking between viewings.
🗣️ 3.6.2 raia_robot — Voice Chat & Voicemail Setup
Operational Spec (S4-VOICE)The RAIA™ (Real estate Artificial Intelligence Agent) voice processing pipeline enables complete hands-free operations for on-the-move property managers. By integrating robust Speech-to-Text (STT) and low-latency Text-to-Speech (TTS), RAIA (Real estate Artificial Intelligence Agent) can understand spoken voice notes and deliver synthesized voicemail replies directly inside Telegram. This document outlines the distinct architectures for our Serverless Production Node and our Local Developer VPS Node.
1. System Architecture
The voice pipeline operates as an asynchronous loop. Below is the precise routing logic, mapping physical and API boundaries across both the Inbound (STT) and Outbound (TTS) paths:
2. Operational Environments (Serverless vs. Sovereign Hybrid)
RAIA (Real estate Artificial Intelligence Agent) handles speech-to-text dynamically based on hosting environments, fully supporting our Sovereign Hybrid Model to eliminate external API billing:
Environment: Vercel Edge/Serverless functions at app.estateaigents.com.
To bypass serverless memory constraints and completely eliminate OpenAI Whisper API billing, `@raia_robot` runs a sovereign proxy pattern. When a voice note is received, Vercel securely forwards the audio to our VPS-hosted Nginx proxy on Port 80, which reverse-proxies the request internally to localhost port 9119, transcribes it locally for free via local Whisper, and returns the text.
Environment: Linux VPS persistent environment at dev.estateaigents.com.
Since the VPS has full CPU/GPU access and persistent state, the developer bot runs **local ctranslate2 (`faster-whisper`)** directly on the host machine. This is completely free, runs locally, keeps all data private, and is strictly firewalled via UFW on port 9119 to only accept connections from local and Tailscale interfaces.
3. Voice Ingest & Synthesis Protocols
The standard execution steps for both incoming voice notes and outgoing voicemail messages are outlined below:
-
1Inbound Voice Trigger & Extraction
When a staff member sends a voice note, the Telegram API fires a webhook. The ingress logic detects `message.voice`, grabs the
Repository Code
The live codebase implementation for this specification sits within the following repository folder:
getFile API to extract the temporary `.ogg` audio binary.
The raw audio buffer is passed to the resolved STT engine (OpenAI Whisper cloud API for production; local `faster-whisper` for VPS development). The resulting text is mapped as the primary `inboundText` variable. Additionally, autoVoiceMode is set to `true` to ensure the conversation defaults to voice mode.
The extracted text is sent to the central Claude Sonnet agent. Claude processes the command, reads the necessary database variables (e.g., tenancy agreements, EPC statuses), performs the domain action, and drafts a clean, direct textual reply.
If voice_mode is active, the bot reads the organisation's voice_style from tbl_aigents (mapping to prebuilt voices like Charon, Achird, Kore, or Sadaltager) and makes a low-latency POST request to the Gemini TTS endpoint to generate raw 16-bit PCM (mono, 24kHz) audio.
Since Telegram rejects raw PCM data, RAIA's compiler prepends a standards-compliant 44-byte WAV RIFF header directly to the PCM byte buffer. This transforms the raw data stream into a high-fidelity `.wav` file, which is uploaded natively to Telegram via sendVoice, appearing in the staff member's chat as an instant voicemail bubble.
4. Environment Variables & Provisioning
To maintain operational parity across all nodes, ensure the following keys are configured in your respective `.env.local` files or Vercel dashboard environments:
# 1. Core Channels & Brain TELEGRAM_BOT_TOKEN # Bot token generated from @BotFather TELEGRAM_WEBHOOK_SECRET # Secret string used to authenticate webhook triggers ANTHROPIC_API_KEY # Claude Sonnet key for agent-side reasoning # 2. Text-to-Speech (TTS) GEMINI_API_KEY # Google Gemini key used for native TTS (voice replies) # 3. Production Speech-to-Text (STT) & Sovereign Proxy VOICE_TRANSCRIBE_URL # Public proxy URL pointing to: http://31.97.113.196/api/voice/transcribe VOICE_TRANSCRIBE_SECRET # Secure shared bearer secret (e.g. raia_sovereign_voice_secret_2026) OPENAI_API_KEY # (Optional Fallback) Fallback OpenAI key if sovereign VPS is offline
5. Persistent Voice Mode Toggles
Staff can activate or deactivate voice mode on the fly by speaking or typing specific triggers. This preference is saved directly on the database row at tbl_conversations.voice_mode:
Type or say: "switch to voice" or "voice mode on".
Note: Sending an inbound voice note automatically toggles the conversation to voice mode for subsequent replies.
Type or say: "switch to text" or "voice mode off".
Returns the bot to plain text message deliveries.
Repository Code
The active voice parsing modules, Webhook routes, and WAV header wrap integrations sit within the following repository directory:
Architecture Details
Multi-channel messaging architecture that routes inbound and outbound communications through a unified triage engine. The system normalises messages from email, SMS, voice, and app channels into a common format, applies routing rules, and delivers through the appropriate outbound channel with delivery tracking.
- Core Component: Unified messaging and triage engine
- Data Flow: Inbound Channel → Normalisation → Triage → Routing → Outbound Channel → Delivery Tracking
- Integration Points: Email (Gmail IMAP), SMS (Twilio), Voice (Twilio), In-app notifications
Configuration Reference
Key configuration parameters for this system:
| Parameter | Type | Default | Description |
|---|---|---|---|
| channel_priority | string[] | email, sms, voice, in_app | Channel priority for outbound delivery |
| max_retry_count | integer | 3 | Delivery retry attempts per message |
| triage_rules_version | string | v1 | Active triage rules version |
Figure 2: Messaging architecture — component interaction and data flow.
Troubleshooting
| Issue | Cause | Resolution |
|---|---|---|
| Message delivery failure | Channel provider outage or invalid recipient address | Fallback to next channel in priority list |
| Triage rule mismatch | Rules version outdated for current message type | Update to latest triage_rules_version |
This component is part of the RAIA (Real estate Artificial Intelligence Agent) platform mono-repo. Implementation details, API contracts, and integration tests are available in the repository.