diff --git a/sdk/communication/communication-call-automation/package.json b/sdk/communication/communication-call-automation/package.json index 8e0ac883e854..2fa164928c90 100644 --- a/sdk/communication/communication-call-automation/package.json +++ b/sdk/communication/communication-call-automation/package.json @@ -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" } } diff --git a/sdk/communication/communication-call-automation/review/communication-call-automation.api.md b/sdk/communication/communication-call-automation/review/communication-call-automation.api.md index 2859c6f7c239..498fc6863ec5 100644 --- a/sdk/communication/communication-call-automation/review/communication-call-automation.api.md +++ b/sdk/communication/communication-call-automation/review/communication-call-automation.api.md @@ -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 { + callConnectionId: string; + correlationId: string; + invitationId: string; + kind: "AddParticipantCancelled"; + operationContext?: string; + participant?: CommunicationIdentifier; + serverCallId: string; +} + // @public export interface AddParticipantFailed extends Omit { callConnectionId: string; @@ -35,6 +46,7 @@ export interface AddParticipantOptions extends OperationOptions { // @public export interface AddParticipantResult { + invitationId?: string; operationContext?: string; participant?: CallParticipant; } @@ -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 { @@ -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; + cancelAddParticipant(invitationId: string, options?: CancelAddParticipantOptions): Promise; getCallConnectionProperties(options?: GetCallConnectionPropertiesOptions): Promise; getCallMedia(): CallMedia; getParticipant(targetParticipant: CommunicationIdentifier, options?: GetParticipantOptions): Promise; @@ -259,6 +272,29 @@ export interface CallTransferFailed extends Omit { + 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; @@ -618,12 +654,22 @@ export interface RemoveParticipantSucceeded extends Omit { + 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; + } } diff --git a/sdk/communication/communication-call-automation/src/generated/src/models/index.ts b/sdk/communication/communication-call-automation/src/generated/src/models/index.ts index d3e47b6943a0..2d905a5ee73c 100644 --- a/sdk/communication/communication-call-automation/src/generated/src/models/index.ts +++ b/sdk/communication/communication-call-automation/src/generated/src/models/index.ts @@ -27,6 +27,8 @@ export interface CreateCallRequest { callbackUri: string; /** Media Streaming Configuration. */ mediaStreamingConfiguration?: MediaStreamingConfiguration; + /** Live Transcription Configuration. */ + transcriptionConfiguration?: TranscriptionConfiguration; /** The identifier of the Cognitive Service resource assigned to this call. */ azureCognitiveServicesEndpointUrl?: string; /** Used by customer to send custom context to targets */ @@ -81,6 +83,18 @@ export interface MediaStreamingConfiguration { audioChannelType: MediaStreamingAudioChannelType; } +/** Configuration of live transcription. */ +export interface TranscriptionConfiguration { + /** Transport URL for live transcription */ + transportUrl: string; + /** The type of transport to be used for live transcription, eg. Websocket */ + transportType: TranscriptionTransportType; + /** Defines the locale for the data e.g en-CA, en-AU */ + locale: string; + /** Determines if the transcription should be started immediately after call is answered or not. */ + startTranscription: boolean; +} + export interface CustomContext { /** Dictionary of */ voipHeaders?: { [propertyName: string]: string }; @@ -156,6 +170,8 @@ export interface AnswerCallRequest { operationContext?: string; /** Media Streaming Configuration. */ mediaStreamingConfiguration?: MediaStreamingConfiguration; + /** Live Transcription Configuration. */ + transcriptionConfiguration?: TranscriptionConfiguration; /** The endpoint URL of the Azure Cognitive Services resource attached */ azureCognitiveServicesEndpointUrl?: string; /** The identifier of the call automation entity which answers the call */ @@ -419,6 +435,8 @@ export interface AddParticipantResponse { participant?: CallParticipantInternal; /** The operation context provided by client. */ operationContext?: string; + /** Invitation ID used to add a participant. */ + invitationId?: string; } /** The remove participant by identifier request. */ @@ -471,6 +489,22 @@ export interface UnmuteParticipantsResponse { operationContext?: string; } +export interface CancelAddParticipantRequest { + /** Invitation ID used to add a participant. */ + invitationId: string; + /** Used by customers when calling mid-call actions to correlate the request to the response event. */ + operationContext?: string; + /** The callback URI to override the main callback URI. */ + callbackUri?: string; +} + +export interface CancelAddParticipantResponse { + /** Invitation ID used to cancel the add participant action. */ + invitationId?: string; + /** The operation context provided by client. */ + operationContext?: string; +} + /** The request payload start for call recording operation with call locator. */ export interface StartCallRecordingRequest { /** The call locator. */ @@ -538,6 +572,7 @@ export interface BlobStorage { export interface RecordingStateResponse { recordingId?: string; recordingState?: RecordingState; + recordingType?: RecordingType; } /** The failed to add participant event. */ @@ -689,6 +724,38 @@ export interface RemoveParticipantFailed { participant?: CommunicationIdentifierModel; } +/** Successful cancel add participant event. */ +export interface AddParticipantCancelled { + /** Call connection ID. */ + callConnectionId?: string; + /** Server call ID. */ + serverCallId?: string; + /** Correlation ID for event to call correlation. Also called ChainId for skype chain ID. */ + correlationId?: string; + /** Used by customers when calling mid-call actions to correlate the request to the response event. */ + operationContext?: string; + /** Participant that has been cancelled. */ + participant?: CommunicationIdentifierModel; + /** Invitation ID used to cancel the request. */ + invitationId?: string; +} + +/** Failed cancel add participant event. */ +export interface CancelAddParticipantFailed { + /** Call connection ID. */ + callConnectionId?: string; + /** Server call ID. */ + serverCallId?: string; + /** Correlation ID for event to call correlation. Also called ChainId for skype chain ID. */ + correlationId?: string; + /** Used by customers when calling mid-call actions to correlate the request to the response event. */ + operationContext?: string; + /** Contains the resulting SIP code/sub-code and message from NGC services. */ + resultInformation?: ResultInformation; + /** Invitation ID used to cancel the request. */ + invitationId?: string; +} + export interface RecordingStateChanged { /** Call connection ID. */ callConnectionId?: string; @@ -1271,6 +1338,21 @@ export enum KnownMediaStreamingAudioChannelType { */ export type MediaStreamingAudioChannelType = string; +/** Known values of {@link TranscriptionTransportType} that the service accepts. */ +export enum KnownTranscriptionTransportType { + /** Websocket */ + Websocket = "websocket" +} + +/** + * Defines values for TranscriptionTransportType. \ + * {@link KnownTranscriptionTransportType} can be used interchangeably with TranscriptionTransportType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **websocket** + */ +export type TranscriptionTransportType = string; + /** Known values of {@link CallConnectionStateModel} that the service accepts. */ export enum KnownCallConnectionStateModel { /** Unknown */ @@ -1574,6 +1656,24 @@ export enum KnownRecordingState { */ export type RecordingState = string; +/** Known values of {@link RecordingType} that the service accepts. */ +export enum KnownRecordingType { + /** Acs */ + Acs = "acs", + /** Teams */ + Teams = "teams" +} + +/** + * Defines values for RecordingType. \ + * {@link KnownRecordingType} can be used interchangeably with RecordingType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **acs** \ + * **teams** + */ +export type RecordingType = string; + /** Known values of {@link RecognitionType} that the service accepts. */ export enum KnownRecognitionType { /** Dtmf */ @@ -1721,6 +1821,18 @@ export interface CallConnectionUnmuteOptionalParams /** Contains response data for the unmute operation. */ export type CallConnectionUnmuteResponse = UnmuteParticipantsResponse; +/** Optional parameters. */ +export interface CallConnectionCancelAddParticipantOptionalParams + extends coreClient.OperationOptions { + /** If specified, the client directs that the request is repeatable; that is, that the client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-Id is an opaque string representing a client-generated unique identifier for the request. It is a version 4 (random) UUID. */ + repeatabilityRequestID?: string; + /** If Repeatability-Request-ID header is specified, then Repeatability-First-Sent header must also be specified. The value should be the date and time at which the request was first created, expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT. */ + repeatabilityFirstSent?: Date; +} + +/** Contains response data for the cancelAddParticipant operation. */ +export type CallConnectionCancelAddParticipantResponse = CancelAddParticipantResponse; + /** Optional parameters. */ export interface CallConnectionGetParticipantOptionalParams extends coreClient.OperationOptions {} diff --git a/sdk/communication/communication-call-automation/src/generated/src/models/mappers.ts b/sdk/communication/communication-call-automation/src/generated/src/models/mappers.ts index a16ca5f6e7b9..7196b5c64798 100644 --- a/sdk/communication/communication-call-automation/src/generated/src/models/mappers.ts +++ b/sdk/communication/communication-call-automation/src/generated/src/models/mappers.ts @@ -66,6 +66,13 @@ export const CreateCallRequest: coreClient.CompositeMapper = { className: "MediaStreamingConfiguration" } }, + transcriptionConfiguration: { + serializedName: "transcriptionConfiguration", + type: { + name: "Composite", + className: "TranscriptionConfiguration" + } + }, azureCognitiveServicesEndpointUrl: { serializedName: "azureCognitiveServicesEndpointUrl", type: { @@ -222,6 +229,43 @@ export const MediaStreamingConfiguration: coreClient.CompositeMapper = { } }; +export const TranscriptionConfiguration: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TranscriptionConfiguration", + modelProperties: { + transportUrl: { + serializedName: "transportUrl", + required: true, + type: { + name: "String" + } + }, + transportType: { + serializedName: "transportType", + required: true, + type: { + name: "String" + } + }, + locale: { + serializedName: "locale", + required: true, + type: { + name: "String" + } + }, + startTranscription: { + serializedName: "startTranscription", + required: true, + type: { + name: "Boolean" + } + } + } + } +}; + export const CustomContext: coreClient.CompositeMapper = { type: { name: "Composite", @@ -427,6 +471,13 @@ export const AnswerCallRequest: coreClient.CompositeMapper = { className: "MediaStreamingConfiguration" } }, + transcriptionConfiguration: { + serializedName: "transcriptionConfiguration", + type: { + name: "Composite", + className: "TranscriptionConfiguration" + } + }, azureCognitiveServicesEndpointUrl: { serializedName: "azureCognitiveServicesEndpointUrl", type: { @@ -1221,6 +1272,12 @@ export const AddParticipantResponse: coreClient.CompositeMapper = { type: { name: "String" } + }, + invitationId: { + serializedName: "invitationId", + type: { + name: "String" + } } } } @@ -1355,6 +1412,55 @@ export const UnmuteParticipantsResponse: coreClient.CompositeMapper = { } }; +export const CancelAddParticipantRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CancelAddParticipantRequest", + modelProperties: { + invitationId: { + serializedName: "invitationId", + required: true, + type: { + name: "String" + } + }, + operationContext: { + serializedName: "operationContext", + type: { + name: "String" + } + }, + callbackUri: { + serializedName: "callbackUri", + type: { + name: "String" + } + } + } + } +}; + +export const CancelAddParticipantResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CancelAddParticipantResponse", + modelProperties: { + invitationId: { + serializedName: "invitationId", + type: { + name: "String" + } + }, + operationContext: { + serializedName: "operationContext", + type: { + name: "String" + } + } + } + } +}; + export const StartCallRecordingRequest: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1534,6 +1640,12 @@ export const RecordingStateResponse: coreClient.CompositeMapper = { type: { name: "String" } + }, + recordingType: { + serializedName: "recordingType", + type: { + name: "String" + } } } } @@ -1959,6 +2071,98 @@ export const RemoveParticipantFailed: coreClient.CompositeMapper = { } }; +export const AddParticipantCancelled: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AddParticipantCancelled", + modelProperties: { + callConnectionId: { + serializedName: "callConnectionId", + type: { + name: "String" + } + }, + serverCallId: { + serializedName: "serverCallId", + type: { + name: "String" + } + }, + correlationId: { + serializedName: "correlationId", + type: { + name: "String" + } + }, + operationContext: { + serializedName: "operationContext", + type: { + name: "String" + } + }, + participant: { + serializedName: "participant", + type: { + name: "Composite", + className: "CommunicationIdentifierModel" + } + }, + invitationId: { + serializedName: "invitationId", + type: { + name: "String" + } + } + } + } +}; + +export const CancelAddParticipantFailed: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CancelAddParticipantFailed", + modelProperties: { + callConnectionId: { + serializedName: "callConnectionId", + type: { + name: "String" + } + }, + serverCallId: { + serializedName: "serverCallId", + type: { + name: "String" + } + }, + correlationId: { + serializedName: "correlationId", + type: { + name: "String" + } + }, + operationContext: { + serializedName: "operationContext", + type: { + name: "String" + } + }, + resultInformation: { + serializedName: "resultInformation", + type: { + name: "Composite", + className: "ResultInformation" + } + }, + invitationId: { + serializedName: "invitationId", + type: { + name: "String" + } + } + } + } +}; + export const RecordingStateChanged: coreClient.CompositeMapper = { type: { name: "Composite", diff --git a/sdk/communication/communication-call-automation/src/generated/src/models/parameters.ts b/sdk/communication/communication-call-automation/src/generated/src/models/parameters.ts index f599ff07dcd3..26d7ad9c9b84 100644 --- a/sdk/communication/communication-call-automation/src/generated/src/models/parameters.ts +++ b/sdk/communication/communication-call-automation/src/generated/src/models/parameters.ts @@ -21,6 +21,7 @@ import { RemoveParticipantRequest as RemoveParticipantRequestMapper, MuteParticipantsRequest as MuteParticipantsRequestMapper, UnmuteParticipantsRequest as UnmuteParticipantsRequestMapper, + CancelAddParticipantRequest as CancelAddParticipantRequestMapper, PlayRequest as PlayRequestMapper, RecognizeRequest as RecognizeRequestMapper, ContinuousDtmfRecognitionRequest as ContinuousDtmfRecognitionRequestMapper, @@ -153,6 +154,11 @@ export const unmuteParticipantsRequest: OperationParameter = { mapper: UnmuteParticipantsRequestMapper }; +export const cancelAddParticipantRequest: OperationParameter = { + parameterPath: "cancelAddParticipantRequest", + mapper: CancelAddParticipantRequestMapper +}; + export const participantRawId: OperationURLParameter = { parameterPath: "participantRawId", mapper: { diff --git a/sdk/communication/communication-call-automation/src/generated/src/operations/callConnection.ts b/sdk/communication/communication-call-automation/src/generated/src/operations/callConnection.ts index 8983bf35a3ff..4c5923133457 100644 --- a/sdk/communication/communication-call-automation/src/generated/src/operations/callConnection.ts +++ b/sdk/communication/communication-call-automation/src/generated/src/operations/callConnection.ts @@ -37,6 +37,9 @@ import { UnmuteParticipantsRequest, CallConnectionUnmuteOptionalParams, CallConnectionUnmuteResponse, + CancelAddParticipantRequest, + CallConnectionCancelAddParticipantOptionalParams, + CallConnectionCancelAddParticipantResponse, CallConnectionGetParticipantOptionalParams, CallConnectionGetParticipantResponse, CallConnectionGetParticipantsNextResponse @@ -56,7 +59,7 @@ export class CallConnectionImpl implements CallConnection { } /** - * Get participants from a call. + * Get participants from a call. Recording and transcription bots are omitted from this list. * @param callConnectionId The call connection Id * @param options The options parameters. */ @@ -187,7 +190,7 @@ export class CallConnectionImpl implements CallConnection { } /** - * Get participants from a call. + * Get participants from a call. Recording and transcription bots are omitted from this list. * @param callConnectionId The call connection Id * @param options The options parameters. */ @@ -269,6 +272,23 @@ export class CallConnectionImpl implements CallConnection { ); } + /** + * Cancel add participant operation. + * @param callConnectionId The call connection Id + * @param cancelAddParticipantRequest Cancellation request. + * @param options The options parameters. + */ + cancelAddParticipant( + callConnectionId: string, + cancelAddParticipantRequest: CancelAddParticipantRequest, + options?: CallConnectionCancelAddParticipantOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { callConnectionId, cancelAddParticipantRequest, options }, + cancelAddParticipantOperationSpec + ); + } + /** * Get participant from a call. * @param callConnectionId The call connection Id @@ -485,6 +505,30 @@ const unmuteOperationSpec: coreClient.OperationSpec = { mediaType: "json", serializer }; +const cancelAddParticipantOperationSpec: coreClient.OperationSpec = { + path: + "/calling/callConnections/{callConnectionId}/participants:cancelAddParticipant", + httpMethod: "POST", + responses: { + 202: { + bodyMapper: Mappers.CancelAddParticipantResponse + }, + default: { + bodyMapper: Mappers.CommunicationErrorResponse + } + }, + requestBody: Parameters.cancelAddParticipantRequest, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.endpoint, Parameters.callConnectionId], + headerParameters: [ + Parameters.contentType, + Parameters.accept, + Parameters.repeatabilityRequestID, + Parameters.repeatabilityFirstSent + ], + mediaType: "json", + serializer +}; const getParticipantOperationSpec: coreClient.OperationSpec = { path: "/calling/callConnections/{callConnectionId}/participants/{participantRawId}", diff --git a/sdk/communication/communication-call-automation/src/generated/src/operationsInterfaces/callConnection.ts b/sdk/communication/communication-call-automation/src/generated/src/operationsInterfaces/callConnection.ts index 36ebaa0feb77..9f4d1b04a261 100644 --- a/sdk/communication/communication-call-automation/src/generated/src/operationsInterfaces/callConnection.ts +++ b/sdk/communication/communication-call-automation/src/generated/src/operationsInterfaces/callConnection.ts @@ -29,6 +29,9 @@ import { UnmuteParticipantsRequest, CallConnectionUnmuteOptionalParams, CallConnectionUnmuteResponse, + CancelAddParticipantRequest, + CallConnectionCancelAddParticipantOptionalParams, + CallConnectionCancelAddParticipantResponse, CallConnectionGetParticipantOptionalParams, CallConnectionGetParticipantResponse } from "../models"; @@ -37,7 +40,7 @@ import { /** Interface representing a CallConnection. */ export interface CallConnection { /** - * Get participants from a call. + * Get participants from a call. Recording and transcription bots are omitted from this list. * @param callConnectionId The call connection Id * @param options The options parameters. */ @@ -127,6 +130,17 @@ export interface CallConnection { unmuteParticipantsRequest: UnmuteParticipantsRequest, options?: CallConnectionUnmuteOptionalParams ): Promise; + /** + * Cancel add participant operation. + * @param callConnectionId The call connection Id + * @param cancelAddParticipantRequest Cancellation request. + * @param options The options parameters. + */ + cancelAddParticipant( + callConnectionId: string, + cancelAddParticipantRequest: CancelAddParticipantRequest, + options?: CallConnectionCancelAddParticipantOptionalParams + ): Promise; /** * Get participant from a call. * @param callConnectionId The call connection Id diff --git a/sdk/communication/communication-call-automation/src/models/events.ts b/sdk/communication/communication-call-automation/src/models/events.ts index 99c7df160440..64f9df4c3561 100644 --- a/sdk/communication/communication-call-automation/src/models/events.ts +++ b/sdk/communication/communication-call-automation/src/models/events.ts @@ -28,6 +28,8 @@ import { SendDtmfFailed as RestSendDtmfFailed, ToneInfo as RestToneInfo, Tone, + AddParticipantCancelled as RestAddParticipantCancelled, + CancelAddParticipantFailed as RestCancelAddParticipantFailed, } from "../generated/src/models"; import { CallParticipant } from "./models"; @@ -54,7 +56,9 @@ export type CallAutomationEvent = | ContinuousDtmfRecognitionToneFailed | ContinuousDtmfRecognitionStopped | SendDtmfCompleted - | SendDtmfFailed; + | SendDtmfFailed + | AddParticipantCancelled + | CancelAddParticipantFailed; export { RestAddParticipantSucceeded, @@ -80,6 +84,8 @@ export { RestSendDtmfCompleted, RestSendDtmfFailed, RestToneInfo, + RestAddParticipantCancelled, + RestCancelAddParticipantFailed, }; export interface ResultInformation @@ -486,3 +492,57 @@ export interface SendDtmfFailed /** kind of this event. */ kind: "SendDtmfFailed"; } + +/** The add participant cancelled event. */ +export interface AddParticipantCancelled + extends Omit< + RestAddParticipantCancelled, + | "callConnectionId" + | "serverCallId" + | "correlationId" + | "participant" + | "invitationId" + | "operationContext" + > { + /** Call connection ID. */ + callConnectionId: string; + /** Server call ID. */ + serverCallId: string; + /** Correlation ID for event to call correlation. Also called ChainId for skype chain ID. */ + correlationId: string; + /** Invitation ID used to cancel the add participant request. */ + invitationId: string; + /** Used by customers when calling mid-call actions to correlate the request to the response event. */ + operationContext?: string; + /** The participant whoose invitation was cancelled. */ + participant?: CommunicationIdentifier; + /** kind of this event. */ + kind: "AddParticipantCancelled"; +} + +/** The failed to cancel add participant event. */ +export interface CancelAddParticipantFailed + extends Omit< + RestCancelAddParticipantFailed, + | "callConnectionId" + | "serverCallId" + | "correlationId" + | "invitationId" + | "operationContext" + | "resultInformation" + > { + /** Call connection ID. */ + callConnectionId: string; + /** Server call ID. */ + serverCallId: string; + /** Correlation ID for event to call correlation. Also called ChainId for skype chain ID. */ + correlationId: string; + /** Invitation ID used to cancel the add participant request. */ + invitationId: string; + /** Used by customers when calling mid-call actions to correlate the request to the response event. */ + operationContext?: string; + /** Contains the resulting SIP code/sub-code and message from NGC services. */ + resultInformation?: ResultInformation; + /** kind of this event. */ + kind: "CancelAddParticipantFailed"; +} diff --git a/sdk/communication/communication-call-automation/src/models/options.ts b/sdk/communication/communication-call-automation/src/models/options.ts index 2ac8ac96365a..94f55a32d364 100644 --- a/sdk/communication/communication-call-automation/src/models/options.ts +++ b/sdk/communication/communication-call-automation/src/models/options.ts @@ -271,3 +271,11 @@ export interface SendDtmfOptions extends OperationOptions { /** Call back URI override for this request */ callbackUrl?: string; } + +/** Options for cancelling add participant request. */ +export interface CancelAddParticipantOptions extends OperationOptions { + /** The value to identify context of the operation. */ + operationContext?: string; + /** Call back URI override for this request */ + callbackUrl?: string; +} diff --git a/sdk/communication/communication-call-automation/src/models/responses.ts b/sdk/communication/communication-call-automation/src/models/responses.ts index a19c8f228351..a98327a7cc5f 100644 --- a/sdk/communication/communication-call-automation/src/models/responses.ts +++ b/sdk/communication/communication-call-automation/src/models/responses.ts @@ -39,6 +39,8 @@ export interface ListParticipantsResult { /** The response payload for adding participants to the call. */ export interface AddParticipantResult { + /** invitation ID used to add the participant. */ + invitationId?: string; /** List of current participants in the call. */ participant?: CallParticipant; /** The operation context provided by client. */ @@ -68,3 +70,11 @@ export interface RecordingStateResult { recordingId: string; recordingState: RecordingState; } + +/** The response payload for cancelling add participant request. */ +export interface CancelAddParticipantResult { + /** the invitation ID used to cancel the add participant request. */ + invitationId: string; + /** The operation context provided by client. */ + operationContext?: string; +} diff --git a/sdk/communication/communication-call-automation/swagger/README.md b/sdk/communication/communication-call-automation/swagger/README.md index 36a474936ffc..000c718dcf7c 100644 --- a/sdk/communication/communication-call-automation/swagger/README.md +++ b/sdk/communication/communication-call-automation/swagger/README.md @@ -12,7 +12,7 @@ generate-metadata: false license-header: MICROSOFT_MIT_NO_VERSION output-folder: ../src/generated tag: V2023-01-15-preview -input-file: https://github.com/williamzhao87/azure-rest-api-specs/blob/18fef29e753a6637d5639874ab20825003ae2077/specification/communication/data-plane/CallAutomation/preview/2023-01-15-preview/communicationservicescallautomation.json +input-file: https://github.com/williamzhao87/azure-rest-api-specs/blob/7b172efc00642d65e81aefbd7685bc356dac6759/specification/communication/data-plane/CallAutomation/preview/2023-01-15-preview/communicationservicescallautomation.json package-version: 1.0.0-beta.1 model-date-time-as-string: false optional-response-headers: true diff --git a/sdk/communication/communication-call-automation/test/callConnection.spec.ts b/sdk/communication/communication-call-automation/test/callConnection.spec.ts index 202b96cf90b7..0f924abe69f0 100644 --- a/sdk/communication/communication-call-automation/test/callConnection.spec.ts +++ b/sdk/communication/communication-call-automation/test/callConnection.spec.ts @@ -16,6 +16,7 @@ import { TransferCallResult, RemoveParticipantResult, MuteParticipantsResult, + CancelAddParticipantResult, } from "../src"; import Sinon, { SinonStubbedInstance } from "sinon"; import { CALL_TARGET_ID, CALL_TARGET_ID_2 } from "./utils/connectionUtils"; @@ -271,6 +272,26 @@ describe("CallConnection Unit Tests", () => { }) .catch((error) => console.error(error)); }); + + it("CancelAddParticipant", async () => { + const invitationId = "invitationId"; + const cancelAddParticipantResultMock: CancelAddParticipantResult = { invitationId }; + callConnection.cancelAddParticipant.returns( + new Promise((resolve) => { + resolve(cancelAddParticipantResultMock); + }) + ); + + callConnection + .cancelAddParticipant(invitationId) + .then((result: CancelAddParticipantResult) => { + assert.isNotNull(result); + assert.isTrue(callConnection.cancelAddParticipant.calledWith(invitationId)); + assert.equal(result, cancelAddParticipantResultMock); + return; + }) + .catch((error) => console.error(error)); + }); }); describe("CallConnection Live Tests", function () {