Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACS][CallAutomation] Update Communication common version to include TeamsAppIdentifier #29420

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -75,7 +75,7 @@
},
"dependencies": {
"@azure/abort-controller": "^1.0.0",
"@azure/communication-common": "^2.2.0",
"@azure/communication-common": "^2.3.1",
"@azure/core-auth": "^1.3.0",
"@azure/core-client": "^1.3.0",
"@azure/core-paging": "^1.1.1",
Expand Down
Expand Up @@ -12,6 +12,7 @@ import { CommunicationIdentifier } from '@azure/communication-common';
import { CommunicationUserIdentifier } from '@azure/communication-common';
import * as coreClient from '@azure/core-client';
import { KeyCredential } from '@azure/core-auth';
import { MicrosoftTeamsAppIdentifier } from '@azure/communication-common';
import { MicrosoftTeamsUserIdentifier } from '@azure/communication-common';
import { OperationOptions } from '@azure/core-client';
import { PhoneNumberIdentifier } from '@azure/communication-common';
Expand Down Expand Up @@ -193,7 +194,7 @@ export interface CallInvite {
readonly sourceCallIdNumber?: PhoneNumberIdentifier;
// (undocumented)
sourceDisplayName?: string;
readonly targetParticipant: PhoneNumberIdentifier | CommunicationUserIdentifier | MicrosoftTeamsUserIdentifier;
readonly targetParticipant: PhoneNumberIdentifier | CommunicationUserIdentifier | MicrosoftTeamsUserIdentifier | MicrosoftTeamsAppIdentifier;
}

// @public
Expand Down
Expand Up @@ -5,6 +5,7 @@ import {
CommunicationIdentifier,
CommunicationUserIdentifier,
MicrosoftTeamsUserIdentifier,
MicrosoftTeamsAppIdentifier,
PhoneNumberIdentifier,
} from "@azure/communication-common";
import { CallConnectionStateModel } from "../generated/src";
Expand Down Expand Up @@ -169,11 +170,12 @@ export enum RecognizeInputType {

/** Call invitee details. */
export interface CallInvite {
/** The Target's PhoneNumberIdentifier, CommunicationUserIdentifier or MicrosoftTeamsUserIdentifier. */
/** The Target's PhoneNumberIdentifier, CommunicationUserIdentifier, MicrosoftTeamsUserIdentifier or MicrosoftTeamsAppIdentifier. */
readonly targetParticipant:
| PhoneNumberIdentifier
| CommunicationUserIdentifier
| MicrosoftTeamsUserIdentifier;
| MicrosoftTeamsUserIdentifier
| MicrosoftTeamsAppIdentifier;
/** Caller's phone number identifier. */
readonly sourceCallIdNumber?: PhoneNumberIdentifier;
sourceDisplayName?: string;
Expand Down
Expand Up @@ -14,6 +14,8 @@ import {
SerializedCommunicationIdentifier,
isMicrosoftTeamsUserIdentifier,
MicrosoftTeamsUserIdentifier,
isMicrosoftTeamsAppIdentifier,
MicrosoftTeamsAppIdentifier,
} from "@azure/communication-common";
import {
CallParticipantInternal,
Expand Down Expand Up @@ -113,6 +115,18 @@ export function communicationIdentifierConverter(
return microsoftTeamsUserIdentifier;
}

if (
kind === KnownCommunicationIdentifierModelKind.MicrosoftTeamsApp &&
identifierModel.microsoftTeamsApp !== undefined
) {
const microsoftTeamsAppIdentifier: MicrosoftTeamsAppIdentifier = {
rawId: rawId,
teamsAppId: identifierModel.microsoftTeamsApp.appId,
cloud: identifierModel.microsoftTeamsApp.cloud as KnownCommunicationCloudEnvironmentModel,
};
return microsoftTeamsAppIdentifier;
}

const unknownIdentifier: UnknownIdentifier = {
id: rawId ? rawId : "",
};
Expand Down Expand Up @@ -149,6 +163,14 @@ export function communicationIdentifierModelConverter(
return microsoftTeamsUserIdentifierModel;
}

if (isMicrosoftTeamsAppIdentifier(identifier)) {
const microsoftTeamsAppIdentifierModel: CommunicationIdentifierModel = {
kind: KnownCommunicationIdentifierModelKind.MicrosoftTeamsApp,
...serializedIdentifier,
};
return microsoftTeamsAppIdentifierModel;
}

if (isUnknownIdentifier(identifier)) {
const unknownIdentifierModel: CommunicationIdentifierModel = {
kind: KnownCommunicationIdentifierModelKind.Unknown,
Expand Down