diff --git a/public/image/logos/plivo.png b/public/image/logos/plivo.png new file mode 100644 index 000000000..532d0c94d Binary files /dev/null and b/public/image/logos/plivo.png differ diff --git a/src/pages/notificationChannels/constants.ts b/src/pages/notificationChannels/constants.ts index 22c4e382e..83a0decf2 100644 --- a/src/pages/notificationChannels/constants.ts +++ b/src/pages/notificationChannels/constants.ts @@ -649,6 +649,60 @@ export const getNotificationChannelTypes = () => { }, }, }, + 'plivo-voice': { + logo: '/image/logos/plivo.png', + type: 'plivo', + default_values: { + param_config: { + user_info: { + contact_key: 'phone', + }, + custom: { + params: null, + }, + }, + request_type: 'plivo', + request_config: { + plivo_request_config: { + auth_id: '', + auth_token: '', + src_number: '', + answer_url: '', + answer_method: 'POST', + proxy: '', + timeout: 10000, + retry_times: 3, + retry_sleep: 0, + }, + }, + }, + }, + 'plivo-sms': { + logo: '/image/logos/plivo.png', + type: 'plivo', + default_values: { + param_config: { + user_info: { + contact_key: 'phone', + }, + custom: { + params: null, + }, + }, + request_type: 'plivo', + request_config: { + plivo_request_config: { + auth_id: '', + auth_token: '', + src_number: '', + proxy: '', + timeout: 10000, + retry_times: 3, + retry_sleep: 0, + }, + }, + }, + }, // slackbot: { // logo: '/image/logos/slack.png', // type: 'http', diff --git a/src/pages/notificationChannels/locale/en_US.ts b/src/pages/notificationChannels/locale/en_US.ts index e7e8a5ac7..728a5306f 100644 --- a/src/pages/notificationChannels/locale/en_US.ts +++ b/src/pages/notificationChannels/locale/en_US.ts @@ -42,6 +42,7 @@ const en_US = { script: 'Script configuration', flashduty: 'FlashDuty configuration', pagerduty: 'PagerDuty configuration', + plivo: 'Plivo configuration', dingtalkapp: 'DingTalk App configuration', wecomapp: 'WeCom App configuration', feishuapp: 'Feishu App configuration', @@ -118,6 +119,21 @@ const en_US = { timeout: 'Timeout (unit: ms)', retry_times: 'Retry Times', }, + plivo_request_config: { + title: 'Plivo', + auth_id: 'Auth ID', + auth_token: 'Auth Token', + src_number: 'Source Number', + src_number_tip: 'The Plivo phone number used as the SMS sender or the caller ID for voice calls. May be entered with or without a leading +.', + answer_url: 'Answer URL', + answer_url_tip: 'For voice calls, the URL that returns Plivo XML instructing what to do when the call is answered.', + answer_method: 'Answer Method', + answer_method_tip: 'HTTP method Plivo uses to fetch the Answer URL. Defaults to POST; use GET only if your Answer URL is served over GET.', + proxy: 'Proxy', + proxy_tip: 'HTTP PROXY address, used in scenarios that require a proxy', + timeout: 'Timeout (unit: ms)', + retry_times: 'Retry Times', + }, dingtalkapp_request_config: { app_key: 'App Key', app_secret: 'App Secret', @@ -162,6 +178,8 @@ const en_US = { 'ali-sms': 'Aliyun SMS', 'tx-voice': 'Tencent Cloud Voice', 'tx-sms': 'Tencent Cloud SMS', + 'plivo-voice': 'Plivo Voice', + 'plivo-sms': 'Plivo SMS', slackbot: 'Slack Bot', slackwebhook: 'Slack Webhook', mattermostbot: 'Mattermost Bot', diff --git a/src/pages/notificationChannels/locale/ja_JP.ts b/src/pages/notificationChannels/locale/ja_JP.ts index 82378bf44..ed779c9dc 100644 --- a/src/pages/notificationChannels/locale/ja_JP.ts +++ b/src/pages/notificationChannels/locale/ja_JP.ts @@ -42,6 +42,7 @@ const ja_JP = { script: 'Script 設定', flashduty: 'FlashDuty 設定', pagerduty: 'PagerDuty 設定', + plivo: 'Plivo 設定', dingtalkapp: 'DingTalk アプリ設定', wecomapp: '企業微信アプリ設定', feishuapp: 'Feishu アプリ設定', @@ -117,6 +118,21 @@ const ja_JP = { timeout: 'タイムアウト (単位: ミリ秒)', retry_times: 'リトライ回数', }, + plivo_request_config: { + title: 'Plivo', + auth_id: 'Auth ID', + auth_token: 'Auth Token', + src_number: '送信元番号', + src_number_tip: 'SMS の送信元または音声通話の発信者番号として使用する Plivo の電話番号。先頭の + は付けても付けなくても構いません。', + answer_url: 'Answer URL', + answer_url_tip: '音声通話で使用します。通話に応答したときに Plivo XML を返す URL です。', + answer_method: 'Answer Method', + answer_method_tip: 'Plivo が Answer URL を取得する際の HTTP メソッド。デフォルトは POST で、Answer URL が GET で提供される場合のみ GET を選択します。', + proxy: 'プロキシ', + proxy_tip: 'プロキシが必要な場合は、ここに HTTP PROXY アドレスを入力してください', + timeout: 'タイムアウト (単位: ミリ秒)', + retry_times: 'リトライ回数', + }, dingtalkapp_request_config: { app_key: 'アプリキー', app_secret: 'アプリシークレット', @@ -159,6 +175,8 @@ const ja_JP = { telegram: 'Telegram', 'ali-voice': 'Alibaba Cloud音声', 'ali-sms': 'Alibaba Cloud SMS', + 'plivo-voice': 'Plivo 音声', + 'plivo-sms': 'Plivo SMS', 'tx-voice': 'Tencent Cloud音声', 'tx-sms': 'Tencent Cloud SMS', slackbot: 'Slack Bot', diff --git a/src/pages/notificationChannels/locale/ru_RU.ts b/src/pages/notificationChannels/locale/ru_RU.ts index 8b9ad2f96..e0938869c 100644 --- a/src/pages/notificationChannels/locale/ru_RU.ts +++ b/src/pages/notificationChannels/locale/ru_RU.ts @@ -42,6 +42,7 @@ const ru_RU = { script: 'Настройка Script', flashduty: 'Настройка FlashDuty', pagerduty: 'Настройка PagerDuty', + plivo: 'Настройка Plivo', dingtalkapp: 'Настройка DingTalk App', wecomapp: 'Настройка WeCom App', feishuapp: 'Настройка Feishu App', @@ -119,6 +120,21 @@ const ru_RU = { timeout: 'Тайм-аут (мс)', retry_times: 'Количество повторных попыток', }, + plivo_request_config: { + title: 'Plivo', + auth_id: 'Auth ID', + auth_token: 'Auth Token', + src_number: 'Номер отправителя', + src_number_tip: 'Номер Plivo, используемый как отправитель SMS или идентификатор вызывающего абонента для голосовых вызовов. Можно вводить с ведущим + или без него.', + answer_url: 'Answer URL', + answer_url_tip: 'Для голосовых вызовов — URL, возвращающий Plivo XML с инструкциями при ответе на вызов.', + answer_method: 'Answer Method', + answer_method_tip: 'HTTP-метод, которым Plivo запрашивает Answer URL. По умолчанию POST; выберите GET, только если ваш Answer URL обслуживается через GET.', + proxy: 'Прокси', + proxy_tip: 'Адрес HTTP-прокси для сценариев, требующих прокси', + timeout: 'Тайм-аут (мс)', + retry_times: 'Количество повторных попыток', + }, dingtalkapp_request_config: { app_key: 'Ключ приложения', app_secret: 'Секрет приложения', @@ -161,6 +177,8 @@ const ru_RU = { telegram: 'Telegram', 'ali-voice': 'Голосовой Alibaba Cloud', 'ali-sms': 'SMS Alibaba Cloud', + 'plivo-voice': 'Plivo Голос', + 'plivo-sms': 'Plivo SMS', 'tx-voice': 'Голосовой Tencent Cloud', 'tx-sms': 'SMS Tencent Cloud', slackbot: 'Slack Bot', diff --git a/src/pages/notificationChannels/locale/zh_CN.ts b/src/pages/notificationChannels/locale/zh_CN.ts index 92a568285..b2b77e618 100644 --- a/src/pages/notificationChannels/locale/zh_CN.ts +++ b/src/pages/notificationChannels/locale/zh_CN.ts @@ -40,6 +40,7 @@ const zh_CN = { script: 'Script 配置', flashduty: 'FlashDuty 配置', pagerduty: 'PagerDuty 配置', + plivo: 'Plivo 配置', dingtalkapp: '钉钉应用配置', wecomapp: '企业微信应用配置', feishuapp: '飞书应用配置', @@ -114,6 +115,21 @@ const zh_CN = { timeout: '超时时间 (单位: 毫秒)', retry_times: '重试次数', }, + plivo_request_config: { + title: 'Plivo', + auth_id: 'Auth ID', + auth_token: 'Auth Token', + src_number: '发送号码', + src_number_tip: '作为短信发送方或语音主叫的 Plivo 号码,填写时可带或不带前导 +。', + answer_url: 'Answer URL', + answer_url_tip: '语音通道使用,呼叫接通后返回 Plivo XML 指令的 URL。', + answer_method: 'Answer Method', + answer_method_tip: 'Plivo 拉取 Answer URL 所用的 HTTP 方法,默认 POST;仅当 Answer URL 以 GET 提供时才选 GET。', + proxy: '代理', + proxy_tip: 'HTTP PROXY 地址,用于需要代理的场景', + timeout: '超时时间 (单位: 毫秒)', + retry_times: '重试次数', + }, dingtalkapp_request_config: { app_key: '应用唯一标识', app_secret: '应用密钥', @@ -157,6 +173,8 @@ const zh_CN = { telegram: 'Telegram', 'ali-voice': '阿里云语音', 'ali-sms': '阿里云短信', + 'plivo-voice': 'Plivo 语音', + 'plivo-sms': 'Plivo 短信', 'tx-voice': '腾讯云语音', 'tx-sms': '腾讯云短信', slackbot: 'Slack Bot', diff --git a/src/pages/notificationChannels/locale/zh_HK.ts b/src/pages/notificationChannels/locale/zh_HK.ts index 9502742b1..d355ebe86 100644 --- a/src/pages/notificationChannels/locale/zh_HK.ts +++ b/src/pages/notificationChannels/locale/zh_HK.ts @@ -40,6 +40,7 @@ const zh_HK = { script: 'Script 配置', flashduty: 'FlashDuty 配置', pagerduty: 'PagerDuty 配置', + plivo: 'Plivo 配置', dingtalkapp: '釘釘應用配置', wecomapp: '企業微信應用配置', feishuapp: '飛書應用配置', @@ -114,6 +115,21 @@ const zh_HK = { timeout: '超時時間 (單位: 毫秒)', retry_times: '重試次數', }, + plivo_request_config: { + title: 'Plivo', + auth_id: 'Auth ID', + auth_token: 'Auth Token', + src_number: '發送號碼', + src_number_tip: '作為短信發送方或語音主叫的 Plivo 號碼,填寫時可帶或不帶前導 +。', + answer_url: 'Answer URL', + answer_url_tip: '語音通道使用,呼叫接通後返回 Plivo XML 指令的 URL。', + answer_method: 'Answer Method', + answer_method_tip: 'Plivo 拉取 Answer URL 所用的 HTTP 方法,預設 POST;僅當 Answer URL 以 GET 提供時才選 GET。', + proxy: '代理', + proxy_tip: 'HTTP PROXY 地址,用於需要代理的場景', + timeout: '超時時間 (單位: 毫秒)', + retry_times: '重試次數', + }, dingtalkapp_request_config: { app_key: '應用唯一標識', app_secret: '應用密鑰', @@ -156,6 +172,8 @@ const zh_HK = { telegram: 'Telegram', 'ali-voice': '阿里雲語音', 'ali-sms': '阿里雲短信', + 'plivo-voice': 'Plivo 語音', + 'plivo-sms': 'Plivo 短信', 'tx-voice': '騰訊雲語音', 'tx-sms': '騰訊雲短信', slackbot: 'Slack Bot', diff --git a/src/pages/notificationChannels/pages/Form/Plivo.tsx b/src/pages/notificationChannels/pages/Form/Plivo.tsx new file mode 100644 index 000000000..76ee18b25 --- /dev/null +++ b/src/pages/notificationChannels/pages/Form/Plivo.tsx @@ -0,0 +1,88 @@ +import { useTranslation } from 'react-i18next'; +import { NS } from '../../constants'; +import { Form, Input, InputNumber, Select, Space, Tooltip } from 'antd'; +import React from 'react'; +import { QuestionCircleOutlined } from '@ant-design/icons'; + +export default function Plivo() { + const { t } = useTranslation(NS); + const names = ['request_config', 'plivo_request_config']; + const request_type = Form.useWatch('request_type'); + const ident = Form.useWatch('ident'); + const isPlivo = request_type === 'plivo'; + const isVoice = ident === 'plivo-voice'; + + return ( +