# Backend Permissions
> [!WARNING]
> If you add an **Azure AD Group**, only direct members of the group will receive access.
1. **Search** for the Unified Contacts Backend **App Registration**
2. **Open** the App Registration and click on the link to the linked **Enterprise App**
3. Under **Properties** enable the setting "Assignement required?" and click "Save"

4. You can now add users and groups that shall receive access to the Unified Contacts Backend via the "Users and groups" section



# Custom Domain
## Step 1: Custom Domain Creation and Assignment
If you want to create your own custom domain for your Unified Contacts **App Service** URL, there are two options depending on your domain provider:
### **Option 1:** **Azure App Service Domain**
* Navigate to your Unified Contacts **App Service**
* In the left navigation bar scroll down to the "Settings" section. Click "Custom domains".
* Click "Add custom domain" (in case you have not bought an **App Service Domain** yet, first create one by clicking "Buy App Service domain").
* Configure the custom domain as follows:
* Domain provider: **App Service Domain**
* TLS/SSL certificate: select **App Service Managed Certificate** if you want to create and bind the certificate to your custom domain automatically, this certificate is managed by Azure and will be automatically renewed at no cost.
* TLS/SSL type: **SNI SSL Binding** is free of cost and supported by most modern browsers.
* App Service Domain: Choose an existing **App Service Domain**
* Domain type: **Subdomain**
* Subdomain: Set your preferred subdomain
* Click "Add"

