matrix-org / matrix-org/matrix-js-sdk

Version 0 `m.call.hangup` to reject an `m.call.invite` is ignored

Open
#2,393 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

T-Defect
Dominant language
TypeScript
Stars
2.2k
Forks
704
Avg merge
1d 20h
Merged PRs (30d)
40

Description

**Describe the bug**
When sending a version 0 `m.call.hangup` event to reject a call after receiving an `m.call.invite` from Element Web, the call is not ended on Element Web's side.

These messages show up in the logs:

```
Hangup received for call ID abcdef123
Ignoring message from party ID undefined: our partner is undefined
```

**To Reproduce**
Steps to reproduce the behavior:
1. Open a 1-to-1 room in Element Web
2. Click on 'Audio Call'
3. From another client send an `m.call.hangup` event with the proper `call_id` and `version: 0`.
4. The call is still "ringing" on Element Web.

**Expected behavior**
The call should end on Element Web's side.

**Desktop (please complete the following information):**
- OS: Linux Fedora 36
- Browser: Firefox
- Version: 100.0
- Element Web v1.10.12

**Additional context**
Looking at the code, the error seems to be that:
1. `this.opponentPartyId` is `undefined` because no opponent was chosen yet.
2. [When the version is 0, `msgPartyId` is set to `null` in `partyIdMatches()`](https://github.com/matrix-org/matrix-js-sdk/blob/25afb7cb3cc612656458c00569cf03c42277aae2/src/webrtc/call.ts#L2196),
3. [`partyIdMatches()` returns `false`](https://github.com/matrix-org/matrix-js-sdk/blob/25afb7cb3cc612656458c00569cf03c42277aae2/src/webrtc/call.ts#L2197) because `null !== undefined`,
4. The condition fails in [`onHangupReceived()`](https://github.com/matrix-org/matrix-js-sdk/blob/25afb7cb3cc612656458c00569cf03c42277aae2/src/webrtc/call.ts#L1856) so the event is ignored.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/webrtc/call.ts at partyIdMatches() and onHangupReceived(), as identified in the issue. Trace the version 0 hangup path when opponentPartyId is undefined, then reproduce the one-to-one call scenario or add focused coverage if the existing test structure is clear. Done means a version 0 m.call.hangup with the call_id ends the ringing call in Element Web.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
audio-video-rtc
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.