Voice Call Capability Validator (voice/opt-in.ts)

DeskcommCRM · lib/voice/opt-in.ts · typescript · MIT
voice, lang:typescript, tag:validation, tag:config

Validates whether voice calling is enabled by checking both global infrastructure capacity and organization-specific consent. Use this to gate voice features in the UI and backend.

// Source: https://github.com/melgarafael/DeskcommCRM | License: MIT | Copyright 2026 Rafael Melgaço
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * A CHAMADA DE VOZ SÓ EXISTE ONDE A INSTALAÇÃO A OFERECE **E** A ORGANIZAÇÃO A PEDIU.
 *
 * ═══ POR QUE SÃO DUAS PERGUNTAS, E NÃO UMA ═══
 *
 * `WACALLS_API_BASE_URL` responde **capacidade**: o serviço de voz está de pé
 * nesta instalação? Quem responde é quem administra a VPS, e a resposta vale
 * para todas as organizações do processo.
 *
 * `org_voice_calls.enabled` responde **consentimento**: esta organização aceita
 * vincular um segundo aparelho ao número dela? Quem responde é o admin dela, e
 * a resposta vale só para ela.
 *
 * São eixos diferentes, e por isso a combinação é `&&` — não a precedência
 * `escolhaDa

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key