# Connect Cloud Voice to an SQL Database Using Data Connector

The Data Connector lets Cloud Voice write a copy of your phone system data to a SQL (Structured Query Language) database you control. Once a link is established, the system performs a one-way sync of records such as call detail records (CDRs), recording logs, and system metrics on the interval you choose, so you can retain, report on, or feed that data into other tools.

## Before you start

Data Connector requires Cloud Voice firmware **84.23.0.83** or later.

You also need a destination database ready to receive the synced data:

- A running database server on one of the supported platforms: **PostgreSQL**, **MySQL**, or **Microsoft SQL**.
- An empty database created on that server to hold the Cloud Voice data.

## Enable and configure the connector

1. Sign in to the PBX web portal and go to **Integrations > Data Connectors**.
2. Switch **Data Connectors** on.

   ![The Data Connectors toggle in its enabled position](/images/pbx/enable-data-connector.png)

3. In the **Database** section, define how Cloud Voice reaches your database.

   ![Database connection fields including host, port, and credentials](/images/pbx/database-connection.png)

   a. Fill in the connection details:

   | Item | Description |
   | --- | --- |
   | Database | Choose the database type: **PostgreSQL**, **MySQL**, or **Microsoft SQL**. |
   | Host | The IP address or domain name of the server where the database runs. |
   | Port | The port the database listens on. |
   | Database Name | The name of the database that will store the data. |
   | Username | The account used to connect to the database. |
   | Password | The password for that account. |
   | SSL Enabled | Turn SSL (Secure Sockets Layer) certificate verification on or off. When enabled, click **Browse** to upload your SSL certificate. |

   b. Optional: click **Connection Test** to confirm Cloud Voice can reach the database. A "Connection test successful" message means the connection is working.

      :::tip
      Run the connection test before you continue. It catches wrong credentials, a blocked port, or an unreachable host up front, so you do not discover the problem later when the first sync fails.
      :::

4. In the **Data Range** section, choose which data sets to sync:

   | Data | What is synced |
   | --- | --- |
   | CDR | The CDR list, call legs, and timeline data. |
   | Recording Logs | Recording log entries. The recording audio files themselves are not synced. |
   | System Metric | Dashboard metrics: Active Calls, CPU Utilization, Memory Usage, Local Storage Usage, Registered Extensions, SIP Trunks Available, and Cloud Voice App Client Logins. Each sync captures the values as they stand at that moment. |
   | Call Notes | Call disposition and remark content. |
   | Report Data | Call report data. |
   | AI Summary & AI Transcription | AI-generated summaries and transcriptions. |

5. In the **Sync Configuration** section, set how often the sync runs and whether source data is cleared afterward.

   ![Sync frequency drop-down and source data cleanup option](/images/pbx/sync-configuration.png)

   a. Pick an interval from the **Sync Frequency** drop-down list.

      :::note
      Syncs run on the selected interval using the system's default time zone.
      :::

   b. Optional: select **The system will delete source data after successful synchronization** to remove the copied records from the PBX once each sync finishes.

      :::caution
      Once source CDRs are deleted from the PBX, the associated call records are no longer available there.
      :::

6. Run the first sync:

   a. Click **Sync Now**.
   b. Click **OK** in the confirmation dialog, then click **Confirm**, and wait for the sync to finish.

## Result

When the link is live, the integration status reads **Connected**. This confirms the database connection is established and that one-way synchronization into your database is running.

:::tip
With your data in a SQL database, you can point business intelligence tools, accounting systems, or other applications at it for visualization and analysis. Step-by-step guides are available for two common tools: [Import PBX Data from a Database into Grafana](/pbx/integrations/data-connector/import-pbx-data-from-a-database-into-grafana/) and [Import PBX Data from a Database into Power BI](/pbx/integrations/data-connector/import-pbx-data-from-a-database-into-powerbi/).
:::
