/ Cases / Restaurants / Voice

A phone receptionist that doesn't make things up

It answers the landline and WhatsApp calls using the same data as the chat bot: hours, addresses and bookings come from the database, not from the model's memory.

/ Restaurantes Atitlán/ 2026/ Self-hosted phone system · synthetic voice

0

made-up facts: everything comes from the database

2

lines: landline and WhatsApp

/ The problem

The phone rang at rush hour and nobody could pick up. The first AI version once made up a location landmark: a confident voice saying something false is worse than no answer.

/ What we built

  • A self-hosted phone system with a voice agent that understands what callers say, with no "press 1" menus.
  • An HTTP bridge gives it the same tools as the chat bot, with answers written to be spoken out loud.
  • Hours, addresses and bookings are read from the database on every call.
  • It does a real transfer to an extension when a person is needed.

/ How it works

  1. 01Call (landline or WhatsApp)
  2. 02The voice agent understands the intent
  3. 03Checks the database through the bridge
  4. 04Answers or books
  5. 05Transfers if needed

/ Real code

src/pages/api/voz/tool.tsts
  const query = String(args.query ?? '').trim();
  if (!query) {
    return { ok: false as const, speech: '¿Sobre qué tema le puedo ayudar?' };
  }
  const res = await searchKnowledge({ query, brand: args.brand ? String(args.brand) : undefined });
  if (!res.ok || res.results.length === 0) {
    return {
      ok: false as const,
      speech:
        'Ese dato no lo tengo a la mano. Si gusta lo comunico con una persona del equipo que se lo confirma.',
    };
  }
  // Solo el mejor resultado y aplanado: los chunks del RAG traen markdown,
  // listas y precios que leídos de corrido son incomprensibles por teléfono.
  // Devolvemos `resumir: true` para que el prompt sepa que ESTO NO se lee
  // literal — el modelo debe condensarlo en una o dos frases.
  const texto = ventanaRelevante(aptoParaVoz(res.results[0].snippet), query, 700);
  return {
    ok: true as const,
    resumir: true,
    speech: texto,
    data: { results: res.results.slice(0, 2) },
  };
}

■ If the database lacks the answer, the voice offers a human instead of making it up; what it does find is flattened to be spoken over the phone.

/ Stack

AsteriskAgente de vozGoogle TTSElevenLabsCloudflare WorkersPostgres