Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/rename-freeswitch-extension-to-sip-extension.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@rocket.chat/meteor': major
'@rocket.chat/core-typings': major
'@rocket.chat/rest-typings': major
'@rocket.chat/model-typings': major
'@rocket.chat/models': major
'@rocket.chat/media-calls': major
'@rocket.chat/ui-voip': major
---

Renames the user `freeSwitchExtension` attribute to `sipExtension`, since the VoIP extension is no longer tied to FreeSWITCH and works with any SIP router. Existing users are migrated automatically on upgrade. REST API integrations must switch to the new name: the `users.create` and `users.update` parameters, the `users.info` query parameter, and the `sipExtension` field returned on user objects.
2 changes: 1 addition & 1 deletion apps/meteor/app/apps/server/bridges/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class AppUserBridge extends UserBridge {
}

protected async getBySipExtension(extension: string, _appId: string): Promise<IUser | undefined> {
const user = await Users.findOneByFreeSwitchExtension(extension);
const user = await Users.findOneBySipExtension(extension);

return this.orch.getConverters()?.get('users').convertToApp(user);
}
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/apps/server/converters/codecs/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const UserCodec = z.codec(z.custom<IUser>(), z.custom<IAppsUser>(), {
customFields: user.customFields,
isFederated: user.federated,
federation: user.federation,
sipExtension: user.freeSwitchExtension,
sipExtension: user.sipExtension,
settings: {
preferences: {
...(user?.settings?.preferences?.language && { language: user.settings.preferences.language }),
Expand All @@ -72,6 +72,6 @@ export const UserCodec = z.codec(z.custom<IUser>(), z.custom<IAppsUser>(), {
appId: user.appId,
federated: user.isFederated,
federation: user.federation,
freeSwitchExtension: user.sipExtension,
sipExtension: user.sipExtension,
}) as unknown as IUser,
});
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const WithVoiceCallExtension = {
render: Template,

args: {
freeSwitchExtension: '1234567890',
sipExtension: '1234567890',
},
};

Expand Down
8 changes: 4 additions & 4 deletions apps/meteor/client/components/UserInfo/UserInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type UserInfoDataProps = Serialized<
| 'createdAt'
| 'canViewAllInfo'
| 'customFields'
| 'freeSwitchExtension'
| 'sipExtension'
| 'abacAttributes'
>
>;
Expand Down Expand Up @@ -74,7 +74,7 @@ const UserInfo = ({
canViewAllInfo,
actions,
reason,
freeSwitchExtension,
sipExtension,
abacAttributes,
invitationDate,
...props
Expand Down Expand Up @@ -186,10 +186,10 @@ const UserInfo = ({
</InfoPanelField>
)}

{freeSwitchExtension && (
{sipExtension && (
<InfoPanelField>
<InfoPanelLabel>{t('Voice_call_extension')}</InfoPanelLabel>
<InfoPanelText>{freeSwitchExtension}</InfoPanelText>
<InfoPanelText>{sipExtension}</InfoPanelText>
</InfoPanelField>
)}

Expand Down
6 changes: 3 additions & 3 deletions apps/meteor/client/views/admin/users/AdminUserForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export type AdminUserFormProps = {
};

export type UserFormProps = Omit<
UserCreateParamsPOST & { avatar: AvatarObject; passwordConfirmation: string; freeSwitchExtension?: string },
UserCreateParamsPOST & { avatar: AvatarObject; passwordConfirmation: string; sipExtension?: string },
'fields'
>;

Expand Down Expand Up @@ -84,7 +84,7 @@ const getInitialValue = ({
requirePasswordChange: isNewUserPage && isSmtpEnabled && (data?.requirePasswordChange ?? true),
customFields: data?.customFields ?? {},
statusText: data?.statusText ?? '',
freeSwitchExtension: data?.freeSwitchExtension ?? '',
sipExtension: data?.sipExtension ?? '',
...(isNewUserPage && { joinDefaultChannels: true }),
sendWelcomeEmail: isSmtpEnabled,
avatar: '' as AvatarObject,
Expand Down Expand Up @@ -360,7 +360,7 @@ const AdminUserForm = ({ userData, onReload, context, refetchUserFormData, roleD
<FieldRow>
<Controller
control={control}
name='freeSwitchExtension'
name='sipExtension'
render={({ field }) => <TextInput {...field} id={voiceExtensionId} flexGrow={1} />}
/>
</FieldRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const AdminUserInfoWithData = ({ uid, onReload, tab }: AdminUserInfoWithDataProp
nickname,
canViewAllInfo,
reason,
freeSwitchExtension,
sipExtension,
abacAttributes,
} = data.user;

Expand All @@ -93,7 +93,7 @@ const AdminUserInfoWithData = ({ uid, onReload, tab }: AdminUserInfoWithDataProp
customStatus: <UserStatusText status={status} statusText={statusText} statusExpiresAt={statusExpiresAt} />,
nickname,
reason,
freeSwitchExtension,
sipExtension,
abacAttributes,
};
}, [approveManuallyUsers, data, getRoles]);
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/views/admin/users/AdminUsersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export type UsersFilters = {

export type AdminUsersTab = 'all' | 'active' | 'deactivated' | 'pending';

export type UsersTableSortingOption = 'name' | 'username' | 'emails.address' | 'status' | 'active' | 'freeSwitchExtension';
export type UsersTableSortingOption = 'name' | 'username' | 'emails.address' | 'status' | 'active' | 'sipExtension';

const AdminUsersPage = () => {
const t = useTranslation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ const UsersTable = ({
tab === 'all' && showVoipExtension && (
<GenericTableHeaderCell
width='x180'
key='freeSwitchExtension'
key='sipExtension'
direction={sortData?.sortDirection}
active={sortData?.sortBy === 'freeSwitchExtension'}
active={sortData?.sortBy === 'sipExtension'}
onClick={sortData?.setSort}
sort='freeSwitchExtension'
sort='sipExtension'
>
{t('Voice_call_extension')}
</GenericTableHeaderCell>
Expand Down
17 changes: 2 additions & 15 deletions apps/meteor/client/views/admin/users/UsersTable/UsersTableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,7 @@ export type UsersTableRowProps = {
const UsersTableRow = ({ user, tab, isMobile, isLaptop, isSeatsCapExceeded, showVoipExtension, onClick, onReload }: UsersTableRowProps) => {
const { t } = useTranslation();

const {
_id,
emails,
username = '',
name = '',
roles,
status,
active,
avatarETag,
lastLogin,
type,
freeSwitchExtension,
federated,
} = user;
const { _id, emails, username = '', name = '', roles, status, active, avatarETag, lastLogin, type, sipExtension, federated } = user;

const registrationStatusText = useMemo(() => {
const usersExcludedFromPending = ['bot', 'app'];
Expand Down Expand Up @@ -169,7 +156,7 @@ const UsersTableRow = ({ user, tab, isMobile, isLaptop, isSeatsCapExceeded, show

{tab === 'all' && showVoipExtension && (
<GenericTableCell fontScale='p2' color='hint' withTruncatedText>
{freeSwitchExtension || t('Not_assigned')}
{sipExtension || t('Not_assigned')}
</GenericTableCell>
)}

Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/views/hooks/useMembersList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const endpointsByRoomType = {
} as const;

export type RoomMember = Serialized<
Pick<IUser, 'username' | '_id' | 'name' | 'status' | 'federated' | 'freeSwitchExtension'> & { roles?: IRole['_id'][] } & {
Pick<IUser, 'username' | '_id' | 'name' | 'status' | 'federated' | 'sipExtension'> & { roles?: IRole['_id'][] } & {
Comment thread
KevLehman marked this conversation as resolved.
Resolved
subscription: Pick<ISubscription, '_id' | 'status' | 'ts' | 'roles'>;
}
>;
Expand Down
6 changes: 3 additions & 3 deletions apps/meteor/client/views/room/UserCard/UserCardWithData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const UserCardWithData = ({ username, rid, onOpenUserInfo, onClose }: UserCardWi
utcOffset = defaultValue,
nickname,
avatarETag,
freeSwitchExtension,
sipExtension,
} = data?.user || {};

return {
Expand All @@ -63,7 +63,7 @@ const UserCardWithData = ({ username, rid, onOpenUserInfo, onClose }: UserCardWi
status: _id && <ReactiveUserStatus uid={_id} />,
customStatus: _id && <ReactiveUserStatusText uid={_id} />,
nickname,
freeSwitchExtension,
sipExtension,
};
}, [data, username, showRealNames, isLoading, getRoles]);

Expand All @@ -74,7 +74,7 @@ const UserCardWithData = ({ username, rid, onOpenUserInfo, onClose }: UserCardWi

const { actions: actionsDefinition, menuActions: menuOptions } = useUserInfoActions({
rid,
user: { _id: user._id ?? '', username: user.username, name: user.name, freeSwitchExtension: user.freeSwitchExtension },
user: { _id: user._id ?? '', username: user.username, name: user.name, sipExtension: user.sipExtension },
size: 3,
isMember,
reload: refetch,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ import { useTranslation } from 'react-i18next';

import { useUserInfoActions } from '../../hooks/useUserInfoActions';

export type RoomMembersActionsProps = Pick<IUser, '_id' | 'name' | 'username' | 'freeSwitchExtension'> & {
export type RoomMembersActionsProps = Pick<IUser, '_id' | 'name' | 'username' | 'sipExtension'> & {
rid: IRoom['_id'];
isInvited?: boolean;
reload: () => void;
};

const RoomMembersActions = ({ username, _id, name, rid, freeSwitchExtension, isInvited, reload }: RoomMembersActionsProps) => {
const RoomMembersActions = ({ username, _id, name, rid, sipExtension, isInvited, reload }: RoomMembersActionsProps) => {
const { t } = useTranslation();

const { menuActions: menuOptions } = useUserInfoActions({
rid,
user: { _id, username, name, freeSwitchExtension },
user: { _id, username, name, sipExtension },
reload,
size: 0,
isMember: !isInvited,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { usePreventPropagation } from '../../../../hooks/usePreventPropagation';
import { useUserStatusTooltip } from '../../../../hooks/useUserStatusTooltip';
import type { RoomMember } from '../../../hooks/useMembersList';

export type RoomMembersItemProps = Pick<RoomMember, 'federated' | 'username' | 'name' | '_id' | 'freeSwitchExtension' | 'subscription'> & {
export type RoomMembersItemProps = Pick<RoomMember, 'federated' | 'username' | 'name' | '_id' | 'sipExtension' | 'subscription'> & {
rid: IRoom['_id'];
useRealName: boolean;
reload: () => void;
Expand All @@ -36,7 +36,7 @@ const RoomMembersItem = ({
name,
username,
federated,
freeSwitchExtension,
sipExtension,
onClickView,
rid,
subscription,
Expand Down Expand Up @@ -108,7 +108,7 @@ const RoomMembersItem = ({
name={name}
rid={rid}
_id={_id}
freeSwitchExtension={freeSwitchExtension}
sipExtension={sipExtension}
isInvited={isInvited}
reload={reload}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import RoomMembersItem from './RoomMembersItem';
import type { RoomMember } from '../../../hooks/useMembersList';

export type RoomMembersRowProps = {
user: Pick<RoomMember, 'federated' | 'username' | 'name' | '_id' | 'freeSwitchExtension' | 'subscription'>;
user: Pick<RoomMember, 'federated' | 'username' | 'name' | '_id' | 'sipExtension' | 'subscription'>;
data: {
onClickView: (e: MouseEvent<HTMLElement>) => void;
rid: IRoom['_id'];
Expand All @@ -30,7 +30,7 @@ const RoomMembersRow = ({ user, data: { onClickView, rid }, index, reload, useRe
rid={rid}
name={user.name}
federated={user.federated}
freeSwitchExtension={user.freeSwitchExtension}
sipExtension={user.sipExtension}
subscription={user.subscription}
onClickView={onClickView}
reload={reload}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { UserInfoAction as UserInfoActionType } from '../../hooks/useUserIn
import { useUserInfoActions } from '../../hooks/useUserInfoActions';

export type UserInfoActionsProps = {
user: Pick<IUser, '_id' | 'username' | 'name' | 'freeSwitchExtension'>;
user: Pick<IUser, '_id' | 'username' | 'name' | 'sipExtension'>;
rid: IRoom['_id'];
isInvited?: boolean;
backToList?: () => void;
Expand All @@ -26,11 +26,11 @@ const UserInfoActions = ({ user, rid, isInvited, backToList }: UserInfoActionsPr
} = useMemberExists({ roomId: rid, username: user.username as string });

const isMember = membershipCheckSuccess && isMemberData?.isMember;
const { _id: userId, username, name, freeSwitchExtension } = user;
const { _id: userId, username, name, sipExtension } = user;

const { actions: actionsDefinition, menuActions: menuOptions } = useUserInfoActions({
rid,
user: { _id: userId, username, name, freeSwitchExtension },
user: { _id: userId, username, name, sipExtension },
size: 2,
isMember,
isInvited,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const UserInfoWithData = ({ uid, username, rid, invitationDate, onClose, onClick
nickname,
createdAt,
canViewAllInfo,
freeSwitchExtension,
sipExtension,
} = data.user;

return {
Expand All @@ -88,7 +88,7 @@ const UserInfoWithData = ({ uid, username, rid, invitationDate, onClose, onClick
status: <ReactiveUserStatus uid={_id} />,
customStatus: <ReactiveUserStatusText uid={_id} />,
nickname,
freeSwitchExtension,
sipExtension,
};
}, [data, getRoles]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export type UserMenuAction = {
}[];

type UserInfoActionsParams = {
user: Pick<IUser, '_id' | 'username' | 'name' | 'freeSwitchExtension'>;
user: Pick<IUser, '_id' | 'username' | 'name' | 'sipExtension'>;
rid: IRoom['_id'];
reload?: () => void;
size?: number;
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/server/api/lib/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function findUsersToAutocomplete({
nickname: 1,
status: 1,
avatarETag: 1,
freeSwitchExtension: 1,
sipExtension: 1,
},
sort: {
username: 1,
Expand Down Expand Up @@ -182,7 +182,7 @@ export async function findPaginatedUsersByStatus({
type: 1,
reason: 1,
federated: 1,
freeSwitchExtension: 1,
sipExtension: 1,
};

if (searchTerm?.trim()) {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/server/api/v1/im.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ const dmMembersAction = <Path extends string>(_path: Path): TypedAction<typeof d
statusText: 1,
utcOffset: 1,
federated: 1,
freeSwitchExtension: 1,
sipExtension: 1,
},
skip: offset,
limit: count,
Expand Down
7 changes: 3 additions & 4 deletions apps/meteor/server/api/v1/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ API.v1
validateCustomFields(this.bodyParams.customFields);
}

if (this.bodyParams.freeSwitchExtension && !(await canEditExtension(this.bodyParams.freeSwitchExtension))) {
if (this.bodyParams.sipExtension && !(await canEditExtension(this.bodyParams.sipExtension))) {
return API.v1.failure('Setting user voice call extension is not allowed', 'error-action-not-allowed');
}

Expand Down Expand Up @@ -607,13 +607,12 @@ API.v1.get(
},
},
async function action() {
const searchTerms: [string, 'id' | 'username' | 'importId' | 'email' | 'freeSwitchExtension'] | false =
const searchTerms: [string, 'id' | 'username' | 'importId' | 'email' | 'sipExtension'] | false =
('userId' in this.queryParams && !!this.queryParams.userId && [this.queryParams.userId, 'id']) ||
('username' in this.queryParams && !!this.queryParams.username && [this.queryParams.username, 'username']) ||
('importId' in this.queryParams && !!this.queryParams.importId && [this.queryParams.importId, 'importId']) ||
('email' in this.queryParams && !!this.queryParams.email && [this.queryParams.email, 'email']) ||
('freeSwitchExtension' in this.queryParams &&
!!this.queryParams.freeSwitchExtension && [this.queryParams.freeSwitchExtension, 'freeSwitchExtension']);
('sipExtension' in this.queryParams && !!this.queryParams.sipExtension && [this.queryParams.sipExtension, 'sipExtension']);

if (!searchTerms) {
return API.v1.failure('Invalid search query.');
Expand Down
Loading
Loading