Skip to content

Commit

Permalink
chore: use a separate license module for team collab VoIP and omnicha…
Browse files Browse the repository at this point in the history
…nnel VoIP (#33604)
  • Loading branch information
pierre-lehnen-rc authored Oct 18, 2024
1 parent 15582b1 commit bd64aed
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/meteor/ee/app/api-enterprise/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
16 changes: 16 additions & 0 deletions apps/meteor/ee/app/api-enterprise/server/voip-freeswitch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/ee/server/configuration/voip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
2 changes: 1 addition & 1 deletion apps/meteor/ee/server/settings/voip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export function addSettings(): Promise<void> {
await this.with(
{
enterprise: true,
modules: ['voip-enterprise'],
modules: ['teams-voip'],
},
async function () {
await this.add('VoIP_TeamCollab_Enabled', false, {
Expand Down
1 change: 1 addition & 0 deletions packages/i18n/src/locales/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit bd64aed

Please sign in to comment.