# Archive Files to Google Cloud Storage

Cloud Voice can copy your call recordings and system backups to a Google Cloud Storage bucket, either as a one-off transfer or on a recurring schedule. This keeps a durable off-box copy of your files and, if you choose, frees up storage on the phone system. This page walks you through preparing the Google Cloud side, connecting the bucket to Cloud Voice as an archive server, and building a task that moves the files.

## Requirements

| Item | Requirement |
|------|-------------|
| System firmware | Version 84.22.0.17 or later |
| Plan | Enterprise plan (self-managed phone systems) or Ultimate plan (Cloud Voice-hosted phone systems) |

## Limits

- Archive servers: up to 10
- Archive tasks: up to 200

## How it works

Archiving to Google Cloud Storage involves two sides of setup. On Google Cloud you provision the account and destination:

- A **service account** with full access to your Cloud Storage resources, plus a JSON **access key** that Cloud Voice uses to authenticate its upload requests.
- A **bucket** to hold the archived files.

On the phone system you connect and schedule:

- Register the bucket as an **archive server**.
- Build one or more **archive tasks** that define which files move and when.

When a task runs, Cloud Voice authenticates to Google Cloud with the service account's access key and uploads the selected files to your bucket.

:::note
If you plan to have Cloud Voice delete older files from the bucket automatically (through a retention policy), the service account must also have permission to delete objects in Cloud Storage.
:::

## Step 1: Create a service account in Google Cloud

