isDnd (dnd.js)

ai-voice-agent · telecom-compliance, dnd-enforcement, time-window-restriction, voice

Do-Not-Disturb window enforcement for Indian telecom compliance. TRAI (Telecom Regulatory Authority of India) restricts commercial voice calls to 09:00–21:00 IST. Calling outside this window on a DLT-registered DID risks carrier action against the trunk. Applies to *all* promot

/**
 * Do-Not-Disturb window enforcement for Indian telecom compliance.
 *
 * TRAI (Telecom Regulatory Authority of India) restricts commercial voice
 * calls to 09:00–21:00 IST. Calling outside this window on a DLT-registered
 * DID risks carrier action against the trunk. Applies to *all* promotional/
 * transactional voice traffic including order confirmations.
 *
 * Additionally we enforce our own buffer (09:05) to avoid clock-drift and
 * simultaneous-dial-storm risk at exactly 09:00:00.
 *
 * Policy: if the requested scheduledAt falls inside [21:00, 09:05) IST,
 * roll forward to 09:05 IST the next valid day.
 */

const IST_OFFSET_MIN = 5 * 60 + 30; // IST = UTC+05:30

const DEFAULT_START_HOUR = Number(process.env.DND_START_HOUR ?? 21);   // 21:00 IST — DND begins
const DEFAULT_END_HO

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

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

Get a free API key