From 277213dad5090b6f0fc4487e4cdbe15f226b37a2 Mon Sep 17 00:00:00 2001 From: AxeKam333 Date: Mon, 31 Mar 2025 10:18:22 +0200 Subject: [PATCH] Fix sending apiv1 calls, fix passed arguments --- server/notification-providers/smseagle.js | 39 ++++++++++++----------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/server/notification-providers/smseagle.js b/server/notification-providers/smseagle.js index 5dd6cfeb8..d2ebdcafe 100644 --- a/server/notification-providers/smseagle.js +++ b/server/notification-providers/smseagle.js @@ -31,20 +31,20 @@ class SMSEagle extends NotificationProvider { } else if (notification.smseagleRecipientType === "smseagle-to") { recipientType = "to"; sendMethod = "/send_sms"; - } else { - recipientType = "to"; - if (notification.smseagleDuration) - duration = notification.smseagleDuration; - else - duration = 10; + if (notification.smseagleMsgType != "smseagle-sms") { + if (notification.smseagleDuration) + duration = notification.smseagleDuration; + else + duration = 10; - if (notification.smseagleMsgType == "smseagle-ring") { - sendMethod = "/ring_call"; - } else if (notification.smseagleMsgType == "smseagle-tts") { - sendMethod = "/tts_call"; - } else if (notification.smseagleMsgType == "smseagle-tts-advanced") { - sendMethod = "/tts_adv_call"; - voice_id = notification.smseagleTtsModel ? notification.smseagleTtsModel : 1 ; + if (notification.smseagleMsgType == "smseagle-ring") { + sendMethod = "/ring_call"; + } else if (notification.smseagleMsgType == "smseagle-tts") { + sendMethod = "/tts_call"; + } else if (notification.smseagleMsgType == "smseagle-tts-advanced") { + sendMethod = "/tts_adv_call"; + voice_id = notification.smseagleTtsModel ? notification.smseagleTtsModel : 1; + } } } @@ -52,12 +52,15 @@ class SMSEagle extends NotificationProvider { url.searchParams.append('access_token', notification.smseagleToken); url.searchParams.append(recipientType, notification.smseagleRecipient); - url.searchParams.append('message', msg); - url.searchParams.append('unicode', (notification.smseagleEncoding) ? "1" : "0"); - url.searchParams.append('highpriority', (notification.smseaglePriority) ? notification.smseaglePriority : "0"); - if (duration) { + if (!["smseagle-ring", "smseagle-tts", "smseagle-tts-advanced"].includes(notification.smseagleRecipientType)) { + url.searchParams.append('unicode', (notification.smseagleEncoding) ? "1" : "0"); + url.searchParams.append('highpriority', (notification.smseaglePriority) ? notification.smseaglePriority : "0"); + } else { url.searchParams.append('duration', duration); } + if (notification.smseagleRecipientType != "smseagle-ring") { + url.searchParams.append('message', msg); + } if (voice_id) { url.searchParams.append('voice_id', voice_id); } @@ -130,7 +133,7 @@ class SMSEagle extends NotificationProvider { endpoint = "/calls/tts"; } else if (notification.smseagleMsgType == "smseagle-tts-advanced") { endpoint = "/calls/tts_advanced"; - postData["voice_id"] = notification.smseagleTtsModel ? notification.smseagleTtsModel : "1" ; + postData["voice_id"] = notification.smseagleTtsModel ? notification.smseagleTtsModel : "1"; } }