Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Core/Resgrid.Config/TtsConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static class TtsConfig
public static int S3PresignedUrlExpiryMinutes = 60;
public static string S3PublicBaseUrl = "";

public static string DefaultVoice = "en-us+f3";
public static string DefaultVoice = "en-us+klatt6";
public static int DefaultSpeed = 175;
public static int MaxConcurrentGenerations = 4;
public static int MaxTextLength = 1000;
Expand Down
18 changes: 11 additions & 7 deletions Core/Resgrid.Model/EspeakVoiceCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public static class EspeakVoiceCatalog
new TtsVoiceOption("da", "Danish"),
new TtsVoiceOption("nl", "Dutch"),
new TtsVoiceOption("en-us", "English", "American"),
new TtsVoiceOption("en-us+f3", "English", "American Female 3"),
new TtsVoiceOption("en", "English", "British"),
new TtsVoiceOption("en-029", "English", "Caribbean"),
new TtsVoiceOption("en-gb-x-gbclan", "English", "Lancastrian"),
Expand Down Expand Up @@ -141,18 +140,15 @@ public static class EspeakVoiceCatalog

private static readonly Dictionary<string, TtsVoiceOption> VoiceLookup = VoicesInternal.ToDictionary(x => x.Identifier, StringComparer.OrdinalIgnoreCase);

public const string DefaultIdentifier = "en-us+f3";
public const string DefaultIdentifier = "en-us";

public static IReadOnlyList<TtsVoiceOption> Voices => VoicesInternal;

public static bool TryNormalizeIdentifier(string voice, out string normalizedVoice)
{
normalizedVoice = null;

if (string.IsNullOrWhiteSpace(voice))
return false;

if (!VoiceLookup.TryGetValue(voice.Trim(), out var option))
if (!TryGetOption(voice, out var option))
return false;

normalizedVoice = option.Identifier;
Expand All @@ -174,7 +170,15 @@ public static bool TryGetOption(string voice, out TtsVoiceOption option)
if (string.IsNullOrWhiteSpace(voice))
return false;

return VoiceLookup.TryGetValue(voice.Trim(), out option);
var normalizedVoice = GetBaseIdentifier(voice);
return VoiceLookup.TryGetValue(normalizedVoice, out option);
}

private static string GetBaseIdentifier(string voice)
{
var trimmedVoice = voice.Trim();
var variantSeparatorIndex = trimmedVoice.IndexOf('+');
return variantSeparatorIndex <= 0 ? trimmedVoice : trimmedVoice[..variantSeparatorIndex];
}
}

