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

[Call Automation] Adding custom models for Play/Recognize #26406

Merged
merged 6 commits into from
Jul 8, 2023
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
22 changes: 9 additions & 13 deletions common/config/rush/pnpm-lock.yaml

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

Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"@azure/core-rest-pipeline": "^1.3.0",
"@azure/core-tracing": "^1.0.0",
"@azure/logger": "^1.0.0",
"esm": "^3.2.25",
"events": "^3.0.0",
"tslib": "^2.2.0",
"uuid": "^8.3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ export interface CallMediaRecognizeOptions extends OperationOptions {
// (undocumented)
playPrompt?: FileSource | TextSource | SsmlSource;
// (undocumented)
speechModelEndpointId?: string;
// (undocumented)
stopCurrentOperations?: boolean;
}

Expand Down Expand Up @@ -856,6 +858,8 @@ export interface SendDtmfOptions extends OperationOptions {

// @public
export interface SsmlSource extends PlaySource {
// (undocumented)
customVoiceEndpointId?: string;
// (undocumented)
readonly kind: "ssmlSource";
// (undocumented)
Expand All @@ -878,6 +882,8 @@ export type StopRecordingOptions = OperationOptions;

// @public
export interface TextSource extends PlaySource {
// (undocumented)
customVoiceEndpointId?: string;
// (undocumented)
readonly kind: "textSource";
// (undocumented)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export class CallMedia {
sourceLocale: playSource.sourceLocale,
voiceGender: playSource.voiceGender,
voiceName: playSource.voiceName,
customVoiceEndpointId: playSource.customVoiceEndpointId,
};
return {
sourceType: KnownPlaySourceType.Text,
Expand All @@ -88,6 +89,7 @@ export class CallMedia {
} else if (playSource.kind === "ssmlSource") {
const ssmlSource: SsmlSourceInternal = {
ssmlText: playSource.ssmlText,
customVoiceEndpointId: playSource.customVoiceEndpointId,
};
return {
sourceType: KnownPlaySourceType.Ssml,
Expand Down Expand Up @@ -215,6 +217,7 @@ export class CallMedia {
: 5,
targetParticipant: serializeCommunicationIdentifier(targetParticipant),
speechOptions: speechOptions,
speechRecognitionModelEndpointId: recognizeOptions.speechModelEndpointId,
};
return {
recognizeInputType: KnownRecognizeInputType.Speech,
Expand Down Expand Up @@ -246,6 +249,7 @@ export class CallMedia {
targetParticipant: serializeCommunicationIdentifier(targetParticipant),
speechOptions: speechOptions,
dtmfOptions: dtmfOptionsInternal,
speechRecognitionModelEndpointId: recognizeOptions.speechModelEndpointId,
};
return {
recognizeInputType: KnownRecognizeInputType.SpeechOrDtmf,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ export interface TextSource extends PlaySource {
sourceLocale?: string;
voiceGender?: Gender;
voiceName?: string;
customVoiceEndpointId?: string;
readonly kind: "textSource";
}

/** The SsmlSource model. */
export interface SsmlSource extends PlaySource {
ssmlText: string;
customVoiceEndpointId?: string;
readonly kind: "ssmlSource";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface CallMediaRecognizeOptions extends OperationOptions {
operationContext?: string;
interruptPrompt?: boolean;
initialSilenceTimeoutInSeconds?: number;
speechModelEndpointId?: string;
}

/** The recognize configuration specific to Dtmf. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ describe("CallMedia Unit Tests", async function () {

const playSource: TextSource = {
text: "test test test",
customVoiceEndpointId: "customVoiceEndpointId",
kind: "textSource",
};

Expand All @@ -121,6 +122,7 @@ describe("CallMedia Unit Tests", async function () {
const playSource: SsmlSource = {
ssmlText:
'<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US"><voice name="en-US-JennyNeural">Recognize Choice Completed, played through SSML source.</voice></speak>',
customVoiceEndpointId: "customVoiceEndpointId",
kind: "ssmlSource",
};

Expand Down Expand Up @@ -211,6 +213,7 @@ describe("CallMedia Unit Tests", async function () {
const targetParticipant: CommunicationIdentifier = { communicationUserId: CALL_TARGET_ID };
const recognizeOptions: CallMediaRecognizeSpeechOptions = {
kind: "callMediaRecognizeSpeechOptions",
speechModelEndpointId: "customModelEndpointId",
};
const maxTonesToCollect = 5;

Expand Down