Teams Shared Line Appearance

This article describes how to implement Microsoft Teams Shared Line Appearance with Azure Communication Services. Shared line appearance lets a user choose a delegate to make or handle calls on their behalf. This feature is helpful if a user has an administrative assistant who regularly handles the user's calls. In the context of shared line appearance, a manager is a Teams user who authorizes a delegate to make or receive calls on their behalf. A delegate is a Microsoft 365 user who can make or receive calls on behalf of the delegator. You can find additional information about shared line appearance in Teams documentation.

Prerequisites

Support

SDKs

The following table shows support for shared line appearance feature in individual Azure Communication Services SDKs.

Support status Web Web UI iOS iOS UI Android Android UI Windows
Is Supported ✔️

Note

This API is provided as a preview for developers and might change based on feedback that we receive. Don't use this API in a production environment. To use this API, use the beta release of the Azure Communication Services Calling Web SDK (1.31.1-beta.1 or higher).

Install the SDK

Use the npm install command to install the Azure Communication Services calling and common SDKs for JavaScript.

Console
npm install @azure/communication-common --save
npm install @azure/communication-calling --save

Initialize required objects

Create a CallClient instance to initiate the calling stack. You can configure logging of calling SDK with the AzureLogger instance and setLogLevel method. You can get access to deviceManager for the operating system with the method getDeviceManager.

Then use the method createTeamsCallAgent to create asynchronously a TeamsCallAgent instance that will manage incoming and outgoing calls for a Teams user. The method takes CommunicationTokenCredential as an argument representing access token for Teams user.

JavaScript
const { CallClient } = require('@azure/communication-calling');
const { AzureCommunicationTokenCredential} = require('@azure/communication-common');
const { AzureLogger, setLogLevel } = require("@azure/logger");

// Set the logger's log level
setLogLevel('verbose');

// Redirect log output to wherever desired. To console, file, buffer, REST API, etc...
AzureLogger.log = (...args) => {
    console.log(...args); // Redirect log output to console
};

const userToken = '<USER_TOKEN>';
callClient = new CallClient();
const tokenCredential = new AzureCommunicationTokenCredential(userToken);
const teamsCallAgent = await callClient.createTeamsCallAgent(tokenCredential);
const deviceManager = await callClient.getDeviceManager();

Place a call on behalf of a Microsoft Teams user

Before placing a call behalf of a delegator, make sure delegate placing the call has make calls permission through delegator call settings in Microsoft Teams

To place a call on behalf of a Microsoft Teams user, specify OnBehalfOfOptions during start call. Replace xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx with the userId of the delegator and yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy with the userId of the callee.

JavaScript
const onBehalfOfOptions = { userId: { microsoftTeamsUserId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" } }
const teamsCallOptions = { onBehalfOfOptions: onBehalfOfOptions };
const call = teamsCallAgent.startCall([{ microsoftTeamsUserId: "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy" }], teamsCallOptions);

To place a call to a PSTN user on behalf of a Microsoft Teams user, use PhoneNumberIdentifier for call participant.

JavaScript
const call = teamsCallAgent.startCall([{ phoneNumber: "+1xxxxxxxxxx" }], teamsCallOptions);

Receive a call on behalf of a Microsoft Teams user

To receive calls on behalf of a delegator,

Next steps