From 96ae9bb01f6ccd0cd59ed7cd34d358b7189371f6 Mon Sep 17 00:00:00 2001 From: Gautier DI FOLCO Date: Tue, 4 Aug 2026 11:56:08 +0200 Subject: [PATCH] fix: resolve original caller for call-end "called" message handleMissedCall injected the deactivate event with the missedh userId (the sender of the missed-trigger message), so the "$USER called" conversation message named the wrong participant. Use the original caller captured at ring time (call.initiator = AVS SETUP sender) when a Call object exists for the conversation, falling back to the missedh userId only when none is present (e.g. the app cold-launched straight into a missed call). callClosed already used call.initiator. --- .../script/repositories/calling/CallingRepository.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/webapp/src/script/repositories/calling/CallingRepository.ts b/apps/webapp/src/script/repositories/calling/CallingRepository.ts index e2bb7a188b0..7062707a5ce 100644 --- a/apps/webapp/src/script/repositories/calling/CallingRepository.ts +++ b/apps/webapp/src/script/repositories/calling/CallingRepository.ts @@ -636,9 +636,16 @@ export class CallingRepository { private readonly handleMissedCall = (conversationId: string, timestamp: number, userId: string) => { const callDuration = 0; + const parsedConversationId = this.parseQualifiedId(conversationId); + // Prefer the original caller captured when the call started ringing + // (call.initiator = AVS SETUP sender) over the `missedh` userId, which + // is the sender of the missed-trigger message and usually not the + // caller. Falls back when no Call exists locally (e.g. the app + // cold-launched straight into a missed call). + const callerId = this.findCall(parsedConversationId)?.initiator ?? this.parseQualifiedId(userId); this.injectDeactivateEvent( - this.parseQualifiedId(conversationId), - this.parseQualifiedId(userId), + parsedConversationId, + callerId, callDuration, REASON.CANCELED, new Date(timestamp * 1000).toISOString(),