Skip to content

Commit

Permalink
[Call Automation] Adding custom models for Play/Recognize (Azure#26406)
Browse files Browse the repository at this point in the history
### Packages impacted by this PR


### Issues associated with this PR


### Describe the problem that is addressed by this PR


### What are the possible designs available to address the problem? If
there are more than one possible design, why was the one in this PR
chosen?


### Are there test cases added in this PR? _(If not, why?)_


### Provide a list of related PRs _(if any)_


### Command used to generate this PR:**_(Applicable only to SDK release
request PRs)_

### Checklists
- [ ] Added impacted package name to the issue description
- [ ] Does this PR needs any fixes in the SDK Generator?** _(If so,
create an Issue in the
[Autorest/typescript](https://github.com/Azure/autorest.typescript)
repository and link it here)_
- [ ] Added a changelog (if necessary)
  • Loading branch information
cochi2 authored Jul 8, 2023
1 parent 2097891 commit 98baa3a
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 13 deletions.
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

0 comments on commit 98baa3a

Please sign in to comment.