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

Added Beta4 audio streaming apis. #29418

Closed
Show file tree
Hide file tree
Changes from 2 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 @@ -54,6 +54,7 @@ export interface AddParticipantSucceeded extends Omit<RestAddParticipantSucceede
// @public
export interface AnswerCallOptions extends OperationOptions {
callIntelligenceOptions?: CallIntelligenceOptions;
mediaStreamingConfiguration?: MediaStreamingConfiguration;
operationContext?: string;
}

Expand Down Expand Up @@ -162,14 +163,17 @@ export type CallLocatorType = "serverCallLocator" | "groupCallLocator";
export class CallMedia {
constructor(callConnectionId: string, endpoint: string, credential: KeyCredential | TokenCredential, options?: CallAutomationApiClientOptionalParams);
cancelAllOperations(): Promise<void>;
mediaStreamingState(): Promise<MediaStreamingStateResponse>;
play(playSources: (FileSource | TextSource | SsmlSource)[], playTo: CommunicationIdentifier[], options?: PlayOptions): Promise<void>;
playToAll(playSources: (FileSource | TextSource | SsmlSource)[], options?: PlayOptions): Promise<void>;
sendDtmfTones(tones: Tone[] | DtmfTone[], targetParticipant: CommunicationIdentifier, options?: SendDtmfTonesOptions): Promise<SendDtmfTonesResult>;
startContinuousDtmfRecognition(targetParticipant: CommunicationIdentifier, options?: ContinuousDtmfRecognitionOptions): Promise<void>;
startMediaStreaming(options?: StartMediaStreamingOptions): Promise<void>;
// @deprecated
startRecognizing(targetParticipant: CommunicationIdentifier, maxTonesToCollect: number, options: CallMediaRecognizeDtmfOptions): Promise<void>;
startRecognizing(targetParticipant: CommunicationIdentifier, options: CallMediaRecognizeDtmfOptions | CallMediaRecognizeChoiceOptions | CallMediaRecognizeSpeechOptions | CallMediaRecognizeSpeechOrDtmfOptions): Promise<void>;
stopContinuousDtmfRecognition(targetParticipant: CommunicationIdentifier, options?: ContinuousDtmfRecognitionOptions): Promise<void>;
stopMediaStreaming(options?: StopMediaStreamingOptions): Promise<void>;
}

