Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use a separate license module for team collab VoIP and omnichannel VoIP #33604

Merged
merged 8 commits into from
Oct 18, 2024
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: ['chat.rocket.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 @@ -2220,6 +2220,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
Loading