# Integrate Cloud Voice with an LDAP Server

Once Cloud Voice is tied to an LDAP (Lightweight Directory Access Protocol) server, every inbound call triggers a lookup against your directory. If the caller's number matches a stored contact, Cloud Voice returns that record and shows the person's name in place of an unidentified number.

## Requirements

| Item | Requirement |
| --- | --- |
| Cloud Voice PBX | **Plan:** Enterprise Plan (EP) or Ultimate Plan (UP)<br />**Firmware:** Version 84.18.0.102 or later |
| Third-party LDAP server | No specific requirement |

## Step 1. Enable LDAP integration

1. Go to the LDAP configuration page.
   1. Log in to the PBX web portal and open **Contacts > Company Contacts**.
   2. Near the top of the page, click **Synchronize Contacts**.

      ![Synchronize Contacts button on the Company Contacts page](/images/pbx/sync-contacts-from-thirdparty.png)
   3. Open the **LDAP** tab.

      ![LDAP tab within the contact synchronization panel](/images/pbx/ldap-tab.png)
2. Switch on **Enable LDAP Integration** and complete the settings below.

   ![LDAP integration form with the enable toggle turned on](/images/pbx/ldap-integration-pce.png)

   | Setting | Description |
   | --- | --- |
   | Server Address | The address of your LDAP server. |
   | Port | The port the LDAP server is listening on. |
   | Protocol | Choose how the connection is carried:<br />**LDAP** transmits data in plain text.<br />**LDAPS** applies SSL or TLS to encrypt and authenticate the data exchanged between the LDAP client and server. |
   | Base DN | The Distinguished Name (DN) used as the starting point for contact searches, both for caller ID matching and for synchronization. It has to carry a Domain Component (DC) attribute that marks the root node of the directory tree, in the form `dc={domain_prefix},dc={domain_suffix}`. You can append one or more Relative Distinguished Names (RDNs) to limit how far the search reaches. See the examples that follow. |
   | User | The account name Cloud Voice uses to connect to the LDAP server. |
   | Password | The password that goes with that account. |
   | <span id="integrate-yeastar-p-series-pbx-with-ldap__number-filter"></span>Auto-match Contact Filter | The filter expression that drives caller ID matching. It has to include the `${NUMBER}` variable, which stands in for the caller's number, plus at least one number attribute to search on. See the example that follows. |

   :::tip
   Pick **LDAPS** whenever your server supports it. Plain **LDAP** carries the whole connection, including the **User** and **Password** you enter here, in clear text, so anyone watching the network could read them. LDAPS encrypts that traffic.
   :::

   **Base DN examples**

   - `dc=example,dc=com`, searches from `example.com`, the root entry of the directory tree.
   - `ou=support,dc=example,dc=com`, narrows the search to the `support` organizational unit inside `example.com`.

   **Auto-match Contact Filter example**

   `(|(telephoneNumber=${NUMBER})(mobile=${NUMBER}))`

   Here, an incoming call prompts Cloud Voice to check the caller's number against the `telephoneNumber` and `mobile` attributes. When one of them matches `${NUMBER}`, Cloud Voice pulls the matching contact and displays the caller's name.

   :::note
   The account entered under **User** needs read access to the attribute types and object classes held in the server's schema.
   :::

## Step 2. Map contact fields between Cloud Voice and the LDAP server

1. Scroll down to the **Map** section.
2. Map the fields required to display a caller's name.

   
   ![Cloud Voice, caller ID field mapping linking LDAP attributes to contact fields](/images/pbx/ldap-caller-id-map.png)

   1. Enter the corresponding LDAP attribute name for **Contact ID**, **First Name**, **Business Number**, and **Mobile Number**. After mapping, a matched inbound call shows the contact's first name.

      :::note
      **Business Number** and **Mobile Number** appear here because they are the attributes referenced in the [auto-match filter](#integrate-yeastar-p-series-pbx-with-ldap__number-filter) above. Be sure to map the number field(s) your own filter actually uses.
      :::
   2. Optional: to display the last name too, tick the **Last Name** checkbox and enter its LDAP attribute name.
3. To bring LDAP contacts into the PBX, enable and map the additional fields you want to synchronize.

   ![Mapping options for synchronizing LDAP contacts into the PBX](/images/pbx/ldap-map-contacts-sync.png)
4. Click **Save**.

## Result

- Cloud Voice is connected to your LDAP server.

  ![Notification confirming a successful LDAP server connection](/images/pbx/ldap-integration-success.png)
- When an inbound call matches an LDAP contact, the caller's name is shown.

## What to do next

To let extension users dial LDAP contacts straight from the Cloud Voice App, configure contact synchronization so those records are copied into the PBX. For details, see [Set up Contact Synchronization from LDAP Server](/pbx/integrations/ldap/set-up-contact-synchronization-from-ldap-server/).
