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

Richardcho/cancel add participant #27165

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@
"prettier": "^2.5.1",
"rimraf": "^3.0.0",
"sinon": "^15.0.0",
"ts-node": "^10.0.0",
"typescript": "~5.0.0",
"util": "^0.12.1",
"ts-node": "^10.0.0"
"util": "^0.12.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ import { OperationOptions } from '@azure/core-client';
import { PhoneNumberIdentifier } from '@azure/communication-common';
import { TokenCredential } from '@azure/core-auth';

// @public
export interface AddParticipantCancelled extends Omit<RestAddParticipantCancelled, "callConnectionId" | "serverCallId" | "correlationId" | "participant" | "invitationId" | "operationContext"> {
callConnectionId: string;
correlationId: string;
invitationId: string;
kind: "AddParticipantCancelled";
operationContext?: string;
participant?: CommunicationIdentifier;
serverCallId: string;
}

// @public
export interface AddParticipantFailed extends Omit<RestAddParticipantFailed, "callConnectionId" | "serverCallId" | "correlationId" | "participant" | "resultInformation"> {
callConnectionId: string;
Expand All @@ -35,6 +46,7 @@ export interface AddParticipantOptions extends OperationOptions {

// @public
export interface AddParticipantResult {
invitationId?: string;
operationContext?: string;
participant?: CallParticipant;
}
Expand Down Expand Up @@ -81,7 +93,7 @@ export interface CallAutomationClientOptions extends CommonClientOptions {
}

// @public
export type CallAutomationEvent = AddParticipantSucceeded | AddParticipantFailed | RemoveParticipantSucceeded | RemoveParticipantFailed | CallConnected | CallDisconnected | CallTransferAccepted | CallTransferFailed | ParticipantsUpdated | RecordingStateChanged | PlayCompleted | PlayFailed | PlayCanceled | RecognizeCompleted | RecognizeCanceled | RecognizeFailed | ContinuousDtmfRecognitionToneReceived | ContinuousDtmfRecognitionToneFailed | ContinuousDtmfRecognitionStopped | SendDtmfCompleted | SendDtmfFailed;
export type CallAutomationEvent = AddParticipantSucceeded | AddParticipantFailed | RemoveParticipantSucceeded | RemoveParticipantFailed | CallConnected | CallDisconnected | CallTransferAccepted | CallTransferFailed | ParticipantsUpdated | RecordingStateChanged | PlayCompleted | PlayFailed | PlayCanceled | RecognizeCompleted | RecognizeCanceled | RecognizeFailed | ContinuousDtmfRecognitionToneReceived | ContinuousDtmfRecognitionToneFailed | ContinuousDtmfRecognitionStopped | SendDtmfCompleted | SendDtmfFailed | AddParticipantCancelled | CancelAddParticipantFailed;

// @public
export interface CallConnected extends Omit<RestCallConnected, "callConnectionId" | "serverCallId" | "correlationId"> {
Expand All @@ -96,6 +108,7 @@ export class CallConnection {
// Warning: (ae-forgotten-export) The symbol "CallAutomationApiClientOptionalParams" needs to be exported by the entry point index.d.ts
constructor(callConnectionId: string, endpoint: string, credential: KeyCredential | TokenCredential, options?: CallAutomationApiClientOptionalParams);
addParticipant(targetParticipant: CallInvite, options?: AddParticipantOptions): Promise<AddParticipantResult>;
cancelAddParticipant(invitationId: string, options?: CancelAddParticipantOptions): Promise<CancelAddParticipantResult>;
getCallConnectionProperties(options?: GetCallConnectionPropertiesOptions): Promise<CallConnectionProperties>;
getCallMedia(): CallMedia;
getParticipant(targetParticipant: CommunicationIdentifier, options?: GetParticipantOptions): Promise<CallParticipant>;
Expand Down Expand Up @@ -259,6 +272,29 @@ export interface CallTransferFailed extends Omit<RestCallTransferFailed, "callCo
serverCallId: string;
}

// @public
export interface CancelAddParticipantFailed extends Omit<RestCancelAddParticipantFailed, "callConnectionId" | "serverCallId" | "correlationId" | "invitationId" | "operationContext" | "resultInformation"> {
callConnectionId: string;
correlationId: string;
invitationId: string;
kind: "CancelAddParticipantFailed";
operationContext?: string;
resultInformation?: ResultInformation;
serverCallId: string;
}

// @public
export interface CancelAddParticipantOptions extends OperationOptions {
callbackUrl?: string;
operationContext?: string;
}

// @public
export interface CancelAddParticipantResult {
invitationId: string;
operationContext?: string;
}

// @public
export interface ChannelAffinity {
channel?: number;
Expand Down Expand Up @@ -618,12 +654,22 @@ export interface RemoveParticipantSucceeded extends Omit<RestRemoveParticipantSu
}

// @public
export interface RestAddParticipantFailed {
export interface RestAddParticipantCancelled {
callConnectionId?: string;
correlationId?: string;
invitationId?: string;
operationContext?: string;
// Warning: (ae-forgotten-export) The symbol "CommunicationIdentifierModel" needs to be exported by the entry point index.d.ts
participant?: CommunicationIdentifierModel;
serverCallId?: string;
}

// @public
export interface RestAddParticipantFailed {
callConnectionId?: string;
correlationId?: string;
operationContext?: string;
participant?: CommunicationIdentifierModel;
resultInformation?: RestResultInformation;
serverCallId?: string;
}
Expand Down Expand Up @@ -674,6 +720,16 @@ export interface RestCallTransferFailed {
serverCallId?: string;
}

// @public
export interface RestCancelAddParticipantFailed {
callConnectionId?: string;
correlationId?: string;
invitationId?: string;
operationContext?: string;
resultInformation?: RestResultInformation;
serverCallId?: string;
}

// @public (undocumented)
export interface RestContinuousDtmfRecognitionStopped {
callConnectionId?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import {
ContinuousDtmfRecognitionStopped,
SendDtmfCompleted,
SendDtmfFailed,
AddParticipantCancelled,
CancelAddParticipantFailed,
} from "./models/events";

import { CloudEventMapper } from "./models/mapper";
Expand Down Expand Up @@ -126,6 +128,13 @@ export function parseCallAutomationEvent(
case "Microsoft.Communication.SendDtmfFailed":
callbackEvent = { kind: "SendDtmfFailed" } as SendDtmfFailed;
break;
case "Microsoft.Communication.AddParticipantCancelled":
callbackEvent = { kind: "AddParticipantCancelled" } as AddParticipantCancelled;
parsed.participant = communicationIdentifierConverter(data.participant);
break;
case "Microsoft.Communication.CancelAddParticipantFailed":
callbackEvent = { kind: "CancelAddParticipantFailed" } as CancelAddParticipantFailed;
break;
default:
throw new TypeError(`Unknown Call Automation Event type: ${eventType}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { CallConnectionImpl } from "./generated/src/operations";
import { CallConnectionProperties, CallInvite, CallParticipant } from "./models/models";
import {
AddParticipantOptions,
CancelAddParticipantOptions,
GetCallConnectionPropertiesOptions,
GetParticipantOptions,
HangUpOptions,
Expand All @@ -31,6 +32,7 @@ import {
AddParticipantResult,
RemoveParticipantResult,
MuteParticipantsResult,
CancelAddParticipantResult,
} from "./models/responses";
import {
callParticipantConverter,
Expand Down Expand Up @@ -301,4 +303,31 @@ export class CallConnection {
};
return muteParticipantsResult;
}

/** Cancel add participant request.
*
* @param invitationId - Invitation ID used to cancel the add participant request.
*/
public cancelAddParticipant(
invitationId: string,
options: CancelAddParticipantOptions = {}
): Promise<CancelAddParticipantResult> {
const { operationContext, callbackUrl: callbackUri, ...operationOptions } = options;
const cancelAddParticipantRequest = {
invitationId,
operationContext,
callbackUri,
};
const optionsInternal = {
...operationOptions,
repeatabilityFirstSent: new Date(),
repeatabilityRequestID: uuidv4(),
};

return this.callConnection.cancelAddParticipant(
this.callConnectionId,
cancelAddParticipantRequest,
optionsInternal
) as Promise<CancelAddParticipantResult>;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading