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

[IMPROVE] VoIP admin page cleanup: remove unused settings #25993

Merged
merged 11 commits into from
Jun 29, 2022
17 changes: 0 additions & 17 deletions apps/meteor/app/lib/server/startup/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3210,7 +3210,6 @@ settingsRegistry.addGroup('Call_Center', function () {
this.add('VoIP_Enabled', false, {
type: 'boolean',
public: true,
alert: 'Experimental_Feature_Alert',
enableQuery: {
_id: 'Livechat_enabled',
value: true,
Expand All @@ -3225,22 +3224,6 @@ settingsRegistry.addGroup('Call_Center', function () {
},
});
this.section('Server_Configuration', function () {
this.add('VoIP_Server_Host', '', {
type: 'string',
public: true,
enableQuery: {
_id: 'VoIP_Enabled',
value: true,
},
});
this.add('VoIP_Server_Websocket_Port', 0, {
type: 'int',
public: true,
enableQuery: {
_id: 'VoIP_Enabled',
value: true,
},
});
this.add('VoIP_Server_Name', '', {
type: 'string',
public: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const empty = {};

const isSignedResponse = (data: any): data is { result: string } => typeof data?.result === 'string';

// Currently we only support the websocket connection and the SIP proxy connection being from the same host,
// we need to add a new setting for SIP proxy if we want to support different hosts for them.
export const useVoipClient = (): UseVoipClientResult => {
const [voipEnabled, setVoipEnabled] = useSafely(useState(useSetting('VoIP_Enabled')));
const voipRetryCount = useSetting('VoIP_Retry_Count');
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -4861,7 +4861,7 @@
"VoIP_Server_Host": "Server Host",
"VoIP_Server_Websocket_Port": "Websocket Port",
"VoIP_Server_Name": "Server Name",
"VoIP_Server_Websocket_Path": "Websocket Path",
"VoIP_Server_Websocket_Path": "Websocket URL",
"VoIP_Retry_Count": "Retry Count",
"VoIP_Retry_Count_Description": "Defines the number of times the client will try to reconnect to the VoIP server if the connection is lost.",
"VoIP_Management_Server": "VoIP Management Server",
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/packages/rocketchat-i18n/i18n/pt-BR.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -4748,7 +4748,7 @@
"VoIP_Server_Host": "Hoste do servidor",
"VoIP_Server_Websocket_Port": "Porta do webSocket",
"VoIP_Server_Name": "Nome do servidor",
"VoIP_Server_Websocket_Path": "Caminho do webSocket",
"VoIP_Server_Websocket_Path": "URL do webSocket",
"VoIP_Management_Server": "Servidor de gerenciamento de VoIP",
"VoIP_Management_Server_Host": "Host de servidor",
"VoIP_Management_Server_Port": "Porta do servidor",
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/server/services/voip/lib/Helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export function getServerConfigDataFromSettings(type: ServerType): IVoipCallServ
host: settings.get<string>('VoIP_Server_Host'),
name: settings.get<string>('VoIP_Server_Name'),
configData: {
websocketPort: Number(settings.get<number>('VoIP_Server_Websocket_Port')),
websocketPath: settings.get<string>('VoIP_Server_Websocket_Path'),
},
};
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/server/startup/migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,5 @@ import './v268';
import './v269';
import './v270';
import './v271';
import './v272';
import './xrun';
14 changes: 14 additions & 0 deletions apps/meteor/server/startup/migrations/v272.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Settings } from '@rocket.chat/models';

import { addMigration } from '../../lib/migrations';

addMigration({
version: 272,
async up() {
await Settings.deleteMany({
_id: {
$in: ['VoIP_Server_Host', 'VoIP_Server_Websocket_Port'],
},
});
},
});
3 changes: 1 addition & 2 deletions packages/core-typings/src/IVoipExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,4 @@ export const isIQueueMembershipDetails = (obj: any): obj is IQueueMembershipDeta
export const isIExtensionDetails = (prop: any): prop is IExtensionDetails =>
prop.extension !== undefined && prop.password !== undefined && prop.authtype !== undefined && prop.state !== undefined;

export const isIRegistrationInfo = (prop: any): prop is IRegistrationInfo =>
prop.hasOwnProperty('host') && prop.hasOwnProperty('callServerConfig') && prop.hasOwnProperty('extensionDetails');
export const isIRegistrationInfo = (prop: any): prop is IRegistrationInfo => 'callServerConfig' in prop && 'extensionDetails' in prop;
6 changes: 3 additions & 3 deletions packages/core-typings/src/IVoipServerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ export enum ServerType {

export interface IVoipServerConfigBase {
type: ServerType;
host: string;
name: string;
}

export interface IVoipCallServerConfig extends IVoipServerConfigBase {
host: string;
type: ServerType.CALL_SERVER;
configData: ICallServerConfigData;
}

export interface IVoipManagementServerConfig extends IVoipServerConfigBase {
type: ServerType.MANAGEMENT;
host: string;
configData: IManagementConfigData;
}

Expand All @@ -27,5 +28,4 @@ export interface IManagementConfigData {
password: string;
}

export const isICallServerConfigData = (obj: any): obj is ICallServerConfigData =>
Number.isInteger(obj.websocketPort) && String(obj.websocketPath) === obj.websocketPath;
export const isICallServerConfigData = (obj: any): obj is ICallServerConfigData => String(obj.websocketPath) === obj.websocketPath;
1 change: 0 additions & 1 deletion packages/core-typings/src/voip/IRegistrationInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

export interface ICallServerConfigData {
websocketPort: number;
websocketPath: string;
}
export interface IExtensionDetails {
Expand Down