1. Sign in to the [Google Cloud Console](https://console.cloud.google.com/).
2. On the project selector, choose an existing project or create a new one. The example below uses a project named **Cloud Voice**.

   ![Google Cloud project selector with the option to pick or create a project](/images/pbx/google-cloud-select-project.png)

3. Create the service account:

   a. In the top search bar, look up and open **Service Accounts**.

   ![Searching for Service Accounts in the Google Cloud search bar](/images/pbx/google-cloud-search-service-account.png)

   b. Click **CREATE SERVICE ACCOUNT**.

   
   ![Cloud Voice, the Create Service Account button on the service accounts page](/images/pbx/google-cloud-create-service-account.png)

   c. In **Service account details**, type a recognizable name in the **Service account name** field, then click **CREATE AND CONTINUE**.

   
   ![Cloud Voice, entering a name in the service account details step](/images/pbx/google-cloud-service-account-details.png)

   d. In **Grant this service account access to project (optional)**, open the **Role** drop-down, find and select **Storage Admin**, then click **DONE**. The new service account appears in the list.

   
   ![Cloud Voice, assigning the Storage Admin role to the service account](/images/pbx/google-cloud-storage-admin.png)

4. Generate an access key for the service account:

   a. In the service accounts list, click the more-options icon (three vertical dots) next to your service account and choose **Manage keys**.

   
   ![Cloud Voice, opening Manage keys for the service account](/images/pbx/click-google-cloud-service-account.png)

   b. Click **ADD KEY**, then select **Create new key**.

   
   ![Cloud Voice, the Add Key menu on the key management page](/images/pbx/google-cloud-add-key.png)

   c. Set **Key type** to **JSON** (JavaScript Object Notation, a plain-text credential file) and click **CREATE**. The key downloads to your computer as a JSON file.

   
   ![Cloud Voice, choosing the JSON key type before creating the key](/images/pbx/google-cloud-json-key.png)

   :::caution
   Keep the JSON file somewhere safe. You need it later to connect the bucket to Cloud Voice, and it cannot be re-downloaded.
   :::

   d. Click **CLOSE** to dismiss the dialog.

## Step 2: Create a bucket in Cloud Storage

1. In the top search bar, look up and open **Cloud Storage**. This takes you to the buckets page.

   ![Searching for Cloud Storage in the Google Cloud search bar](/images/pbx/google-cloud-search-storage.png)

2. Click **CREATE**.

   ![The Create button on the Cloud Storage buckets page](/images/pbx/create-google-cloud-bucket.png)

3. In **Name your bucket**, enter a recognizable name and click **CONTINUE**.

   ![Naming the new Cloud Storage bucket](/images/pbx/google-cloud-bucket-created.png)

4. Under **Choose where to store your data**, pick the region for the bucket and click **CREATE**.

   
   ![Cloud Voice, selecting a region for the new bucket](/images/pbx/google-cloud-select-region.png)

   :::tip
   To keep archived files organized, create one or more folders inside the bucket now. You can then point a task at a specific folder in the later steps.

   ![A folder created inside the Cloud Storage bucket](/images/pbx/google-cloud-bucket-folder.png)
   :::

## Step 3: Add the bucket as an archive server

1. Sign in to the PBX web portal (the Cloud Voice admin web interface) and go to **System > Archive**.
2. On the **Archive Task** tab, click **Archive Server**.

   ![The Archive Server button on the Archive Task tab](/images/pbx/click-archive-server.png)

3. Add the bucket:

   a. Click **Add**.

   b. Fill in the dialog:

   
   ![Cloud Voice, the archive server settings for Google Cloud Storage](/images/pbx/google-archive-server-setting.png)

   | Setting | Description |
   |---------|-------------|
   | Name | A label that helps you recognize this server. |
   | Server Type | Select **Google Cloud Storage**. |
   | Private Key (JSON type) | Click **Browse** and upload the JSON key file you downloaded in Step 1. |

   c. Click **Save**. The bucket now appears in the archive server list.

4. Close the window.

## Step 4: Create an archive task

1. On the **Archive Task** tab, click **Add**.
2. In **Task Configuration**, set the basics:

   ![The task configuration fields for a new archive task](/images/pbx/s3-archive-task.png)

   | Setting | Description |
   |---------|-------------|
   | Name | A label that helps you recognize this task. |
   | File Type | Choose **Recording Files** or **Backup Files**. |
   | Data Range | The time span of files to archive. You can cover up to 31 days per task. |
   | Sync Frequency | How often the task runs. See the options below. |
   | Recording File Format | The format recordings are downloaded and stored in. Available only when the file type is recording files; every recording in the range is archived in the format you pick. |

   **Sync Frequency** options:

   - **Once**: Archives the files immediately after you save the task.
   - **Daily**: Runs each day at the time you choose from the drop-down.
   - **Weekly**: Runs on the weekday and time you choose.
   - **Monthly**: Runs on the day of the month and time you choose.

   :::note
   Moving large amounts of data uses the phone system's CPU. Schedule recurring tasks during off-peak hours where possible.
   :::

3. In **Storage Configuration**, choose where the files land:

   | Setting | Description |
   |---------|-------------|
   | Archive Server | Select the Google Cloud Storage bucket you added in Step 3. |
   | Select Folder/Path | Choose the bucket or a folder inside it as the destination. |
   | Storage Method | Controls how files are foldered on the server (see below). |
   | Skip archived files | Optional; recording files only. When on, files already archived are skipped. When off, they are archived again, their stored location is updated, and the earlier copy is left in place on the server. |
   | Delete local files after archiving | Optional; recording files only. When on, local copies are removed after upload, they remain playable and downloadable from the PBX admin portal and the Cloud Voice App, but not from the third-party server or Dynamics 365. When off, local copies are kept. |
   | Organize Files by Date | Optional. When on, files are placed in date-named subfolders (`YYYYMMDD`, for example `20260301`). When off, files go straight into the selected path. |

   **Storage Method** depends on how often the task runs:

   - **One-time task**
     - **Create Task Folder**: Creates a folder named `FileType-TaskName` under the selected path and stores the files there.
     - **Save Directly to Selected Path**: Stores the files in the selected path without creating a folder.
   - **Recurring task**
     - **Create Folder per Execution**: Each run creates a folder named `FileType-TaskName-ExecutionDate` under the selected path.
     - **Create Task Folder Once and Reuse It**: The first run creates a `FileType-TaskName` folder, and later runs reuse it.
     - **Save Directly to Selected Path**: Each run stores files in the selected path without creating a folder.

   :::note
   If **Organize Files by Date** is on and the selected range holds only a single record, no date subfolder is created and the file is stored directly in the path.
   :::

4. Optional. Set a retention policy so Cloud Voice prunes older files on the server.

   :::note
   - Retention is available only for recurring tasks.
   - The service account must have permission to delete objects on the archive server.
   :::

   ![The retention policy settings for an archive task](/images/pbx/archive-retention-settings.png)

   | Setting | Description |
   |---------|-------------|
   | Retention Type | **Retention by Quantity** keeps up to a set number of files or folders and deletes the oldest once that number is exceeded. **Retention by Days** keeps files or folders for a set period and deletes anything older. |
   | Retention Limit | The maximum count (files/folders) or number of days, matching the retention type you chose. |
   | Retention Unit | **Folder** counts the task folders created on the server; **File** counts individual archived files. |

   :::note
   - For **Retention by Days**, the period is counted from the time the file was archived on the server, not from when it was created on the phone system, and is measured in exact 24-hour blocks rather than calendar days.
   - The **Folder** retention unit is available only when **Storage Method** is set to **Create Folder per Execution**, and it does not count the date subfolders produced by **Organize Files by Date**.
   :::

5. Click **Save**.

## Verify the result

The selected files are uploaded to your bucket or folder either right away or at the scheduled time.

:::note
Only one task runs at a time to protect system performance. Additional tasks are queued and run in sequence.
:::

Confirm the outcome in either place:

- **In Cloud Voice**: Go to **System > Archive > Archival Logs**. A **Succeeded** value in the **Result** column means the files reached Google Cloud Storage.

  ![The archival logs list showing task results](/images/pbx/archival-logs.png)

  If a task fails, Cloud Voice raises a **Failed to Archive File(s)** event. Click the retry icon on that row to run it again.

  ![Retrying a failed archive task from the archival logs](/images/pbx/retry-archive-task.png)

- **In Google Cloud**: Open the bucket in the Google Cloud Console. The archived files appear in the list when the transfer succeeds.

  
  ![Cloud Voice, archived recording files shown in the Cloud Storage bucket](/images/pbx/recording-file-on-google.png)
