Skip to content

Commit 3557e02

Browse files
authored
Add speech property to recognize option (Azure#34517)
* Add speech property to recognize option 1. Add speech property to recognize with choice only 2. Add 3 new reason code 3. Update the swagger to newest one. * update netstandard for callautomation
1 parent 3e98db4 commit 3557e02

11 files changed

+34
-13
lines changed

sdk/communication/Azure.Communication.CallAutomation/api/Azure.Communication.CallAutomation.netstandard2.0.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ public partial class CallMediaRecognizeChoiceOptions : Azure.Communication.CallA
288288
{
289289
public CallMediaRecognizeChoiceOptions(Azure.Communication.CommunicationIdentifier targetParticipant, System.Collections.Generic.List<Azure.Communication.CallAutomation.RecognizeChoice> recognizeChoices) : base (default(Azure.Communication.CallAutomation.RecognizeInputType), default(Azure.Communication.CommunicationIdentifier)) { }
290290
public System.Collections.Generic.IList<Azure.Communication.CallAutomation.RecognizeChoice> RecognizeChoices { get { throw null; } }
291+
public string SpeechLanguage { get { throw null; } set { } }
291292
}
292293
public partial class CallMediaRecognizeDtmfOptions : Azure.Communication.CallAutomation.CallMediaRecognizeOptions
293294
{
@@ -683,6 +684,7 @@ protected PlaySource() { }
683684
private readonly int _dummyPrimitive;
684685
public ReasonCode(string value) { throw null; }
685686
public static Azure.Communication.CallAutomation.ReasonCode CompletedSuccessfully { get { throw null; } }
687+
public static Azure.Communication.CallAutomation.ReasonCode PlayCognitiveServicesPlayError { get { throw null; } }
686688
public static Azure.Communication.CallAutomation.ReasonCode PlayDownloadFailed { get { throw null; } }
687689
public static Azure.Communication.CallAutomation.ReasonCode PlayInvalidFileFormat { get { throw null; } }
688690
public static Azure.Communication.CallAutomation.ReasonCode RecognizeDtmfOptionMatched { get { throw null; } }
@@ -691,8 +693,10 @@ protected PlaySource() { }
691693
public static Azure.Communication.CallAutomation.ReasonCode RecognizeInterDigitTimedOut { get { throw null; } }
692694
public static Azure.Communication.CallAutomation.ReasonCode RecognizeMaxDigitsReceived { get { throw null; } }
693695
public static Azure.Communication.CallAutomation.ReasonCode RecognizePlayPromptFailed { get { throw null; } }
696+
public static Azure.Communication.CallAutomation.ReasonCode RecognizeSpeechNotRecognized { get { throw null; } }
694697
public static Azure.Communication.CallAutomation.ReasonCode RecognizeSpeechOptionMatched { get { throw null; } }
695698
public static Azure.Communication.CallAutomation.ReasonCode RecognizeSpeechOptionNotMatched { get { throw null; } }
699+
public static Azure.Communication.CallAutomation.ReasonCode RecognizeSpeechServiceConnectionError { get { throw null; } }
696700
public static Azure.Communication.CallAutomation.ReasonCode RecognizeStopToneDetected { get { throw null; } }
697701
public static Azure.Communication.CallAutomation.ReasonCode UnspecifiedError { get { throw null; } }
698702
public bool Equals(Azure.Communication.CallAutomation.ReasonCode other) { throw null; }

sdk/communication/Azure.Communication.CallAutomation/src/CallConnection.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,6 @@ private static TransferToParticipantRequestInternal CreateTransferToParticipantR
294294
{
295295
TransferToParticipantRequestInternal request = new TransferToParticipantRequestInternal(CommunicationIdentifierSerializer.Serialize(options.CallInvite.Target));
296296

297-
request.TransfereeCallerId = options.CallInvite.SourceCallerIdNumber == null ? null : new PhoneNumberIdentifierModel(options.CallInvite.SourceCallerIdNumber.PhoneNumber);
298-
299297
request.CustomContext = new CustomContextInternal(
300298
options.CallInvite.SipHeaders == null ? new ChangeTrackingDictionary<string, string>() : options.CallInvite.SipHeaders,
301299
options.CallInvite.VoipHeaders == null ? new ChangeTrackingDictionary<string, string>() : options.CallInvite.VoipHeaders);

sdk/communication/Azure.Communication.CallAutomation/src/CallMedia.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,11 @@ private static RecognizeRequestInternal CreateRecognizeRequest(CallMediaRecogniz
317317
recognizeChoiceOptions.RecognizeChoices
318318
.ToList().ForEach(t => recognizeConfigurationsInternal.Choices.Add(t));
319319

320+
if (!String.IsNullOrEmpty(recognizeChoiceOptions.SpeechLanguage))
321+
{
322+
recognizeConfigurationsInternal.SpeechLanguage = recognizeChoiceOptions.SpeechLanguage;
323+
}
324+
320325
RecognizeRequestInternal request = new RecognizeRequestInternal(recognizeChoiceOptions.InputType, recognizeConfigurationsInternal);
321326

322327
request.PlayPrompt = TranslatePlaySourceToInternal(recognizeChoiceOptions.Prompt);

sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeOptionsInternal.Serialization.cs

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeOptionsInternal.cs

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.Serialization.cs

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.cs

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/communication/Azure.Communication.CallAutomation/src/Models/CallMediaRecognizeChoiceOptions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,8 @@ public CallMediaRecognizeChoiceOptions(CommunicationIdentifier targetParticipant
2121
/// The IvR choices for recognize
2222
/// </summary>
2323
public IList<RecognizeChoice> RecognizeChoices { get; }
24+
25+
/// <summary> Speech language to be recognized, If not set default is en-US. </summary>
26+
public string SpeechLanguage { get; set; }
2427
}
2528
}

sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/ReasonCode.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@ public ReasonCode(string value)
3030
private const string RecognizeStopToneDetectedValue = "8514";
3131
private const string RecognizeSpeechOptionMatchedValue = "8545";
3232
private const string RecognizeSpeechOptionNotMatchedValue = "8547";
33+
private const string RecognizeSpeechNotRecognizedValue = "8563";
34+
private const string RecognizeSpeechServiceConnectionErrorValue = "8564";
3335

3436
private const string PlayDownloadFailedValue = "8536";
3537
private const string PlayInvalidFileFormatValue = "8535";
38+
private const string PlayCognitiveServicesPlayErrorValue = "8565";
3639

3740
private const string CompletedSuccessfullyValue = "0";
3841
private const string UnspecifiedErrorValue = "9999";
@@ -51,17 +54,24 @@ public ReasonCode(string value)
5154

5255
/// <summary> Action failed, play source not working. </summary>
5356
public static ReasonCode RecognizeDtmfOptionMatched { get; } = new ReasonCode(RecognizeDtmfOptionMatchedValue);
54-
/// <summary> Speeach option matched. </summary>
57+
/// <summary> Speech option matched. </summary>
5558
public static ReasonCode RecognizeSpeechOptionMatched { get; } = new ReasonCode(RecognizeSpeechOptionMatchedValue);
56-
/// <summary> Speeach option not matched. </summary>
59+
/// <summary> Speech option not matched. </summary>
5760
public static ReasonCode RecognizeSpeechOptionNotMatched { get; } = new ReasonCode(RecognizeSpeechOptionNotMatchedValue);
5861
/// <summary> Recognize with Choice that incorrect tone detected. </summary>
5962
public static ReasonCode RecognizeIncorrectToneDetected { get; } = new ReasonCode(RecognizeIncorrectToneDetectedValue);
6063

64+
/// <summary> Speech not recognized. </summary>
65+
public static ReasonCode RecognizeSpeechNotRecognized { get; } = new ReasonCode(RecognizeSpeechNotRecognizedValue);
66+
/// <summary> Speech service connection error. </summary>
67+
public static ReasonCode RecognizeSpeechServiceConnectionError { get; } = new ReasonCode(RecognizeSpeechServiceConnectionErrorValue);
68+
6169
/// <summary> Action failed, file could not be downloaded. </summary>
6270
public static ReasonCode PlayDownloadFailed { get; } = new ReasonCode(PlayDownloadFailedValue);
6371
/// <summary> Action failed, file could not be downloaded. </summary>
6472
public static ReasonCode PlayInvalidFileFormat { get; } = new ReasonCode(PlayInvalidFileFormatValue);
73+
/// <summary> Action failed, cognitive service error. </summary>
74+
public static ReasonCode PlayCognitiveServicesPlayError { get; } = new ReasonCode(PlayCognitiveServicesPlayErrorValue);
6575

6676
/// <summary> Action completed successfully. </summary>
6777
public static ReasonCode CompletedSuccessfully { get; } = new ReasonCode (CompletedSuccessfullyValue);

sdk/communication/Azure.Communication.CallAutomation/src/autorest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ tag: package-2023-01-15-preview
1010
model-namespace: false
1111

1212
require:
13-
- https://github.com/williamzhao87/azure-rest-api-specs/blob/0d0cd5af40aa17af76ce0307ac5512351c38e3bc/specification/communication/data-plane/CallAutomation/readme.md
13+
- https://github.com/williamzhao87/azure-rest-api-specs/blob/becaba47bb961445fa2f8ab55b0ed199b391d179/specification/communication/data-plane/CallAutomation/readme.md
1414
title: Azure Communication Services
1515

1616
generation1-convenience-client: true

0 commit comments

Comments
 (0)