# Set up Contact Synchronization from LDAP Server

Synchronizing contacts from your LDAP (Lightweight Directory Access Protocol) directory copies those records into Cloud Voice as company contacts. Once they are in the system, extension users can dial them straight from the Cloud Voice App, and you can route inbound calls from those contacts to specific destinations based on which phonebook each one lands in.

## Capacity limits

The number of company contacts and phonebooks your system can hold scales with how many extensions it has. Use the table below to confirm you stay within the ceiling for your deployment.

| Number of extensions (N) | Max. company contacts (total) | Max. company phonebooks |
| --- | --- | --- |
| N ≤ 50 | 50,000 | 100 |
| 50 < N ≤ 200 | 200,000 | 200 |
| N > 200 | 500,000 | 500 |

## Before you begin

Make sure you have already [mapped the contact fields you want between Cloud Voice and your LDAP server](/pbx/integrations/ldap/integrate-cloud-voice-cloud-voice-with-ldap-server/#integrate-yeastar-p-series-pbx-with-ldap__section_pzg_y2z_qcc). Synchronization relies on that mapping to know which LDAP attributes to import.

## Set up contact synchronization

1. On the LDAP configuration page, scroll down to the **Contacts Synchronization** section.
2. Turn on **Contacts Synchronization**, then configure the settings.

   
   ![Cloud Voice, contact synchronization settings with the Contacts Synchronization toggle enabled](/images/pbx/ldap-contact-sync-config.png)

   **Synchronize to Phonebook**: Choose where the imported contacts are stored:

   - **Create New**: Build a new phonebook from scratch. Enter a name for it in the **Phonebook Name** field.
   - **Read Specific Property Value and Create New**: Generate phonebooks automatically from an LDAP attribute. Enter the attribute name in the **Property Name** field.

     :::tip
     Use this when you want inbound calls from LDAP contacts routed to different destinations based on phonebook matches. For example, if your directory has a `department` attribute with the values `Sales` and `Support`, entering `department` here creates two phonebooks (**Sales** and **Support**) when you save. After you set up the matching inbound routes, calls are then delivered to the responsible team by phonebook.
     :::
   - **An existing phonebook**: Store the contacts in an empty phonebook you already have. These come from the phonebooks you created under **Contacts > Phonebooks**.

   The remaining settings control how and when the sync runs:

   | Setting | Description |
   | --- | --- |
   | Data Synchronization Frequency | How often contacts are synchronized. Pick a frequency, then set the time in the field that appears. |
   | Feedback Email | Optional. An email address to notify with the result of each sync. Enter up to 5 addresses, separated by semicolons (`;`). |
   | Sync Contact Filter | The filter statement that decides which LDAP entries are imported. For example, `(objectClass=inetOrgPerson)` imports every LDAP contact. |
   | Remove existing contacts which are not received from the server | When enabled, any contact that synced successfully last time but is absent from the current sync is deleted from Cloud Voice. |

   :::caution
   **Remove existing contacts which are not received from the server** deletes contacts. If your **Sync Contact Filter** is too narrow, or the LDAP server returns fewer entries than expected, the missing contacts are removed from Cloud Voice on the next sync. Leave this off until you have confirmed the filter returns the entries you want.
   :::

   :::note
   Synchronizing a large number of contacts can affect system performance. Schedule syncs during off-peak hours.
   :::

   :::note
   The **Sync Contact Filter** is applied relative to the [Base DN](/pbx/integrations/ldap/integrate-cloud-voice-cloud-voice-with-ldap-server/#integrate-yeastar-p-series-pbx-with-ldap__base-dn) (DN stands for Distinguished Name, the unique path to an entry in the directory). Cloud Voice searches starting from the Base DN and imports only the entries that match the filter.
   :::
3. Click **Save**.
4. Click **Sync Now** to import the contacts immediately.

   
   ![Cloud Voice, Sync Now button that triggers an immediate contact synchronization](/images/pbx/ldap-contact-sync-now.png)

## Result

- A banner confirms how many contacts were successfully synchronized.

  ![Notification banner reporting the number of contacts synchronized](/images/pbx/ldap-contact-sync-success.png)
- You can review the imported records and their phonebook(s) under **Contacts > Company Contacts / Phonebooks**. Synced items are marked with an LDAP tag ![LDAP source tag](/images/pbx/ldap-icon.png).

  ![Company contacts imported from LDAP, each marked with an LDAP tag](/images/pbx/ldap-contact-sync.png)
- Authorized extension users can view and call the contacts directly from the Cloud Voice App.

  :::note
  For users to see these contacts, grant them viewing permission for the associated phonebook under **Extension and Trunk > Client Permission > Contact Visibility**, and have them update the Cloud Voice App to a supported version:

  - Cloud Voice App for iOS: version 5.13.6 or later
  - Cloud Voice App for Android: version 5.13.8 or later

  ![Contact Visibility settings granting a user access to the LDAP phonebook](/images/pbx/allow-view-ldap-phonebook.png)
  :::

## What to do next

To send inbound calls from LDAP contacts to specific destinations based on the phonebook they belong to, set up inbound routes that match callers against the contacts in each phonebook.