Expand Down
2 changes: 1 addition & 1 deletion Core/Resgrid.Model/Resgrid.Model.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="9.0.0" />
<PackageReference Include="GeoJSON.Net" Version="1.4.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.3.1" />
<PackageReference Include="MimeKit" Version="4.11.0" />
<PackageReference Include="MimeKit" Version="4.16.0" />
<PackageReference Include="MongoDB.Driver" Version="3.2.1" />
<PackageReference Include="protobuf-net" Version="3.2.46" />
<PackageReference Include="Stripe.net" Version="47.4.0" />
Expand Down
36 changes: 23 additions & 13 deletions Core/Resgrid.Model/TwilioVoicePromptCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ namespace Resgrid.Model
public static class TwilioVoicePromptCatalog
{
public const string CallClosed = "This call has been closed. Goodbye.";
public const string RespondingToScene = "You have been marked responding to the scene, goodbye.";
public const string RespondingToScene = "You have been marked responding to the scene. Goodbye.";
public const string InvalidSelection = "Sorry, that was not a valid selection.";
public const string VerificationGreeting = "Hello, this is Resgrid calling with your verification code.";
public const string VerificationClosing = "That was your Resgrid verification code. Goodbye.";
public const string InboundVoiceUnavailable = "Thank you for calling Resgrid, automated personnel system. The number you called is not tied to an active department or the department doesn't have this feature enabled. Goodbye.";
public const string InboundVoiceUnavailable = "Thank you for calling the Resgrid automated personnel system. The number you called is not tied to an active department, or the department doesn't have this feature enabled. Goodbye.";
public const string VoiceVerificationFailure = "We couldn't complete your verification call. Please request a new code and try again. Goodbye.";
public const string MainMenuSelectionIntro = "Please select from the following options.";
public const string MainMenuActiveCalls = "To list current active calls, press 1.";
Expand All @@ -20,30 +20,36 @@ public static class TwilioVoicePromptCatalog
public const string MainMenuSetStatus = "To set your current status, press 6.";
public const string MainMenuSetStaffing = "To set your current staffing level, press 7.";
public const string RepeatAndRespondToScene = "Press 0 to repeat. Press 1 to respond to the scene.";
public const string OutboundDispatchMenu = "To hear the dispatch again, press 1. To hear response options, press 2.";
public const string OutboundResponseSelectionIntro = "To choose a response option, enter the option number, then press pound.";
public const string RepeatDispatchWithPound = "To hear the dispatch again, enter 0 and press pound.";
public const string GoBackToMainMenu = "Press 0 to go back to the main menu.";
public const string StatusSelectionIntro = "To set your current status, please select from the following options.";
public const string StaffingSelectionIntro = "To set your current staffing, please select from the following options.";
public const string InvalidStatusSelection = "Invalid status selection, goodbye.";
public const string NoStatusSelection = "No status selection made, goodbye.";
public const string GoBackToMainMenuWithPound = "To go back to the main menu, enter 0 and press pound.";
public const string StatusSelectionIntro = "To set your current status, enter the number of your selection, then press pound.";
public const string StaffingSelectionIntro = "To set your current staffing, enter the number of your selection, then press pound.";
public const string InvalidStatusSelection = "Invalid status selection. Returning to the main menu.";
public const string NoStatusSelection = "No status selection made. Returning to the main menu.";
public const string InvalidStaffingSelection = "Invalid staffing selection. Returning to the main menu.";
public const string NoStaffingSelection = "No staffing selection made. Returning to the main menu.";
public const string CommunicationTestRecorded = "Thank you. Your response has been recorded.";

public static string CallClosedByNumber(string callNumber) => $"This call, Id {callNumber} has been closed. Goodbye.";
public static string CallClosedByNumber(string callNumber) => $"This call, ID {callNumber}, has been closed. Goodbye.";

public static string RespondingToStation(string stationName) => $"You have been marked responding to {stationName}, goodbye.";
public static string RespondingToStation(string stationName) => $"You have been marked responding to {stationName}. Goodbye.";

public static string RespondToStationOption(int digit, string stationName) => $"Press {digit} to respond to {stationName}.";
public static string RespondToStationOption(int digit, string stationName) => $"To respond to {stationName}, enter {digit} and press pound.";

public static string RespondToSceneOption(int digit) => $"To respond to the scene, enter {digit} and press pound.";

public static string VerificationCode(string spokenCode) => $"Your verification code is: {spokenCode}.";

public static string MainMenuGreeting(string firstName, string departmentName) => $"Hello {firstName}, this is the Resgrid automated voice system for {departmentName}.";
public static string MainMenuGreeting(string firstName, string departmentName) => $"Hello {firstName}. This is the Resgrid automated voice system for {departmentName}.";

public static string StatusOption(int digit, string buttonText) => $"Press {digit} for {buttonText}.";
public static string StatusOption(int digit, string buttonText) => $"For {buttonText}, enter {digit} and press pound.";

public static string StaffingOption(int digit, string buttonText) => $"Press {digit} for {buttonText}.";
public static string StaffingOption(int digit, string buttonText) => $"For {buttonText}, enter {digit} and press pound.";

public static string StatusMarked(string buttonText) => $"You have been marked as {buttonText}, goodbye.";
public static string StatusMarked(string buttonText) => $"You have been marked as {buttonText}. Goodbye.";

public static string StaffingMarked(string buttonText) => $"You have been marked as {buttonText}. Goodbye.";

Expand All @@ -67,7 +73,11 @@ public static IReadOnlyCollection<string> GetStaticPrompts()
MainMenuSetStatus,
MainMenuSetStaffing,
RepeatAndRespondToScene,
OutboundDispatchMenu,
OutboundResponseSelectionIntro,
RepeatDispatchWithPound,
GoBackToMainMenu,
GoBackToMainMenuWithPound,
StatusSelectionIntro,
StaffingSelectionIntro,
InvalidStatusSelection,
Expand Down
2 changes: 1 addition & 1 deletion Core/Resgrid.Services/Resgrid.Services.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageReference Include="Stripe.net" Version="47.4.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
<PackageReference Include="Scriban" Version="5.12.1" />
<PackageReference Include="Scriban" Version="7.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Providers\Resgrid.Providers.AddressVerification\Resgrid.Providers.AddressVerification.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<ItemGroup>
<PackageReference Include="Autofac" Version="8.2.0" />
<PackageReference Include="AWSSDK.SimpleEmail" Version="3.7.402.63" />
<PackageReference Include="MimeKit" Version="4.11.0" />
<PackageReference Include="MimeKit" Version="4.16.0" />
<PackageReference Include="Mustachio" Version="2.1.0" />
<PackageReference Include="Postmark" Version="5.2.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<PackageReference Include="Azure.Storage.Blobs" Version="12.23.0" />
<PackageReference Include="Box.V2.Core" Version="6.5.0" />
<PackageReference Include="Dropbox.Api" Version="7.0.0" />
<PackageReference Include="FluentFTP" Version="52.0.3" />
<PackageReference Include="HtmlSanitizer" Version="8.1.870" />
<PackageReference Include="MailKit" Version="4.12.0" />
<PackageReference Include="FluentFTP" Version="54.1.1" />
<PackageReference Include="HtmlSanitizer" Version="9.0.892" />
<PackageReference Include="MailKit" Version="4.16.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="SSH.NET" Version="2024.2.0" />
<PackageReference Include="Twilio" Version="7.9.1" />
Expand Down
2 changes: 1 addition & 1 deletion Tests/Resgrid.Tests/Resgrid.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="NUnit" Version="4.3.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="Scriban" Version="5.12.1" />
<PackageReference Include="Scriban" Version="7.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Core\Resgrid.Config\Resgrid.Config.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void SetUp()
_cacheProvider.Object);

global::Resgrid.Config.SystemBehaviorConfig.CacheEnabled = false;
TtsConfig.DefaultVoice = "en-us+f3";
TtsConfig.DefaultVoice = "en-us+klatt6";
}

[TearDown]
Expand Down Expand Up @@ -77,13 +77,13 @@ public async Task should_fall_back_to_default_tts_language_when_setting_missing(

var result = await _service.GetTtsLanguageForDepartmentAsync(7);

result.Should().Be("en-us+f3");
result.Should().Be("en-us");
}

[Test]
public async Task should_fall_back_to_default_tts_language_when_setting_is_invalid()
{
TtsConfig.DefaultVoice = "fr";
TtsConfig.DefaultVoice = "fr+klatt6";

_departmentSettingsRepository
.Setup(x => x.GetDepartmentSettingByIdTypeAsync(7, DepartmentSettingTypes.TtsLanguage))
Expand Down
Loading
Loading