GitHubContribute in GitHub: Edit online

copyright: years: 2017, 2023 lastupdated: "2023-01-06"


Recording call audio

You can configure IBM® Voice Gateway to record call audio to a WAV file. The recordings capture audio from the customer caller and either the Text to Speech service for self-service agents or the call center agent for agent assistants.

About audio recording

By default, recordings are mixed into a single mono channel. In Version 1.0.0.4 and later, you can enable stereo recording to capture the audio from the caller and audio from the Text to Speech service or call center agent into separate audio channels. With stereo recording, you can separately analyze each individual audio source. For example, you can extract only the caller audio for analysis or further training of a Speech to Text custom acoustic model.

When audio recording is configured, all recordings are saved onto the voice-gateway-mr container under the /vgw-media-relay/recordings/ directory. Because the recordings are saved to the container, recordings are erased when the container is redeployed. To save your recordings, mount the directory to either a local directory on your machine or to a Docker volume.

Important: Recorded audio might potentially contain Protected Health Information (PHI), personally identifiable information (PII), or PCI Data Security Standard (PCI DSS) data. Be sure that the recordings are properly stored to prevent exposure of personal information. It's recommended that you encrypt the disk where Voice Gateway is deployed to protect recordings that might be cached on the file system.

Recording file format

Recordings are saved as WAV files in the following format, which is supported by most default audio players:

  • File name: [session-id]-audio.wav. For example, 1234-55678-audio.wav
  • Sample rate: 8000 Hz
  • Channels:
    • Mono (1 audio channel) - default
    • Stereo (2 audio channels)
    • Left channel: Text to Speech audio (self-service agents) or call center agent audio (agent assistants)
    • Right channel: Caller audio
  • Encoding: PCM

The session-id that is used for the file name maps to the SIP Call ID. To modify the session ID, set the CUSTOM_SIP_SESSION_HEADER configuration variable to point to different SIP header that defines the session ID to use. For more information about configuration, see SIP Orchestrator configuration environment variables.

How you configure audio recording depends on where you deployed the voice gateway as described in the following sections.

Configuring recording for Docker Engine

  1. Open the docker/docker-compose.yml file that you created when you initially deployed Voice Gateway on Docker Engine.

  2. Uncomment the following configuration in the docker-compose.yml file. This configuration enables recording and mounts a local directory where the recordings will be saved. To enable stereo recording, also specify STEREO_RECORDING=true.

media.relay: image: icr.io/voice-gateway/media-relay:latest ... environment: ... - ENABLE_RECORDING=true - STEREO_RECORDING=true volumes: - $PWD/recordings:/vgw-media-relay/recordings

1. Redeploy Voice Gateway so that your changes take effect.

As an alternative to mounting the local directory, you can manually copy recordings to a local path by running the following command:

  ```bash
docker cp voice-gateway-mr:/vgw-media-relay/recordings .

Configuring recording for Kubernetes in IBM Cloud Kubernetes Service

  1. Open the deploy.json Kubernetes deployment file that you created when you initially deployed Voice Gateway to Kubernetes in IBM Cloud.

  2. In the vgw-media-relay container, enable recording by setting the ENABLE_RECORDING environment variable to true. You can optionally enable stereo recording by setting STEREO_RECORDING to true.

"env": [{ "name": "ENABLE_RECORDING", "value": "true" }, { "name": "STEREO_RECORDING", "value": "true" } ... ]

1. Redeploy Voice Gateway so that your changes take effect.

When recording is enabled, your Voice Gateway deployment creates a Docker volume called `recordings` on the pod. This volume stores the audio files for the recordings of each session.

** Important:** Lite Kubernetes clusters can only create volumes on the pod, so deleting the pod deletes the volume and recordings. To copy the recordings to a local directory, run the `kubectl cp` command with the following options:
```bash
kubectl cp <namespace>/<podName>:recordings -c <containerName> <destinationDir>

For example, the following command copies the recordings volume from the pod1 pod to the current directory.

```bash

kubectl cp default/pod1:recordings -c vgw-media-relay .

  {:codeblock}