From 3bf98b89c533532655883d3730e90f5c95173907 Mon Sep 17 00:00:00 2001 From: Hugo Zigha Date: Tue, 6 May 2025 15:16:50 +0200 Subject: [PATCH] MT#62713 Added missing announce preferences for Groups Menu in CSC Two switch buttons added to group details as for seats. These buttons update play_announce_before_call_setup and play_announce_before_cf preferences. Change-Id: I230b9a8d62b34a2e013a326ad4d50403b82d824a (cherry picked from commit 6e70eb898b07215d6f596ce8f7f59eae0d988a30) (cherry picked from commit 435d76b47b5cee94627113de1e7fa755d02996ec) --- src/api/pbx-groups.js | 21 ++++++++++++- src/pages/CscPagePbxGroupDetails.vue | 46 ++++++++++++++++++++++++++-- src/store/pbx-groups.js | 38 +++++++++++++++++++++++ 3 files changed, 101 insertions(+), 4 deletions(-) diff --git a/src/api/pbx-groups.js b/src/api/pbx-groups.js index 6a26b4a4..4fea7eb6 100644 --- a/src/api/pbx-groups.js +++ b/src/api/pbx-groups.js @@ -10,7 +10,9 @@ import { setPbxHuntPolicy, setPbxHuntTimeout, setSubscriberNumbers, setPbxHuntCancelMode, - generateGeneralPassword + generateGeneralPassword, + setPreferenceAnnouncementCallSetup, + setPreferenceAnnouncementCfu } from './subscriber' import { getAllSoundSets, @@ -20,6 +22,7 @@ import { PBX_CONFIG_ORDER_DIRECTION, setSubscriberSoundSet } from './pbx-config' + import { assignNumbers, getNumbers @@ -306,6 +309,22 @@ export function setGroupSoundSet (options) { }) } +/** + * @param groupId + * @param announcementCfu + */ +export function setGroupAnnouncementCfu (groupId, announcementCfu) { + return setPreferenceAnnouncementCfu(groupId, announcementCfu) +} + +/** + * @param groupId + * @param announcementCallSetup + */ +export function setGroupAnnouncementCallSetup (groupId, announcementCallSetup) { + return setPreferenceAnnouncementCallSetup(groupId, announcementCallSetup) +} + // This mirrors the logic we use in ngcp-admin to handle the pbx groups creation // If you change the logic below make sure you make the same changes in ngcp-admin too function createUsername (name) { diff --git a/src/pages/CscPagePbxGroupDetails.vue b/src/pages/CscPagePbxGroupDetails.vue index 63a67b9f..1be4329c 100644 --- a/src/pages/CscPagePbxGroupDetails.vue +++ b/src/pages/CscPagePbxGroupDetails.vue @@ -237,6 +237,28 @@ @click="jumpToCallQueueInternal" /> + + + + { + const groupPreferences = state.preferenceMapById[id] + return groupPreferences && groupPreferences.play_announce_before_cf ? state.preferenceMapById[id].play_announce_before_cf : false + } + }, + getAnnouncementCallSetup (state) { + return (id) => { + const groupPreferences = state.preferenceMapById[id] + return groupPreferences && groupPreferences.play_announce_before_call_setup ? state.preferenceMapById[id].play_announce_before_call_setup : false + } } }, mutations: { @@ -434,6 +448,30 @@ export default { }).catch((err) => { context.commit('groupUpdateFailed', err.message) }) + }, + async setAnnouncementCfu (context, options) { + context.commit('groupUpdateRequesting', { + groupId: options.groupId, + groupField: options.message || i18n.global.t('the playback announcement as early media before Call Forward Unconditional or Unavailable') + }) + try { + const result = await setGroupAnnouncementCfu(options.groupId, options.announcementCfu) + context.commit('groupUpdateSucceeded', result) + } catch (err) { + context.commit('groupUpdateFailed', err.message) + } + }, + async setAnnouncementCallSetup (context, options) { + context.commit('groupUpdateRequesting', { + groupId: options.groupId, + groupField: options.message || i18n.global.t('the playback announcement as early media before send the call to callee') + }) + try { + const result = await setGroupAnnouncementCallSetup(options.groupId, options.announcementCallSetup) + context.commit('groupUpdateSucceeded', result) + } catch (err) { + context.commit('groupUpdateFailed', err.message) + } } } }