chore!: rename user freeSwitchExtension attribute to sipExtension

Merged
KE
2mo ago
+150-131

Proposed changes (including videos or screenshots)

The freeSwitchExtension user attribute dates from the first VoIP version, which was tied to FreeSWITCH. The new VoIP architecture reuses it but works with any SIP router, so this renames it to sipExtension. The Apps-Engine already uses that name.

  • Renames the field across IUser, the Users model and its unique sparse index, the model method (findOneBySipExtension), REST typings, server code, the admin and room UI, ui-voip and media-calls.
  • Adds migration v349, which renames the field with $rename in batches of 1000 users and drops the old freeSwitchExtension_1 index. The model creates the sipExtension_1 index on startup; existing values are already unique, so renamed values can't conflict.

Breaking: REST clients must use sipExtension in the users.create and users.update body, as the users.info lookup parameter, and when reading user objects.

Issue(s)

https://rocketchat.atlassian.net/browse/CORE-2748

Steps to test or reproduce

  1. On a workspace running the previous version, assign a VoIP extension to a few users (Administration > Users > Edit).
  2. Upgrade to this branch and let migrations run.
  3. Users keep their extension, now stored as sipExtension, and freeSwitchExtension is gone from every user document.
  4. GET /api/v1/users.info?sipExtension=<ext> returns the user, and voice calls by extension still work.

Further comments

I checked the migration logic against MongoDB 7 with 2,503 users, 1,252 of them with an extension. All were renamed across several batches, and only the new index remained.

Summary by CodeRabbit

  • New Features
    • SIP integrations can use sipExtension to create and update users, look up users through the REST API, and receive the extension in user details.
    • Admin screens display and support sorting by SIP extension, and existing user extensions are migrated automatically.
  • Bug Fixes
    • User search, voice-call routing, and extension availability checks now use SIP extensions.