Recording calls
Recording is off until you deploy a policy, one per environment. Every recorded call hears the notice first, inbound and outbound, and nothing is recorded until it has played. Check the wording with whoever advises you on recording law.
import { defineQueue, defineRecordingPolicy, Hcc } from '@hcc/sdk';
// Exported, so `hcc deploy` deploys it. Lower-level: `hcc.recording.deploy(recording)`.
export const recording = defineRecordingPolicy({
notice: 'This call may be recorded.',
retention: { audio: '90d', transcript: '365d' }, // the defaults
});
// A queue or a call can only turn it off.
const legal = defineQueue('legal', { recording: false });
await hcc.calls.create({ from, to, instructions, recording: false });
await hcc.reps.dial('rep_123', { to, recording: false });
await hcc.recording.pause(callId); // what is said meanwhile isn't in the file
await hcc.recording.unpause(callId);
await hcc.recording.list(callId); // metadata: status, duration, channels, deleteAfter
await hcc.recording.delete(callId); // stops one under way, removes the audio here and at the providercall.recording.ready fires once the audio is stored, and its recordingId is ours (rec_…). Two channels don't promise one speaker per channel on calls with a rep.
Owners and admins can stop recording for the workspace from the dashboard. Only hcc.recording.resume(), with a live key that has the recording:manage scope, starts it again; a redeploy doesn't. Only owners and admins can grant that scope. Test calls run on the simulator and aren't recorded.
The record and dial({ record }) Call Instructions play the notice first as well, with or without a policy: the default notice when no policy applies.
- A caller who has heard it doesn't hear it again, and that includes a queue's
overflow: 'voicemail'. - If the notice can't be proven to have played, or the stop switch is on, they don't record and the call carries on:
recordmoves on to the next instruction, anddialdials unrecorded. - Their recordings have no
deleteAfter, so they stay until you delete them.