From 6145633410ecac8d9847dfb4272a5ee11325c65f Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 5 Dec 2024 02:57:33 +0200 Subject: Finished SMS. --- .../Web/Tango.MachineService/Controllers/PPCController.cs | 14 ++++++++++++-- .../Web/Tango.MachineService/MachineServiceConfig.cs | 4 +++- Software/Visual_Studio/Web/Tango.MachineService/Web.config | 3 +++ 3 files changed, 18 insertions(+), 3 deletions(-) (limited to 'Software/Visual_Studio/Web/Tango.MachineService') diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index d8f514c42..57bdc2fbf 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -844,9 +844,19 @@ namespace Tango.MachineService.Controllers if (MachineServiceConfig.TWILIO_ENABLE_SMS) { - foreach (var phone in request.PhoneNumbers) + if (MachineServiceConfig.TWILIO_ENABLE_ALPHA_SENDER) { - MessageResource.Create(from: MachineServiceConfig.TWILIO_FROM_NUMBER, to: new PhoneNumber(phone), body: request.Message); + foreach (var phone in request.PhoneNumbers) + { + MessageResource.Create(messagingServiceSid: MachineServiceConfig.TWILIO_MESSAGING_SERVICE_SID, to: new PhoneNumber(phone), body: request.Message); + } + } + else + { + foreach (var phone in request.PhoneNumbers) + { + MessageResource.Create(from: MachineServiceConfig.TWILIO_FROM_NUMBER, to: new PhoneNumber(phone), body: request.Message); + } } } diff --git a/Software/Visual_Studio/Web/Tango.MachineService/MachineServiceConfig.cs b/Software/Visual_Studio/Web/Tango.MachineService/MachineServiceConfig.cs index e8240fd46..15c0637d6 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/MachineServiceConfig.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/MachineServiceConfig.cs @@ -26,9 +26,11 @@ namespace Tango.MachineService public static String SEND_GRID_API_KEY => ConfigurationManager.AppSettings[nameof(SEND_GRID_API_KEY)].ToString(); - public static bool TWILIO_ENABLE_SMS => bool.Parse(ConfigurationManager.AppSettings[nameof(TWILIO_ENABLE_SMS)].ToString()); public static String TWILIO_ACCOUNT_SID => ConfigurationManager.AppSettings[nameof(TWILIO_ACCOUNT_SID)].ToString(); public static String TWILIO_AUTH_TOKEN => ConfigurationManager.AppSettings[nameof(TWILIO_AUTH_TOKEN)].ToString(); + public static String TWILIO_MESSAGING_SERVICE_SID => ConfigurationManager.AppSettings[nameof(TWILIO_MESSAGING_SERVICE_SID)].ToString(); public static String TWILIO_FROM_NUMBER => ConfigurationManager.AppSettings[nameof(TWILIO_FROM_NUMBER)].ToString(); + public static bool TWILIO_ENABLE_SMS => bool.Parse(ConfigurationManager.AppSettings[nameof(TWILIO_ENABLE_SMS)].ToString()); + public static bool TWILIO_ENABLE_ALPHA_SENDER => bool.Parse(ConfigurationManager.AppSettings[nameof(TWILIO_ENABLE_ALPHA_SENDER)].ToString()); } } \ No newline at end of file diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Web.config b/Software/Visual_Studio/Web/Tango.MachineService/Web.config index 8cc11ebb5..84b3d0a3a 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Web.config +++ b/Software/Visual_Studio/Web/Tango.MachineService/Web.config @@ -41,8 +41,11 @@ + + +