// @public
Expand Down Expand Up @@ -347,6 +351,7 @@ export interface ContinuousDtmfRecognitionToneReceived extends Omit<RestContinuo
// @public
export interface CreateCallOptions extends OperationOptions {
callIntelligenceOptions?: CallIntelligenceOptions;
mediaStreamingConfiguration?: MediaStreamingConfiguration;
operationContext?: string;
sourceCallIdNumber?: PhoneNumberIdentifier;
sourceDisplayName?: string;
Expand Down Expand Up @@ -429,6 +434,32 @@ export interface ListParticipantsResult {
values?: CallParticipant[];
}

// @public
export type MediaStreamingAudioChannelType = "mixed" | "unmixed";

// @public
export interface MediaStreamingConfiguration {
audioChannelType: MediaStreamingAudioChannelType;
contentType: MediaStreamingContentType;
startMediaStreaming?: boolean;
transportType: MediaStreamingTransportType;
transportUrl: string;
}

// @public
export type MediaStreamingContentType = "audio";

// @public
export interface MediaStreamingStateResponse {
// Warning: (ae-forgotten-export) The symbol "MediaStreamingState" needs to be exported by the entry point index.d.ts
mediaStreamingState?: MediaStreamingState;
// Warning: (ae-forgotten-export) The symbol "MediaStreamingType" needs to be exported by the entry point index.d.ts
mediaStreamingType?: MediaStreamingType;
}

// @public
export type MediaStreamingTransportType = "websocket";

// @public
export interface MuteParticipantOption extends OperationOptions {
operationContext?: string;
Expand Down Expand Up @@ -916,6 +947,12 @@ export interface SsmlSource extends PlaySource {
ssmlText: string;
}

// @public
export interface StartMediaStreamingOptions extends OperationOptions {
operationCallbackUri?: string;
operationContext?: string;
}

// @public
export interface StartRecordingOptions extends OperationOptions {
audioChannelParticipantOrdering?: CommunicationIdentifier[];
Expand All @@ -929,6 +966,11 @@ export interface StartRecordingOptions extends OperationOptions {
recordingStorage?: RecordingStorage;
}

// @public
export interface StopMediaStreamingOptions extends OperationOptions {
operationCallbackUri?: string;
}

// @public
export type StopRecordingOptions = OperationOptions;

Expand Down
Expand Up @@ -208,6 +208,7 @@ export class CallAutomationClient {
targetParticipant.sourceCallIdNumber,
),
sourceDisplayName: targetParticipant.sourceDisplayName,
mediaStreamingConfiguration: options.mediaStreamingConfiguration,
};

return this.createCallInternal(request, options);
Expand All @@ -232,6 +233,7 @@ export class CallAutomationClient {
callIntelligenceOptions: options.callIntelligenceOptions,
sourceCallerIdNumber: PhoneNumberIdentifierModelConverter(options.sourceCallIdNumber),
sourceDisplayName: options.sourceDisplayName,
mediaStreamingConfiguration: options.mediaStreamingConfiguration,
};

return this.createCallInternal(request, options);
Expand All @@ -248,13 +250,19 @@ export class CallAutomationClient {
callbackUrl: string,
options: AnswerCallOptions = {},
): Promise<AnswerCallResult> {
const { callIntelligenceOptions, operationContext, ...operationOptions } = options;
const {
callIntelligenceOptions,
operationContext,
mediaStreamingConfiguration,
...operationOptions
} = options;
const request: AnswerCallRequest = {
incomingCallContext,
callIntelligenceOptions,
operationContext,
callbackUri: callbackUrl,
answeredBy: this.sourceIdentity,
mediaStreamingConfiguration,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add test cases for media streaming configuration?

};
const optionsInternal = {
...operationOptions,
Expand Down
Expand Up @@ -18,6 +18,8 @@ import {
SendDtmfTonesRequest,
Tone,
SpeechOptions,
StartMediaStreamingRequest,
StopMediaStreamingRequest,
} from "./generated/src";

import { CallMediaImpl } from "./generated/src/operations";
Expand All @@ -38,9 +40,11 @@ import {
SendDtmfTonesOptions,
CallMediaRecognizeSpeechOptions,
CallMediaRecognizeSpeechOrDtmfOptions,
StartMediaStreamingOptions,
StopMediaStreamingOptions,
} from "./models/options";
import { KeyCredential, TokenCredential } from "@azure/core-auth";
import { SendDtmfTonesResult } from "./models/responses";
import { MediaStreamingStateResponse, SendDtmfTonesResult } from "./models/responses";
import { v4 as uuidv4 } from "uuid";

/**
Expand Down Expand Up @@ -415,4 +419,47 @@ export class CallMedia {
};
return sendDtmfTonesResult;
}

/**
* Starts media streaming in the call.
* @param options - Additional attributes for start media streaming.
*/
public async startMediaStreaming(options: StartMediaStreamingOptions = {}): Promise<void> {
const startMediaStreamingRequest: StartMediaStreamingRequest = {
operationContext: options.operationContext,
operationCallbackUri: options.operationCallbackUri,
};
return this.callMedia.startMediaStreaming(
this.callConnectionId,
startMediaStreamingRequest,
options,
);
}

/**
* Stops media streaming in the call.
* @param options - Additional attributes for stop media streaming.
*/
public async stopMediaStreaming(options: StopMediaStreamingOptions = {}): Promise<void> {
const stopMediaStreamingRequest: StopMediaStreamingRequest = {
operationCallbackUri: options.operationCallbackUri,
};
return this.callMedia.stopMediaStreaming(
this.callConnectionId,
stopMediaStreamingRequest,
options,
);
}

/**
* Gets media streaming state in the call.
*/
public async mediaStreamingState(): Promise<MediaStreamingStateResponse> {
const response = await this.callMedia.mediaStreamingState(this.callConnectionId, {});
const mediaStreamingStateResponse: MediaStreamingStateResponse = {
mediaStreamingState: response.mediaStreamingState,
mediaStreamingType: response.mediaStreamingType,
};
return mediaStreamingStateResponse;
}
}

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

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