RAIA™ Specification

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

← Back to Developer Hub TEXTBOOK SPECIFICATION
RAIA™ (Real estate Artificial Intelligence Agent) Specification

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

🧩 Section A: In Plain English

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.

🧩 In Plain English

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:

1. INBOUND PIPELINE (SPEECH-TO-TEXT) Telegram Client 🎤 Voice Note (.ogg) Vercel Ingress 📥 Downloads buffer Nginx Gateway 🔒 Port 80 Secure Proxy Whisper VPS Core ⚡ Local faster-whisper RAIA (Real estate Artificial Intelligence Agent) Brain Claude Sonnet 🧠 SJT Reasoning 2. OUTBOUND PIPELINE (TEXT-TO-SPEECH) Gemini TTS API 🔊 Generates raw PCM L16 WAV RIFF Compiler 📦 44-byte WAV Compiler Telegram Client 📲 Native Waveform Drop

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:

A. Production Sovereign Hybrid Node (raia_robot)

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.

STT Transport: HTTP POST → http://31.97.113.196/api/voice/transcribe
B. Local Developer VPS Node (Hermes Bot)

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.

STT Transport: Python faster-whisper (Base model) on localhost port 9119 (UFW Firewalled)

3. Voice Ingest & Synthesis Protocols

The standard execution steps for both incoming voice notes and outgoing voicemail messages are outlined below:

  • 1
    Inbound 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:

file metadata, and calls Telegram's getFile API to extract the temporary `.ogg` audio binary.

  • 2
    Speech-to-Text Parsing (Q-LLM / API Ingest)

    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.

  • 3
    Brain Reasoning (Claude Agent)

    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.

  • 4
    Text-to-Speech Synthesis (Gemini TTS API)

    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.

  • 5
    WAV RIFF Header Construction & Telegram Drop

    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:

    🗣️ Activate 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.

    ✍️ Deactivate Voice Mode

    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:

    Repository Code

    The live codebase implementation for this textbook logic sits within the following repository folder: