Repository navigation
fix: use sipExtension instead of freeSwitchExtension on servers >= 9.0.0 - #7796
Conversation
….0.0 Server 9.0.0 renamed the user field freeSwitchExtension to sipExtension (RocketChat/Rocket.Chat#42568). users.autocomplete now rejects conditions on the old field with error-invalid-query, which emptied the New Call peer picker whenever SIP was enabled or a peer with an extension was selected, and left callerId empty. Gate the field name at 9.0.0; older servers keep freeSwitchExtension.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
WalkthroughPeer autocomplete now selects an extension field based on server version. It uses the selected field for extension filtering, peer exclusion, and the returned ChangesVoIP peer autocomplete
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested labels: Suggested reviewers: Merge Risk: ⚪ Minimal · up to
|
Proposed changes
Server 9.0.0 renamed the user field
freeSwitchExtensiontosipExtension(Rocket.Chat#42568, migrationv350,users.autocompletenow projectssipExtension).The New Call peer search still sent conditions on
freeSwitchExtension.users.autocompletevalidatesconditionsagainst a field allow-list that no longer contains the old name, so on 9.0 the whole request fails with400 error-invalid-queryand the picker shows no users. This happened wheneverVoIP_TeamCollab_SIP_Integration_For_Internal_Callswas on, or when a peer with an extension was already selected (the$nebranch).callerIdwas also read from the old field, so it was always empty.getPeerAutocompleteOptionsnow picks the field name from the server version:sipExtensionon>= 9.0.0,freeSwitchExtensionon older servers. The oneextensionFieldvalue drives the$existscondition, the$necondition and thecallerIdmapping. The response item type gainedsipExtension.Issue(s)
https://rocketchat.atlassian.net/browse/NATIVE-1754
How to test or reproduce
Against a server on 9.0.0 or newer:
VoIP_TeamCollab_SIP_Integration_For_Internal_Calls.400 error-invalid-query). After: users with a SIP extension are listed and the selected peer'scallerIdis populated.Against a server older than 9.0.0 the request is unchanged (
freeSwitchExtension).Automated:
pnpm test app/lib/services/voip/getPeerAutocompleteOptions.test.tscovers both sides of the 9.0.0 gate, the SIP-enabled and$neconditions, and thecallerIdmapping. I haven't run this against a live 9.0 server yet; the server behaviour was verified by readingrelease-9.0.0.Screenshots
N/A
Types of changes
Checklist
Further comments
The gate lives in
getPeerAutocompleteOptionsrather than inrestApi.usersAutoCompletebecause that wrapper is a generic pass-through; only this helper knows the field name and thecallerIdmapping. An unknown or empty server version falls back tofreeSwitchExtension, matching the othercompareServerVersiongates in the app.Summary by CodeRabbit