Skip to content

Commit 691146f

Browse files
committed
Merge branch 'voice-talk-action'
2 parents 1e61020 + 1c584d1 commit 691146f

File tree

3 files changed

+72
-16
lines changed

3 files changed

+72
-16
lines changed

Vonage.Test/Voice/Data/TestTalk-request.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
"loop": "2",
77
"level": "0",
88
"language": "en-US",
9-
"style": 0
9+
"style": 0,
10+
"provider": "ElevenLabs",
11+
"providerOptions": {
12+
"test": "value",
13+
"foo": "bar"
14+
}
1015
}
1116
]

Vonage.Test/Voice/NccoTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,12 @@ public void TestTalk() =>
207207
Level = "0",
208208
Language = "en-US",
209209
Style = 0,
210+
Provider = TalkAction.TalkProvider.ElevenLabs,
211+
ProviderOptions = new Dictionary<string, string>
212+
{
213+
{"test", "value"},
214+
{"foo", "bar"},
215+
},
210216
});
211217

212218
[Fact]

Vonage/Voice/Nccos/TalkAction.cs

Lines changed: 60 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,65 @@
1-
using Newtonsoft.Json;
1+
#region
2+
using System.Collections.Generic;
3+
using System.Runtime.Serialization;
4+
using Newtonsoft.Json;
5+
using Newtonsoft.Json.Converters;
6+
#endregion
27

38
namespace Vonage.Voice.Nccos;
49

510
public class TalkAction : NccoAction
611
{
12+
/// <summary>
13+
/// </summary>
14+
public enum TalkProvider
15+
{
16+
/// <summary>
17+
/// </summary>
18+
[EnumMember(Value = "ElevenLabs")] ElevenLabs,
19+
20+
/// <summary>
21+
/// </summary>
22+
[EnumMember(Value = "Google")] Google,
23+
24+
/// <summary>
25+
/// </summary>
26+
[EnumMember(Value = "Polly")] Polly,
27+
}
28+
729
[JsonProperty("action", Order = 0)] public override ActionType Action => ActionType.Talk;
830

931
/// <summary>
10-
/// Set to true so this action is terminated when the user presses a button on the keypad.
11-
/// Use this feature to enable users to choose an option without having to listen to the whole message
12-
/// in your Interactive Voice Response (IVR ). If you set bargeIn to true on one more Stream actions then
13-
/// the next non-stream action in the NCCO stack must be an input action. The default value is false.
14-
/// Once bargeIn is set to true it will stay true (even if bargeIn: false is set in a following action)
15-
/// until an input action is encountered
32+
/// Set to true so this action is terminated when the user presses a button on the keypad.
33+
/// Use this feature to enable users to choose an option without having to listen to the whole message
34+
/// in your Interactive Voice Response (IVR ). If you set bargeIn to true on one more Stream actions then
35+
/// the next non-stream action in the NCCO stack must be an input action. The default value is false.
36+
/// Once bargeIn is set to true it will stay true (even if bargeIn: false is set in a following action)
37+
/// until an input action is encountered
1638
/// </summary>
1739
[JsonProperty("bargeIn", Order = 2)]
1840
public bool BargeIn { get; set; }
1941

2042
/// <summary>
21-
/// The language (<see href="https://tools.ietf.org/html/bcp47">BCP-47</see>format) for the message you are sending. Default: en-US. Possible values are listed in the <see href="https://developer.nexmo.com/voice/voice-api/guides/text-to-speech#supported-languages">Text-To-Speech guide</see>.
43+
/// The language (<see href="https://tools.ietf.org/html/bcp47">BCP-47</see>format) for the message you are sending.
44+
/// Default: en-US. Possible values are listed in the
45+
/// <see href="https://developer.nexmo.com/voice/voice-api/guides/text-to-speech#supported-languages">
46+
/// Text-To-Speech
47+
/// guide
48+
/// </see>
49+
/// .
2250
/// </summary>
2351
[JsonProperty("language", Order = 6)]
2452
public string Language { get; set; }
2553

2654
/// <summary>
27-
/// The volume level that the speech is played. This can be any value between -1 to 1 with 0 being the default.
55+
/// The volume level that the speech is played. This can be any value between -1 to 1 with 0 being the default.
2856
/// </summary>
2957
[JsonProperty("level", Order = 4)]
3058
public string Level { get; set; }
3159

3260
/// <summary>
33-
/// The number of times text is repeated before the Call is closed. The default value is 1. Set to 0 to loop infinitely.
61+
/// The number of times text is repeated before the Call is closed. The default value is 1. Set to 0 to loop
62+
/// infinitely.
3463
/// </summary>
3564
[JsonProperty("loop", Order = 3)]
3665
public string Loop { get; set; }
@@ -43,17 +72,33 @@ public class TalkAction : NccoAction
4372
public bool Premium { get; set; }
4473

4574
/// <summary>
46-
/// The vocal style (vocal range, tessitura and timbre). Default: 0. Possible values are listed in the <see href="https://developer.nexmo.com/voice/voice-api/guides/text-to-speech#supported-languages">Text-To-Speech guide</see>.
75+
/// The vocal style (vocal range, tessitura and timbre). Default: 0. Possible values are listed in the
76+
/// <see href="https://developer.nexmo.com/voice/voice-api/guides/text-to-speech#supported-languages">
77+
/// Text-To-Speech
78+
/// guide
79+
/// </see>
80+
/// .
4781
/// </summary>
4882
[JsonProperty("style", Order = 7)]
4983
public int? Style { get; set; }
5084

5185
/// <summary>
52-
/// A string of up to 1,500 characters (excluding SSML tags) containing the message to be
53-
/// synthesized in the Call or Conversation. A single comma in text adds a short pause to the
54-
/// synthesized speech. To add a longer pause a break tag needs to be used in SSML.
55-
/// To use SSML tags, you must enclose the text in a speak element.
86+
/// A string of up to 1,500 characters (excluding SSML tags) containing the message to be
87+
/// synthesized in the Call or Conversation. A single comma in text adds a short pause to the
88+
/// synthesized speech. To add a longer pause a break tag needs to be used in SSML.
89+
/// To use SSML tags, you must enclose the text in a speak element.
5690
/// </summary>
5791
[JsonProperty("text", Order = 1)]
5892
public string Text { get; set; }
93+
94+
/// <summary>
95+
/// </summary>
96+
[JsonProperty("provider", Order = 9)]
97+
[JsonConverter(typeof(StringEnumConverter))]
98+
public TalkProvider? Provider { get; set; }
99+
100+
/// <summary>
101+
/// </summary>
102+
[JsonProperty("providerOptions", Order = 10)]
103+
public Dictionary<string, string> ProviderOptions { get; set; }
59104
}

0 commit comments

Comments
 (0)