Dillo.Voice
1.9.0
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
.NET Framework 4.5
This package targets .NET Framework 4.5. The package is compatible with this framework or higher.
dotnet add package Dillo.Voice --version 1.9.0
NuGet\Install-Package Dillo.Voice -Version 1.9.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Dillo.Voice" Version="1.9.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Dillo.Voice --version 1.9.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Dillo.Voice, 1.9.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Dillo.Voice as a Cake Addin #addin nuget:?package=Dillo.Voice&version=1.9.0 // Install Dillo.Voice as a Cake Tool #tool nuget:?package=Dillo.Voice&version=1.9.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Description
Use the Dillo.Voice library to:
- create complex channel behaviors for the Voice channel (inbound and outbound)
- create outbound voice requests and send http requests to the Dillo API
Sample Usage
Channel behavior
Sample #1
The sample code below creates a channel behavior that contains 2 Say actions and 1 Collect action.
ChannelBehaviorBuilder channelBehaviorBuilder = new ChannelBehaviorBuilder()
.Say(text: "Hello! Please enter your subscriber code followed by # after the beep.", voice: StandardVoices.EnglishBritishFemaleAmy)
.Collect(finishOnKey: "#", timeout: 20, playBeep: true)
.Say(text: "Your request will be processed. Goodbye!", voice: StandardVoices.EnglishBritishFemaleAmy);
var nodes = channelBehaviorBuilder.Build();
The result is:
{
"0": {
"ActionType": "Say",
"ChannelBehaviorAction": {
"Text": "Hello! Please enter your subscriber code followed by # after the beep.",
"LanguageCode": "en-GB",
"VoiceId": "Amy"
},
"NextNode": 1
},
"1": {
"ActionType": "Collect",
"ChannelBehaviorAction": {
"Timeout": 20,
"NumberOfDigits": 0,
"FinishOnKey": "#",
"PlayBeep": true
},
"NextNode": 2
},
"2": {
"ActionType": "Say",
"ChannelBehaviorAction": {
"Text": "Your request will be processed. Goodbye!",
"LanguageCode": "en-GB",
"VoiceId": "Amy"
}
}
}
Sample #2
The sample code below shows you how to create an IVR.
MenuBuilder menuBuilder = new MenuBuilder(timeout: 10)
.SetIntro(text: "For Sales, press 1. For Technical Support, press 2. To speak with an operator, press 3.", StandardVoices.EnglishUSMaleMatthew)
.AddDigit("1", ActionBuilder.Say(text: "You pressed 1 and chose Sales.", voice: StandardVoices.EnglishUSMaleMatthew))
.AddDigit("2", ActionBuilder.Say(text: "You pressed 2 and chose Technical Support.", voice: StandardVoices.EnglishUSMaleMatthew))
.AddDigit("3", new ChannelBehaviorBuilder()
.Say(text: "You pressed 3. Please wait until an operator answers.", voice: StandardVoices.EnglishUSMaleMatthew)
.Dial(telephoneNumber: "+40740xxxxxx", record: true, transcribe: true, languageCode: LanguageCode.en_US)
)
.RepeatOnNoDigit()
.RepeatOnWrongDigit();
ChannelBehaviorBuilder channelBehaviorBuilder = new ChannelBehaviorBuilder()
.Say(text: "Hello and thank you for calling Company X.", StandardVoices.EnglishUSMaleMatthew)
.Menu(menuBuilder);
var nodes = channelBehaviorBuilder.Build();
The result is:
{
"0": {
"ActionType": "Say",
"ChannelBehaviorAction": {
"Text": "Hello and thank you for calling Company X.",
"LanguageCode": "en-US",
"VoiceId": "Matthew"
},
"NextNode": 1
},
"1": {
"ActionType": "Say",
"ChannelBehaviorAction": {
"Text": "For Sales, press 1. For Technical Support, press 2. To speak with an operator, press 3.",
"LanguageCode": "en-US",
"VoiceId": "Matthew"
},
"NextNode": 2
},
"2": {
"ActionType": "Menu",
"ChannelBehaviorAction": {
"Digits": {
"1": {
"NextNode": 3
},
"2": {
"NextNode": 4
},
"3": {
"NextNode": 5
},
"NoDigit": {
"NextNode": 1
},
"WrongDigit": {
"NextNode": 1
}
},
"Timeout": 10
}
},
"3": {
"ActionType": "Say",
"ChannelBehaviorAction": {
"Text": "You pressed 1 and chose Sales.",
"LanguageCode": "en-US",
"VoiceId": "Matthew"
}
},
"4": {
"ActionType": "Say",
"ChannelBehaviorAction": {
"Text": "You pressed 2 and chose Technical Support.",
"LanguageCode": "en-US",
"VoiceId": "Matthew"
}
},
"5": {
"ActionType": "Say",
"ChannelBehaviorAction": {
"Text": "You pressed 3. Please wait until an operator answers.",
"LanguageCode": "en-US",
"VoiceId": "Matthew"
},
"NextNode": 6
},
"6": {
"ActionType": "Dial",
"ChannelBehaviorAction": {
"TelephoneNumber": "+40740xxxxxx",
"Record": true,
"Transcribe": true,
"LanguageCode": "en-US"
}
}
}
Outbound voice requests
The sample code below shows you how to create an outbound voice request that contains a Record action for which an email will be sent at the end of the voice call (when the transcript is ready).
ChannelBehaviorBuilder channelBehaviorBuilder = new ChannelBehaviorBuilder()
.Say(
text: "Hello and thank you for calling Company X. Please specify the date and time to schedule an appointment after the beep. Press any key to finish.",
voice: NeuralVoices.EnglishUSFemaleAria
)
.Record(
maxLength: 15,
stopOnKey: "any",
playBeep: true,
timeout: 4,
storagePeriod: RecordingStoragePeriod.SixMonths,
externalActionLabel: "send_email",
transcribe: true,
languageCode: LanguageCode.en_US
)
.Say(
text: "You will be contacted by a company representative as soon as possible for confirmation. Goodbye!",
voice: NeuralVoices.EnglishUSFemaleAria
);
OutboundVoiceRequestBuilder outboundRequestBuilder = new OutboundVoiceRequestBuilder(
sender: "+40740000000",
telephoneNumber: "+40740111111"
)
.SetChannelBehavior(channelBehaviorBuilder)
.AddExternalActionEmail(
label: "send_email",
destination: "office@companyx.com",
sender: "noreply@companyx.com",
content: "<div>Telephone number: +40740111111</div> <div>According to the <a href='{RecordingUrl}' target='_blank'>audio recording</a>, a new appointment has been scheduled for {RecordingTranscription}.</div>",
subject: "A new appointment has been scheduled.",
senderDisplayName: "Appointments - Company X"
);
OutboundVoiceRequest outboundVoiceRequest = outboundRequestBuilder.Build();
The resulting outbound voice request is:
{
"SendActionType": "Voice",
"MessagePayload": "{\"Sender\":\"+40740000000\",\"TelephoneNumber\":\"+40740111111\",\"Record\":false,\"Transcribe\":false,\"ChannelBehavior\":{\"ChannelBehaviorNodes\":{\"0\":{\"ActionType\":\"Say\",\"ChannelBehaviorAction\":{\"Text\":\"Hello and thank you for calling Company X. Please specify the date and time to schedule an appointment after the beep. Press any key to finish.\",\"LanguageCode\":\"en-US\",\"VoiceId\":\"en-US-AriaNeural\"},\"NextNode\":1},\"1\":{\"ActionType\":\"Record\",\"ChannelBehaviorAction\":{\"Timeout\":4,\"StopOnKey\":\"any\",\"MaxLength\":15,\"PlayBeep\":true,\"ExternalActionLabel\":\"send_email\",\"RecordingStoragePeriodCode\":\"6-M\",\"Transcribe\":true,\"LanguageCode\":\"en-US\"},\"NextNode\":2},\"2\":{\"ActionType\":\"Say\",\"ChannelBehaviorAction\":{\"Text\":\"You will be contacted by a company representative as soon as possible for confirmation. Goodbye!\",\"LanguageCode\":\"en-US\",\"VoiceId\":\"en-US-AriaNeural\"}}}},\"ExternalActions\":[{\"SendActionType\":\"Email\",\"Label\":\"send_email\",\"Action\":{\"SenderDisplayName\":\"Appointments - Company X\",\"Subject\":\"A new appointment has been scheduled.\",\"Sender\":\"noreply@companyx.com\",\"Destination\":\"office@companyx.com\",\"Content\":\"<div>Telephone number: +40740111111</div> <div>According to the <a href='{RecordingUrl}' target='_blank'>audio recording</a>, a new appointment has been scheduled for {RecordingTranscription}.</div>\"}}]}"
}
Http POST Request
OutboundVoicePostResponse postResponse = await outboundVoiceRequest.SendAsync();
Http GET Request
OutboundVoiceGetResponse getResponse = await postResponse.GetAsync();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 is compatible. net461 was computed. net462 was computed. net463 was computed. net47 is compatible. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.5
- Newtonsoft.Json (>= 12.0.3)
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.6
- Newtonsoft.Json (>= 12.0.3)
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.7
- Newtonsoft.Json (>= 12.0.3)
- System.ValueTuple (>= 4.5.0)
-
.NETStandard 2.0
- Newtonsoft.Json (>= 12.0.3)
- System.ValueTuple (>= 4.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.