diff --git a/apps/meteor/ee/app/api-enterprise/server/index.ts b/apps/meteor/ee/app/api-enterprise/server/index.ts index 1c48d592d33e..af62899e1f3a 100644 --- a/apps/meteor/ee/app/api-enterprise/server/index.ts +++ b/apps/meteor/ee/app/api-enterprise/server/index.ts @@ -4,6 +4,6 @@ await License.onLicense('canned-responses', async () => { await import('./canned-responses'); }); -await License.onLicense('voip-enterprise', async () => { +License.onValidateLicense(async () => { await import('./voip-freeswitch'); }); diff --git a/apps/meteor/ee/app/api-enterprise/server/voip-freeswitch.ts b/apps/meteor/ee/app/api-enterprise/server/voip-freeswitch.ts index 6cadec3c6dba..fdcfcc2ec6e6 100644 --- a/apps/meteor/ee/app/api-enterprise/server/voip-freeswitch.ts +++ b/apps/meteor/ee/app/api-enterprise/server/voip-freeswitch.ts @@ -16,6 +16,10 @@ API.v1.addRoute( { authRequired: true, permissionsRequired: ['manage-voip-extensions'], validateParams: isVoipFreeSwitchExtensionListProps }, { async get() { + if (!settings.get('VoIP_TeamCollab_Enabled')) { + throw new Error('error-voip-disabled'); + } + const { username, type = 'all' } = this.queryParams; const extensions = await wrapExceptions(() => VoipFreeSwitch.getExtensionList()).catch(() => { @@ -58,6 +62,10 @@ API.v1.addRoute( { authRequired: true, permissionsRequired: ['manage-voip-extensions'], validateParams: isVoipFreeSwitchExtensionAssignProps }, { async post() { + if (!settings.get('VoIP_TeamCollab_Enabled')) { + throw new Error('error-voip-disabled'); + } + const { extension, username } = this.bodyParams; if (!username) { @@ -89,6 +97,10 @@ API.v1.addRoute( { authRequired: true, permissionsRequired: ['view-voip-extension-details'], validateParams: isVoipFreeSwitchExtensionGetDetailsProps }, { async get() { + if (!settings.get('VoIP_TeamCollab_Enabled')) { + throw new Error('error-voip-disabled'); + } + const { extension, group } = this.queryParams; if (!extension) { @@ -115,6 +127,10 @@ API.v1.addRoute( { authRequired: true, permissionsRequired: ['view-user-voip-extension'], validateParams: isVoipFreeSwitchExtensionGetInfoProps }, { async get() { + if (!settings.get('VoIP_TeamCollab_Enabled')) { + throw new Error('error-voip-disabled'); + } + const { userId } = this.queryParams; if (!userId) { diff --git a/apps/meteor/ee/server/configuration/voip.ts b/apps/meteor/ee/server/configuration/voip.ts index b265ca900cdb..1d736d8217e2 100644 --- a/apps/meteor/ee/server/configuration/voip.ts +++ b/apps/meteor/ee/server/configuration/voip.ts @@ -4,7 +4,7 @@ import { Meteor } from 'meteor/meteor'; import { addSettings } from '../settings/voip'; Meteor.startup(async () => { - await License.onLicense('voip-enterprise', async () => { + License.onValidateLicense(async () => { await addSettings(); }); }); diff --git a/apps/meteor/ee/server/settings/voip.ts b/apps/meteor/ee/server/settings/voip.ts index e3fbb90003c6..f773200b91d2 100644 --- a/apps/meteor/ee/server/settings/voip.ts +++ b/apps/meteor/ee/server/settings/voip.ts @@ -5,7 +5,7 @@ export function addSettings(): Promise { await this.with( { enterprise: true, - modules: ['voip-enterprise'], + modules: ['teams-voip'], }, async function () { await this.add('VoIP_TeamCollab_Enabled', false, { diff --git a/packages/i18n/src/locales/en.i18n.json b/packages/i18n/src/locales/en.i18n.json index 42422ef477ac..92056badc0b3 100644 --- a/packages/i18n/src/locales/en.i18n.json +++ b/packages/i18n/src/locales/en.i18n.json @@ -2244,6 +2244,7 @@ "error-registration-not-found": "Registration information not found", "error-extension-not-available": "Extension not available", "error-user-not-found": "User not found", + "error-voip-disaled": "Team voice calls (VoIP) is disabled", "error-extension-not-assigned": "Extension not assigned", "Workspace_exceeded_MAC_limit_disclaimer": "The workspace has exceeded the monthly limit of active contacts. Talk to your workspace admin to address this issue.", "You_do_not_have_permission_to_do_this": "You do not have permission to do this",