By clicking on add, the custom domain and the SSL Managed Certificate will be created and bound automatically.
### **Option 2: Non-Azure Domain**
* Navigate to your Unified Contacts **App Service**
* In the left navigation bar scroll down to the "Settings" section. Click "Custom domains".
* Click "Add custom domain"
* Configure the custom domain as follows:
* Domain provider: **All other domain services**
* TLS/SSL certificate: select **App Service Managed Certificate** if you want to create and bind the certificate to your custom domain automatically, this certificate is managed by Azure and will be automatically renewed at no cost.
* TLS/SSL type: **SNI SSL Binding** is free of cost and supported by most modern browsers.
* Domain: Set your preferred domain
* Hostname record type: **CNAME**
* Register the displayed CNAME or TXT record mapping with your DNS provider. Once this is done, click "Validate".
* Click "Add" when the validation is successful.
> [!NOTE]
> In both cases it can take a few moments until the SSL binding with the **App Service Managed Certificate** is complete.
## Step 2: Update Permissions
> [!NOTE]
> This step is only required if you are adding the custom domain after you have already deployed Unified Contacts.
The **App Registrations** that were created during the [post-deployment](../deployment/getting-started/unified-contacts-pro.md#step-2-perform-post-deployment-steps-permission-assignments) step must now be updated to support the new custom domain. Therefore,
* Navigate to **Azure AD**, "Manage" --> "App registrations"
* Locate the **two** **App registrations** that were created during the deployment of Unified Contacts. You assigned the name in the [first step of the deployment](../deployment/getting-started/unified-contacts-pro.md#step-1-deploy-unified-contacts-pro-base-services).\
* First, click on the "admin" **App registration** and navigate to "Manage" --> "Authentication".
* Under the "Redirect URLs", add your custom domain and click "Save"\

* Next, go the the "teams" **App registration** and navigate to "Manage" --> "Authentication".
* Under the "Redirect URLs", add your custom domain and click "Save"\

* Next, navigate to "Manage" --> "Expose API" and update the "Application ID URI" with your custom domain.\
The configuration of the custom domain is complete.
> [!WARNING]
> In the [next step](../deployment/getting-started/unified-contacts-pro.md#step-4-add-unified-contacts-pro-to-your-app-store) of the deployment guide, remember to update the **Api Domain** in the **Teams Manifest** configuration.
# SBC Number Lookup
> [!NOTE]
> Applicable to version 5.4.0 and above
With Unified Contacts 5.4.0 and later you can perform a reverse number lookup against contacts in the Unified Contacts Database and inject the DisplayName of the caller into the SIP header.
## Setup
### Unified Contacts Settings
Per default the SBC Lookup Endpoint is **disabled**. To enable it open the Unified Contacts Admin Portal and click on **Settings**. All settings will be have to be configured under the category **SBC Lookup**.
> [!WARNING]
> If you have updated recently and can't see the **SBC Lookup** Category you might have to clear your browser cache and reload the page.
#### Enable the SBC Lookup Endpoint
Per default the SBC Lookup Endpoint is **disabled**. To enable it open the Unified Contacts Admin portal at the root page. Navigate to **Settings** **> SBC Lookup** and enable the **SBC Lookup Endpoint**.

#### Configure IP Authentication
> [!CAUTION]
> We highly recommend having IP Authentication enabled.
> Without it you expose the lookup endpoint publicly into the internet, secured only by Basic Auth.
To allow access to the Endpoint you can specify an allow-list of IP addresses that are allowed to access the Endpoint. You can add any valid IPv4 or IPv6 address. Add it by entering the address into the input field and click on the **+** Button.
To delete an IP address from the allow-list click on the trash bin symbol.
> [!WARNING]
> The endpoint validates the last IP address in a forwarding chain. If you have the Unified Contacts AppService set up behind a reverse proxy, load balancer or other proxy service(s) the request will be treated as if it was send from the outbound IP address of the last proxy in the chain. In such cases make sure to implement your own firewall in front of the proxy service and add the IP address(es) of your proxy service(s) to the SBC Lookup endpoint allow-list.
#### Configure Authentication Credentials
As most SBCs don't support modern Authentication the SBC Lookup endpoint uses Basic Auth for Authenticating requests. To use the Endpoint you have to set a username and password. Those are the credentials you will also have to enter in your SBC.
> [!NOTE]
> Usernames have to have at least 3 chars. Only alphanumerical chars are allowed
> Passwords have to have at least 16 chars and contains at least one special character. Only alphanumerical chars and a list of special characters (!?@#$%^&\*()\_+-=\[]{}) are allowed
> [!WARNING]
> After you leave this page you will not be able to see the credentials you have configured. Make sure to store the credentials securely (e.g. in your Password Manager). If you forget the credentials you have to set new ones.
### SBC Setup
#### AudioCodes SBC Mediant Series
Setup an AudioCodes SBC requires the configuration of Remote Web Services and a Call Setup Rule.
First go to Setup -> IP Network -> Web Services -> Remote Web Services and create a new RWS. Give it s unique name on your SBC as it will be used in the Call Setup Rule later.\
Usage Type is General and Path must be /api/v1/sbclookup/phone.\
You need to specify a TLS Context as the connection will be secured, we recommend to use the same TLS Context you use for your connection to MS Teams.\
Username and password are those you defined earlier in the section above in the Unified Contacts Portal.
Next step is to define the HTTP Remote Host on the same screen, just click the blue link below password.
The value for Address you can copy from your Unified Contacts Portal website. Here we need to enter the App Service URL, the Port should be changed to 443 and Transport Type to HTTPS.\
As Interface select the one you want to use and from which you specified the public IP address in Unified Contacts Portal.
To get information of the Web Services you might want to enable logging on the SBC. This can be done in Setup -> IP Network -> Web Services -> Web Services Settings. Just modify the Debug Level to Detailed
Finally, you need a Call Setup Rule which queries the database on an incoming call.\
Just go to Setup -> Signaling & Media -> SIP Definitions -> Call Setup Rules and create a new one. \
Request Type is HTTP GET and Request Target must be the Remote Web Services Name.\
Request Key is the calling number, so enter Param.Call.Src.User. \
Next a condition is required to make sure that messages are manipulated only when a match is found. This should be HTTP.Response.Status == '200'.\
As an action we're going to modify Param.Call.Src.Name with the body of the 200 OK message received. So Action Value is HTTP.Response.Body
This CSR must be added to any IP Group on which you want to run the Reverse Name Lookup. Likely on every PSTN SIP Trunk IP Group.
> [!NOTE]
> You might have already some Call Setup Rules on your SBC and one or more are already assigned to IP Groups on which you want to run this feature.\
> In this case you create the new Call Setup Rule with the same Rule Set ID. If you have multiple Rule Sets in use, just create multiple rules to meet your environment.
# SharePoint Online Lists
Unified Contacts can search for contacts in **SharePoint Online lists**. You can use a contact list in SharePoint Online in different fashions:
* As bridge technology to export your customer contact data from any third party database and import it to SharePoint Online
* To deploy a centralized, shared contact list in your departments or business units
To optimize the search in SharePoint Online, Unified Contacts searches for a dedicated SharePoint **content type** - contacts. Therefor your contacts needs to be stored in a SharePoint Online **Contacts** list or a **List** where the content type "contacts" is assigned to.
> [!WARNING]
> Users will only be able to search a SharePoint Online list if they have (read-) permissions to access the list **and** the site under which it is stored.
This article describes how to create a new SharePoint Online list and assign the correct content type.
### Create an empty SharePoint Online List
* Open the **SharePoint Online** site where you would like to store the contacts
* Create a new list by clicking "Settings" -> "Add an app"
* Open the classic view by clicking "classic experience"\
* Select "Custom List"
* Define a name for the list and create it
### Assign the Content Type to a new SharePoint Online List
The list you just created must be of the "Contacts" **content type** to be found with Unified Contacts. One option is to assign a content type to a SharePoint list, and all newly created items in the list inherit the content type of that list.
Therefore, add the **Contact** content type and remove the default content type from the list.
* Open the SharePoint Online list
* Open list settings by clicking "Settings" --> "List settings"\
.png)
* Open "Advanced settings"
* Enable "Allow management of content types" and save the changes by clicking "OK" at bottom of the page.
* SharePoint opens the settings page and you will see the section "Content Types"
* Click "Add from existing site content types"\
* Add "Contact" and save the changes by clicking "OK"
* Click on "Default content type" and delete it
# UC Database
> [!Info]
> Applicable to version 1.5.0 and above \
With Unified Contacts 1.5.0 and later you can fill the internal database (UC Database) with contacts from anywhere which can be searched by each of your users.
To fill the database you need to insert your contacts in a specific schema as described below. We also provide a RESTful API for CRUD operations on Database contacts.
We provide two detailed examples in our documentation on how to add contacts to the UC Database leveraging
1. [Azure Data Factory as data integration service](sync-data-with-azure-data-factory.md)
2. [Our API for CRUD operations](crud-operations-with-rest-api.md)
## UC Database Documentation
The following documentation explains where to find the UC Database and how the Contacts table is structured.
### Database Location
The UC Database (DB) can be found in the resource group in which Unified Contacts was deployed.
> [!WARNING]
> If you did not choose a custom name when installing Unified Contacts, the DB-Server is called `db-uc-` followed by 13 digits and numbers, the DB itself is called`sql-db` by default.
To access the DB you will need the user and password you have set when installing Unified Contacts.
### Database Contacts Structure
> [!CAUTION]
> Only alter tables that have the prefix `UnifiedContactsCustom.` \
> Only alter the content, NEVER change the table schema.\
> Changing data in an unsupported way may degrade or even break Unified Contacts functionality.
Database Contacts are stored in the `UnifiedContactsCustom.Contacts` Table. You can change the content of this table as you like but **DO NOT** change the table's schema definition.
#### Schema Definition
| column name | data type | optional? | description | example |
|---|---|---|---|---|
| id | NVARCHAR(256) | false | Unique identifier of the contact | sap_28648f3b-8a60-4ded-a2df-5f303a74a17a |
| displayName | NVARCHAR(256) | true | DisplayName of the contact | John Doe |
| jobTitle | NVARCHAR(256) | true | JobTitle of the contact | Software Developer |
| department | NVARCHAR(256) | true | Department of the contact | R&D |
| companyName | NVARCHAR(256) | true | Name of company associated with the contact | Fantastic Company Inc. |
| mailAddresses | NVARCHAR(4000) | true | Email addresses of the contact. Multiple entries have to be separated with a semicolon (;) | john.doe@example.test;john.doe@example.test |
| imAddresses | NVARCHAR(4000) | true | Instant messaging addresses of the contact. Used for initiating a chat in Teams. If multiple imAddresses are provided, the first one is used to initiate a chat. If not provided the first email address of the contact is used. Multiple entries have to be separated with a semicolon (;) | john.doe@example.test;john.doe@example.test |
| mobilePhoneNumbers | NVARCHAR(4000) | true | Mobile phone numbers of the contact. Multiple entries have to be separated with a semicolon (;) | +1234567890;+9876543210 |
| businessPhoneNumbers | NVARCHAR(4000) | true | Business phone numbers of the contact. Multiple entries have to be separated with a semicolon (;) | +1234567890;+9876543210 |
| homePhoneNumbers | NVARCHAR(4000) | true | Home phone numbers of the contact. Multiple entries have to be separated with a semicolon (;) | +1234567890;+9876543210 |
| addressFullString | NVARCHAR(512) | true | Full address of the contact. If this is set it is used for displaying the address in the contact card. If not set the address is built from the other address properties. | Any Street 1, 12345 Any City, Any Country |
| addressStreetAddress | NVARCHAR(512) | true | Street address of the contact | Any Street 1 |
| addressPostalCode | NVARCHAR(512) | true | Postal code of the contact | 12345 |
| addressCity | NVARCHAR(512) | true | City of the contact | Any City |
| addressCountry | NVARCHAR(512) | true | Country of the contact | Any Country |
| source | NVARCHAR(64) | true | Sub source of the contact. This is used to identify the source of the contact if you are syncing multiple data sources. | SAP |