element-hq / element-hq/element-call
Audio crackle when a call connects (CallKit requesttransaction error, Code=4 / unknownCallUUID)
- Dominant language
- TypeScript
- Stars
- 996
- Forks
- 213
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 55
Description
### Steps to reproduce
1. Start an audio or video call with another user (in our case, mostly reproduced over a WireGuard tunnel + cellular data on the caller's side, callee on local WiFi).
2. Listen closely during the ringing/connecting phase, before the callee answers, and also during the active conversation itself.
3. A short audio crackle/click is audible both when the call connects and, less frequently, during the ongoing call.
### Outcome
#### What did you expect?
No audible artifacts when a call connects or during the conversation.
#### What happened instead?
A short crackle/click is heard around the moment the call connects (transition from lobby to active call), and occasionally during the call itself.
We run our own self-hosted Synapse + LiveKit (MatrixRTC) backend and were able to rule out network/server causes:
- Server-side LiveKit logs show zero network/RTC activity during the entire ringing phase (from local track publish until the callee joins), so the crackle heard while ringing cannot originate from the network or the audio codec.
- A separate, more frequent crackling issue (heard throughout active calls) was traced and fixed server-side by switching LiveKit from a UDP port range to a single fixed UDP port (eliminating ICE candidate "flapping" at connection start). This greatly reduced the crackling, but a residual, less frequent artifact remains.
The app's own console log shows a concrete, consistently reproducible error at the exact moment each call connects (3 out of 3 call attempts in the attached log show this, each time in the same spot — right as the call screen transitions from lobby to the active GroupCallView):
ERROR: Failed toggling call microphone with error: Error Domain=com.apple.CallKit.error.requesttransaction Code=4
This fires twice in immediate succession at connect time, every time. CallKit error code 4 corresponds to `unknownCallUUID` in Apple's CXErrorCodeRequestTransactionError — suggesting a race condition where Element X requests a mute/unmute transaction for a call UUID that CallKit hasn't (yet) registered.
A similar error also fires at call teardown:
ERROR: Failed transaction with error: Error Domain=com.apple.CallKit.error.requesttransaction Code=4
ERROR: Failed to send close action
We suspect this CallKit transaction race is the most likely remaining cause of the audible crackle, given it fires reliably and precisely at the moments the crackle is heard (connect and, in some cases, disconnect), and everything network/codec-related has been ruled out server-side.
Anonymized console log attached (domain, usernames, device IDs, and auth tokens redacted; the CallKit error lines themselves are preserved verbatim).
We also submitted a Rageshake report for the same issue shortly before opening this issue.
### Your phone model
iPhone 17 Pro
### Operating system version
iOS 27 DP5
### Application version
Version: 26.08.2 (240)
### Homeserver
Self-hosted Synapse (own domain, anonymized in the attached log)
### Will you send logs?
Yes
Contributor guide
Research direction
Start at the GroupCallView transition and trace the CallKit microphone transaction and teardown paths around the reported connect and disconnect logs. Reproduce the call with the attached console output, then verify that transactions no longer target an unregistered call UUID and that the connection and teardown transitions produce no audible crackle.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, typescript
- Domain
- audio-video-rtc, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100