Dillo.Voice 1.6.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Dillo.Voice --version 1.6.0                
NuGet\Install-Package Dillo.Voice -Version 1.6.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.6.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Dillo.Voice --version 1.6.0                
#r "nuget: Dillo.Voice, 1.6.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.6.0

// Install Dillo.Voice as a Cake Tool
#tool nuget:?package=Dillo.Voice&version=1.6.0                

Description

Use the Dillo.Voice library to:

  1. create complex channel behaviors for the Voice channel (inbound and outbound)
  2. 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 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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.9.0 612 2/1/2022
1.8.0 491 2/1/2022
1.7.1 518 1/11/2022
1.7.0 317 1/6/2022
1.6.0 412 11/11/2021
1.5.0 433 6/17/2021
1.4.0 437 3/25/2021
1.3.0 428 2/5/2021
1.2.0 476 12/14/2020
1.1.1 543 9/7/2020
1.1.0 538 7/27/2020
1.0.1 522 7/22/2020
1.0.0 517 7/21/2020