DEE Docs
Channels

Voice Channel

Deterministic outbound voice calls with voicemail detection and scripted flows.

Overview

The voice channel handles outbound calls as deterministic execution steps. Each call follows a scripted flow, with outcomes recorded in the audit log.

Configuration

import { VoiceChannel } from '@dee/channels-voice';

const voice = new VoiceChannel({
  provider: 'twilio',
  accountSid: process.env.TWILIO_ACCOUNT_SID,
  authToken: process.env.TWILIO_AUTH_TOKEN,
  defaultCallerId: process.env.TWILIO_FROM_NUMBER,
  recording: {
    enabled: true,
    format: 'mp3',
    storage: 's3://dee-recordings/',
  },
  voicemailDetection: {
    enabled: true,
    timeout: 5000, // ms to wait for human vs machine
  },
});

Call Scripts

Call scripts define the flow of a voice interaction:

const script = createScript({
  id: 'script_follow_up',
  greeting: 'Hi {{contact.firstName}}, this is {{sender.name}} from {{sender.company}}.',
  steps: [
    {
      type: 'speak',
      text: 'I sent you an email about {{product}} — did you get a chance to look at it?',
    },
    {
      type: 'gather',
      input: 'speech',
      timeout: 5,
      hints: ['yes', 'no', 'not interested', 'tell me more'],
    },
    {
      type: 'branch',
      on: 'gather.result',
      paths: {
        interested: { next: 'book-meeting' },
        not_interested: { next: 'thank-and-end' },
        no_answer: { next: 'leave-voicemail' },
      },
    },
  ],
});

Call Outcomes

Every call produces a deterministic outcome:

OutcomeDescription
answeredHuman picked up, script executed
voicemailMachine detected, voicemail left
no_answerNo pickup after configured rings
busyLine busy
failedCall could not be placed (invalid number, carrier error)
declinedContact has opted out of calls

Voicemail

When voicemail is detected, the engine can leave a pre-recorded message:

steps.sendVoice({
  id: 'follow-up-call',
  scriptId: 'script_follow_up',
  voicemail: {
    detect: true,
    messageId: 'vm_follow_up', // pre-recorded audio
    fallbackTTS: 'Hi {{contact.firstName}}, this is {{sender.name}}. Please call me back at {{sender.phone}}.',
  },
})

Events

EventTrigger
call.initiatedCall placed to carrier
call.ringingPhone ringing
call.answeredHuman picked up
call.voicemailVoicemail detected
call.completedCall ended normally
call.failedCall could not complete
call.recordedRecording uploaded to storage

Compliance

The voice channel enforces calling regulations:

  • Time windows — Calls only placed during permitted hours in the contact's time zone
  • DNC lists — Checked against Do Not Call registries before every dial
  • Frequency caps — Maximum call attempts per contact per time period
  • Consent tracking — Records consent status in the audit log
  • Recording disclosure — Configurable announcement for call recording compliance

On this page