Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Fix unwanted ringing of other devices even though the user is already connected to the call. #12742

Merged
merged 2 commits into from
Jul 25, 2024

Conversation

toger5
Copy link
Contributor

@toger5 toger5 commented Jul 9, 2024

If a call notify event is received but a user is already part of the call (with any other device) no device should ring.
The spec asks clients to never send notify events for already ongoing calls. But since it is possible (and currently happens when EX has not yet synced state when they join a call) it is best to check if the user is connected to the call before ringing.

This is how its expected to behave in the msc text:

  • Current user is a member of the the call (room state):
    None of the devices should ring if they receive a m.call.notify if the
    rooms state m.call.member event of the user contains a membership for
    the call in the m.call.notify event.
    This includes stopping the current ring sound if the room state updates so
    this condition is true.

matrix-org/matrix-spec-proposals#4075

The updating was already implemented but the check on notify event retrival was missing.

Checklist

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • Sign-off given on the changes (see CONTRIBUTING.md).

@toger5 toger5 requested a review from a team as a code owner July 9, 2024 11:10
Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide a description so someone is able to review it without context

@t3chguy
Copy link
Member

t3chguy commented Jul 10, 2024

Check if the user is already connected to the call.

This doesn't make for a very clear changelog entry, please update

@toger5 toger5 force-pushed the toger5/call-notify-dont-ring-when-already-connected branch from 42b736b to e7efaf6 Compare July 10, 2024 07:28
@toger5 toger5 changed the title Check if the user is already connected to the call. Fix ringing of other devices even though the user is already connected to the call. Jul 10, 2024
@toger5 toger5 changed the title Fix ringing of other devices even though the user is already connected to the call. Fix unwanted ringing of other devices even though the user is already connected to the call. Jul 10, 2024
@toger5 toger5 requested a review from t3chguy July 15, 2024 14:57
@toger5 toger5 force-pushed the toger5/call-notify-dont-ring-when-already-connected branch from e7efaf6 to bbf1f9b Compare July 15, 2024 15:00
src/Notifier.ts Show resolved Hide resolved
Comment on lines +29 to +32
// eslint-disable-next-line no-restricted-imports
import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession";
// eslint-disable-next-line no-restricted-imports
import { CallMembership } from "matrix-js-sdk/src/matrixrtc/CallMembership";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto. Seems like matrixrtc should have an index with all its public exports and we should allowlist that and consume that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making me finally take care of this...
matrix-org/matrix-js-sdk#4314
and
#12780

I dont think this fits into this PR and I would like to not block this PR on the js-sdk fix (its rather annoying to not have the ringing stop)

So my proposal would be to merge this without the lint rules and I keep the other PR's ontop of this so we can review and merge them independently?

This is done by checking if a user is already connected to the call on
another device before playing the ring sound.
@toger5 toger5 force-pushed the toger5/call-notify-dont-ring-when-already-connected branch from bbf1f9b to 61590b2 Compare July 25, 2024 09:19
@toger5 toger5 added this pull request to the merge queue Jul 25, 2024
Merged via the queue into develop with commit 2e0716c Jul 25, 2024
29 checks passed
@toger5 toger5 deleted the toger5/call-notify-dont-ring-when-already-connected branch July 25, 2024 09:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants