BotSharp/src/Plugins/BotSharp.Plugin.Twilio/OutboundPhoneCallHandler/Hooks/OutboundPhoneCallHandlerUtilityHook.cs

36 lines
1.2 KiB
C#
Raw Normal View History

2024-11-21 06:50:55 +00:00
using BotSharp.Abstraction.Agents.Models;
2024-11-19 19:05:12 +00:00
using BotSharp.Plugin.Twilio.OutboundPhoneCallHandler.Enums;
2024-11-21 06:50:55 +00:00
namespace BotSharp.Plugin.Twilio.OutboundPhoneCallHandler.Hooks;
public class OutboundPhoneCallHandlerUtilityHook : IAgentUtilityHook
2024-11-19 19:05:12 +00:00
{
2024-12-04 22:12:02 +00:00
private static string PREFIX = "util-twilio-";
2025-02-26 17:41:52 +00:00
private static string OUTBOUND_PHONE_CALL_FN = $"{PREFIX}outbound_phone_call";
2025-03-17 22:09:02 +00:00
private static string TRANSFER_PHONE_CALL_FN = $"{PREFIX}transfer_phone_call";
2025-02-26 17:41:52 +00:00
private static string HANGUP_PHONE_CALL_FN = $"{PREFIX}hangup_phone_call";
2025-03-17 22:09:02 +00:00
private static string TEXT_MESSAGE_FN = $"{PREFIX}text_message";
2024-11-21 06:50:55 +00:00
public void AddUtilities(List<AgentUtility> utilities)
2024-11-19 19:05:12 +00:00
{
2024-11-21 06:50:55 +00:00
var utility = new AgentUtility
2024-11-19 19:05:12 +00:00
{
2024-11-21 06:50:55 +00:00
Name = UtilityName.OutboundPhoneCall,
2025-02-26 17:41:52 +00:00
Functions =
[
new($"{OUTBOUND_PHONE_CALL_FN}"),
2025-03-17 22:09:02 +00:00
new($"{TRANSFER_PHONE_CALL_FN}"),
2025-03-14 21:44:19 +00:00
new($"{HANGUP_PHONE_CALL_FN}"),
new($"{TEXT_MESSAGE_FN}")
2025-02-26 17:41:52 +00:00
],
Templates =
[
new($"{OUTBOUND_PHONE_CALL_FN}.fn"),
new($"{HANGUP_PHONE_CALL_FN}.fn")
]
2024-11-21 06:50:55 +00:00
};
utilities.Add(utility);
2024-11-19 19:05:12 +00:00
}
}