From dac59416dc26a5a61858ca60f33ab1bc4cd7484b Mon Sep 17 00:00:00 2001 From: Hugo Zigha Date: Thu, 2 May 2024 14:37:57 +0200 Subject: [PATCH] MT#58744 Add some new subscriber's preferences in the 'pbx configuration > seats' page Change-Id: I0650f7c56e94eee4031f9b83e80ff2d2a8a64f29 --- src/api/pbx-seats.js | 56 ++++++++++++- src/api/subscriber.js | 24 ++++++ src/pages/CscPagePbxSeatDetails.vue | 126 +++++++++++++++++++++++++--- src/store/pbx-seats.js | 117 +++++++++++++++++++++++++- 4 files changed, 309 insertions(+), 14 deletions(-) diff --git a/src/api/pbx-seats.js b/src/api/pbx-seats.js index ac3aba47..479cb861 100644 --- a/src/api/pbx-seats.js +++ b/src/api/pbx-seats.js @@ -14,7 +14,13 @@ import { setPreferenceMusicOnHold, setPreferenceCli, getPreferences, - setPbxSIPPassword + setPbxSIPPassword, + setPreferenceAnnouncementCfu, + setPreferenceAnnouncementCallSetup, + setPreferenceAnnouncementToCallee, + setPreferenceIgnoreCfWhenHunting, + setPreferenceCstaClient, + setPreferenceCstaController } from './subscriber' import _ from 'lodash' import { @@ -325,6 +331,54 @@ export function setSeatCli (seatId, cli) { }) } +/** + * @param seatId + * @param announcementCfu + */ +export function setSeatAnnouncementCfu (seatId, announcementCfu) { + return setPreferenceAnnouncementCfu(seatId, announcementCfu) +} + +/** + * @param seatId + * @param announcementCallSetup + */ +export function setSeatAnnouncementCallSetup (seatId, announcementCallSetup) { + return setPreferenceAnnouncementCallSetup(seatId, announcementCallSetup) +} + +/** + * @param seatId + * @param announcementToCallee + */ +export function setSeatAnnouncementToCallee (seatId, announcementToCallee) { + return setPreferenceAnnouncementToCallee(seatId, announcementToCallee) +} + +/** + * @param seatId + * @param ignoreCfWhenHunting + */ +export function setSeatIgnoreCfWhenHunting (seatId, ignoreCfWhenHunting) { + return setPreferenceIgnoreCfWhenHunting(seatId, ignoreCfWhenHunting) +} + +/** + * @param seatId + * @param cstaClient + */ +export function setSeatCstaClient (seatId, cstaClient) { + return setPreferenceCstaClient(seatId, cstaClient) +} + +/** + * @param seatId + * @param cstaController + */ +export function setSeatCstaController (seatId, cstaController) { + return setPreferenceCstaController(seatId, cstaController) +} + /** * @param options * @param options.seatId diff --git a/src/api/subscriber.js b/src/api/subscriber.js index 70f9869e..51dbccc6 100644 --- a/src/api/subscriber.js +++ b/src/api/subscriber.js @@ -417,6 +417,30 @@ export function setPreferenceMusicOnHold (id, value) { return setPreference(id, 'music_on_hold', value) } +export function setPreferenceAnnouncementCfu (id, value) { + return setPreference(id, 'play_announce_before_cf', value) +} + +export function setPreferenceAnnouncementCallSetup (id, value) { + return setPreference(id, 'play_announce_before_call_setup', value) +} + +export function setPreferenceAnnouncementToCallee (id, value) { + return setPreference(id, 'play_announce_to_callee', value) +} + +export function setPreferenceIgnoreCfWhenHunting (id, value) { + return setPreference(id, 'ignore_cf_when_hunting', value) +} + +export function setPreferenceCstaClient (id, value) { + return setPreference(id, 'csta_client', value) +} + +export function setPreferenceCstaController (id, value) { + return setPreference(id, 'csta_controller', value) +} + export function setPreferenceCli (id, value) { return setPreference(id, 'cli', value) } diff --git a/src/pages/CscPagePbxSeatDetails.vue b/src/pages/CscPagePbxSeatDetails.vue index c81b2ae5..869e2c2a 100644 --- a/src/pages/CscPagePbxSeatDetails.vue +++ b/src/pages/CscPagePbxSeatDetails.vue @@ -40,11 +40,11 @@ - + + + + + + + + + @@ -392,7 +442,13 @@ export default { 'getCurrentCli', 'getIntraPbx', 'getSeatUpdateToastMessage', - 'isSeatLoading' + 'isSeatLoading', + 'getAnnouncementCfu', + 'getAnnouncementCallSetup', + 'getAnnouncementToCallee', + 'getIgnoreCfWhenHunting', + 'getCstaClient', + 'getCstaController' ]), ...mapGetters('pbx', [ 'getExtensionHint', @@ -566,7 +622,13 @@ export default { 'loadPreferences', 'setCli', 'setNcosSet', - 'NcosSet' + 'NcosSet', + 'setAnnouncementCfu', + 'setAnnouncementCallSetup', + 'setAnnouncementToCallee', + 'setIgnoreCfWhenHunting', + 'setCstaClient', + 'setCstaController' ]), ...mapActions('user', [ 'getNcosLevelsSubscriber', @@ -631,6 +693,12 @@ export default { aliasNumbers: this.getAliasNumberIds(), webPassword: this.seatSelected.webpassword, clirIntrapbx: this.getIntraPbx(this.seatSelected.id), + announcementCfu: this.getAnnouncementCfu(this.seatSelected.id), + announcementCallSetup: this.getAnnouncementCallSetup(this.seatSelected.id), + announcementToCallee: this.getAnnouncementToCallee(this.seatSelected.id), + ignoreCfWhenHunting: this.getIgnoreCfWhenHunting(this.seatSelected.id), + cstaClient: this.getCstaClient(this.seatSelected.id), + cstaController: this.getCstaController(this.seatSelected.id), musicOnHold: this.getMusicOnHold(this.seatSelected.id), groups: this.getGroupIds(), soundSet: this.getSoundSetId(), @@ -741,6 +809,42 @@ export default { this.changes.musicOnHold = !this.changes.musicOnHold } }, + changeAnnouncementCfu () { + this.setAnnouncementCfu({ + seatId: this.seatSelected.id, + announcementCfu: this.changes.announcementCfu + }) + }, + changeAnnouncementCallSetup () { + this.setAnnouncementCallSetup({ + seatId: this.seatSelected.id, + announcementCallSetup: this.changes.announcementCallSetup + }) + }, + changeAnnouncementToCallee () { + this.setAnnouncementToCallee({ + seatId: this.seatSelected.id, + announcementToCallee: this.changes.announcementToCallee + }) + }, + changeIgnoreCfWhenHunting () { + this.setIgnoreCfWhenHunting({ + seatId: this.seatSelected.id, + ignoreCfWhenHunting: this.changes.ignoreCfWhenHunting + }) + }, + changeCstaClient () { + this.setCstaClient({ + seatId: this.seatSelected.id, + cstaClient: this.changes.cstaClient + }) + }, + changeCstaController () { + this.setCstaController({ + seatId: this.seatSelected.id, + cstaController: this.changes.cstaController + }) + }, goToCallQueue () { this.jumpToCallQueue(this.seatSelected) }, diff --git a/src/store/pbx-seats.js b/src/store/pbx-seats.js index a7987cd2..6e3bcd01 100644 --- a/src/store/pbx-seats.js +++ b/src/store/pbx-seats.js @@ -27,7 +27,13 @@ import { setNcosSet, setNcosLevelSets, NcosSet, - NcosSets + NcosSets, + setSeatAnnouncementCfu, + setSeatAnnouncementCallSetup, + setSeatAnnouncementToCallee, + setSeatIgnoreCfWhenHunting, + setSeatCstaClient, + setSeatCstaController } from '../api/pbx-seats' import { getSubscriberId } from 'src/auth' export default { @@ -119,11 +125,47 @@ export default { return seatPreferences && seatPreferences.clir_intrapbx ? state.preferenceMapById[id].clir_intrapbx : false } }, + getAnnouncementCfu (state) { + return (id) => { + const seatPreferences = state.preferenceMapById[id] + return seatPreferences && seatPreferences.play_announce_before_cf ? state.preferenceMapById[id].play_announce_before_cf : false + } + }, getMusicOnHold (state) { return (id) => { return state?.preferenceMapById[id]?.music_on_hold || false } }, + getAnnouncementCallSetup (state) { + return (id) => { + const seatPreferences = state.preferenceMapById[id] + return seatPreferences && seatPreferences.play_announce_before_call_setup ? state.preferenceMapById[id].play_announce_before_call_setup : false + } + }, + getAnnouncementToCallee (state) { + return (id) => { + const seatPreferences = state.preferenceMapById[id] + return seatPreferences && seatPreferences.play_announce_to_callee ? state.preferenceMapById[id].play_announce_to_callee : false + } + }, + getIgnoreCfWhenHunting (state) { + return (id) => { + const seatPreferences = state.preferenceMapById[id] + return seatPreferences && seatPreferences.ignore_cf_when_hunting ? state.preferenceMapById[id].ignore_cf_when_hunting : false + } + }, + getCstaClient (state) { + return (id) => { + const seatPreferences = state.preferenceMapById[id] + return seatPreferences && seatPreferences.csta_client ? state.preferenceMapById[id].csta_client : false + } + }, + getCstaController (state) { + return (id) => { + const seatPreferences = state.preferenceMapById[id] + return seatPreferences && seatPreferences.csta_controller ? state.preferenceMapById[id].csta_controller : false + } + }, getCurrentCli (state) { return (id) => { return state?.preferenceMapById[id]?.cli || false @@ -550,7 +592,78 @@ export default { } catch (err) { context.commit('seatUpdateFailed', err.message) } + }, + async setAnnouncementCfu (context, options) { + context.commit('seatUpdateRequesting', { + seatId: options.seatId, + seatField: options.message || i18n.global.tc('the playback announcement as early media before Call Forward Unconditional or Unavailable') + }) + try { + const result = await setSeatAnnouncementCfu(options.seatId, options.announcementCfu) + context.commit('seatUpdateSucceeded', result) + } catch (err) { + context.commit('seatUpdateFailed', err.message) + } + }, + async setAnnouncementCallSetup (context, options) { + context.commit('seatUpdateRequesting', { + seatId: options.seatId, + seatField: options.message || i18n.global.tc('the playback announcement as early media before send the call to callee') + }) + try { + const result = await setSeatAnnouncementCallSetup(options.seatId, options.announcementCallSetup) + context.commit('seatUpdateSucceeded', result) + } catch (err) { + context.commit('seatUpdateFailed', err.message) + } + }, + async setAnnouncementToCallee (context, options) { + context.commit('seatUpdateRequesting', { + seatId: options.seatId, + seatField: options.message || i18n.global.tc('the playback announcement to callee after he answered the call') + }) + try { + const result = await setSeatAnnouncementToCallee(options.seatId, options.announcementToCallee) + context.commit('seatUpdateSucceeded', result) + } catch (err) { + context.commit('seatUpdateFailed', err.message) + } + }, + async setIgnoreCfWhenHunting (context, options) { + context.commit('seatUpdateRequesting', { + seatId: options.seatId, + seatField: options.message || i18n.global.tc('the behavior of the members call forwards from a Cloud PBX subscriber when it is called within a huntgroup') + }) + try { + const result = await setSeatIgnoreCfWhenHunting(options.seatId, options.ignoreCfWhenHunting) + context.commit('seatUpdateSucceeded', result) + } catch (err) { + context.commit('seatUpdateFailed', err.message) + } + }, + async setCstaClient (context, options) { + context.commit('seatUpdateRequesting', { + seatId: options.seatId, + seatField: options.message || i18n.global.tc('the right of this subscriber to be controlled by a CTI subscriber within the same customer using uaCSTA via SIP') + }) + try { + const result = await setSeatCstaClient(options.seatId, options.cstaClient) + context.commit('seatUpdateSucceeded', result) + } catch (err) { + context.commit('seatUpdateFailed', err.message) + } + }, + async setCstaController (context, options) { + context.commit('seatUpdateRequesting', { + seatId: options.seatId, + seatField: options.message || i18n.global.tc('the right this subscriber to initiate CTI sessions to other subscribers within the same customer using uaCSTA via SIP') + }) + try { + const result = await setSeatCstaController(options.seatId, options.cstaController) + context.commit('seatUpdateSucceeded', result) + } catch (err) { + context.commit('seatUpdateFailed', err.message) + } } - } }