Fix wrong ringerId in auto-ended remote call
This commit is contained in:
parent
fee1359d5b
commit
a60cf05f83
4 changed files with 57 additions and 16 deletions
|
@ -752,7 +752,8 @@ export class CallingClass {
|
|||
);
|
||||
const callEvent = getCallEventDetails(
|
||||
callDetails,
|
||||
localCallEvent
|
||||
localCallEvent,
|
||||
'RingRTC.onLocalDeviceStateChanged'
|
||||
);
|
||||
drop(updateCallHistoryFromLocalEvent(callEvent, null));
|
||||
}
|
||||
|
@ -1757,12 +1758,16 @@ export class CallingClass {
|
|||
const callDetails = getCallDetailsFromEndedDirectCall(
|
||||
callId.toString(),
|
||||
peerId,
|
||||
peerId, // Incoming call
|
||||
remoteUserId, // Incoming call
|
||||
wasVideoCall,
|
||||
envelope.timestamp
|
||||
);
|
||||
const localCallEvent = LocalCallEvent.Missed;
|
||||
const callEvent = getCallEventDetails(callDetails, localCallEvent);
|
||||
const callEvent = getCallEventDetails(
|
||||
callDetails,
|
||||
localCallEvent,
|
||||
'CallingClass.handleCallingMessage'
|
||||
);
|
||||
await updateCallHistoryFromLocalEvent(
|
||||
callEvent,
|
||||
envelope.receivedAtCounter
|
||||
|
@ -2016,7 +2021,8 @@ export class CallingClass {
|
|||
});
|
||||
const callEvent = getCallEventDetails(
|
||||
callDetails,
|
||||
shouldRing ? LocalCallEvent.Ringing : LocalCallEvent.Started
|
||||
shouldRing ? LocalCallEvent.Ringing : LocalCallEvent.Started,
|
||||
'CallingClass.handleGroupCallRingUpdate'
|
||||
);
|
||||
await updateCallHistoryFromLocalEvent(callEvent, null);
|
||||
}
|
||||
|
@ -2108,7 +2114,11 @@ export class CallingClass {
|
|||
const localCallEvent = LocalCallEvent.Missed;
|
||||
const peerId = getPeerIdFromConversation(conversation.attributes);
|
||||
const callDetails = getCallDetailsFromDirectCall(peerId, call);
|
||||
const callEvent = getCallEventDetails(callDetails, localCallEvent);
|
||||
const callEvent = getCallEventDetails(
|
||||
callDetails,
|
||||
localCallEvent,
|
||||
'CallingClass.handleIncomingCall'
|
||||
);
|
||||
await updateCallHistoryFromLocalEvent(callEvent, null);
|
||||
|
||||
return false;
|
||||
|
@ -2161,7 +2171,11 @@ export class CallingClass {
|
|||
);
|
||||
const localCallEvent =
|
||||
getLocalCallEventFromCallEndedReason(callEndedReason);
|
||||
const callEvent = getCallEventDetails(callDetails, localCallEvent);
|
||||
const callEvent = getCallEventDetails(
|
||||
callDetails,
|
||||
localCallEvent,
|
||||
'CallingClass.handleAutoEndedIncomingCallRequest'
|
||||
);
|
||||
await updateCallHistoryFromLocalEvent(callEvent, receivedAtCounter ?? null);
|
||||
}
|
||||
|
||||
|
@ -2191,7 +2205,11 @@ export class CallingClass {
|
|||
if (localCallEvent != null) {
|
||||
const peerId = getPeerIdFromConversation(conversation.attributes);
|
||||
const callDetails = getCallDetailsFromDirectCall(peerId, call);
|
||||
const callEvent = getCallEventDetails(callDetails, localCallEvent);
|
||||
const callEvent = getCallEventDetails(
|
||||
callDetails,
|
||||
localCallEvent,
|
||||
'call.handleStateChanged'
|
||||
);
|
||||
await updateCallHistoryFromLocalEvent(callEvent, null);
|
||||
}
|
||||
|
||||
|
@ -2397,7 +2415,11 @@ export class CallingClass {
|
|||
peerId,
|
||||
groupCallMeta
|
||||
);
|
||||
const callEvent = getCallEventDetails(callDetails, localCallEvent);
|
||||
const callEvent = getCallEventDetails(
|
||||
callDetails,
|
||||
localCallEvent,
|
||||
'CallingClass.updateCallHistoryForGroupCall'
|
||||
);
|
||||
await updateCallHistoryFromLocalEvent(callEvent, null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3450,7 +3450,10 @@ export default class MessageReceiver
|
|||
|
||||
const { receivedAtCounter } = envelope;
|
||||
|
||||
const callEventDetails = getCallEventForProto(callEvent);
|
||||
const callEventDetails = getCallEventForProto(
|
||||
callEvent,
|
||||
'MessageReceiver.handleCallEvent'
|
||||
);
|
||||
|
||||
const callEventSync = new CallEventSyncEvent(
|
||||
{
|
||||
|
|
|
@ -79,6 +79,7 @@ export type CallDetails = Readonly<{
|
|||
export type CallEventDetails = CallDetails &
|
||||
Readonly<{
|
||||
event: CallEvent;
|
||||
eventSource: string;
|
||||
}>;
|
||||
|
||||
export type CallHistoryDetails = CallDetails &
|
||||
|
@ -145,6 +146,7 @@ export const callDetailsSchema = z.object({
|
|||
|
||||
export const callEventDetailsSchema = callDetailsSchema.extend({
|
||||
event: callEventSchema,
|
||||
eventSource: z.string(),
|
||||
}) satisfies z.ZodType<CallEventDetails>;
|
||||
|
||||
export const callHistoryDetailsSchema = callDetailsSchema.extend({
|
||||
|
|
|
@ -65,14 +65,25 @@ import type { ConversationModel } from '../models/conversations';
|
|||
// -----
|
||||
|
||||
export function formatCallEvent(callEvent: CallEventDetails): string {
|
||||
const { callId, peerId, direction, event, type, mode, timestamp } = callEvent;
|
||||
return `CallEvent (${callId}, ${peerId}, ${mode}, ${event}, ${direction}, ${type}, ${mode}, ${timestamp})`;
|
||||
const {
|
||||
callId,
|
||||
peerId,
|
||||
direction,
|
||||
event,
|
||||
eventSource,
|
||||
type,
|
||||
mode,
|
||||
ringerId,
|
||||
timestamp,
|
||||
} = callEvent;
|
||||
const peerIdLog = mode === CallMode.Group ? `groupv2(${peerId})` : peerId;
|
||||
return `CallEvent (${callId}, ${peerIdLog}, ${mode}, ${event}, ${direction}, ${type}, ${mode}, ${timestamp}, ${ringerId}, ${eventSource})`;
|
||||
}
|
||||
|
||||
export function formatCallHistory(callHistory: CallHistoryDetails): string {
|
||||
const { callId, peerId, direction, status, type, mode, timestamp } =
|
||||
const { callId, peerId, direction, status, type, mode, timestamp, ringerId } =
|
||||
callHistory;
|
||||
return `CallHistory (${callId}, ${peerId}, ${mode}, ${status}, ${direction}, ${type}, ${mode}, ${timestamp})`;
|
||||
return `CallHistory (${callId}, ${peerId}, ${mode}, ${status}, ${direction}, ${type}, ${mode}, ${timestamp}, ${ringerId})`;
|
||||
}
|
||||
|
||||
export function formatCallHistoryGroup(
|
||||
|
@ -162,7 +173,8 @@ export function convertJoinState(joinState: JoinState): GroupCallJoinState {
|
|||
// ----------------------
|
||||
|
||||
export function getCallEventForProto(
|
||||
callEventProto: Proto.SyncMessage.ICallEvent
|
||||
callEventProto: Proto.SyncMessage.ICallEvent,
|
||||
eventSource: string
|
||||
): CallEventDetails {
|
||||
const callEvent = callEventNormalizeSchema.parse(callEventProto);
|
||||
const { callId, peerId, timestamp } = callEvent;
|
||||
|
@ -218,6 +230,7 @@ export function getCallEventForProto(
|
|||
direction,
|
||||
timestamp,
|
||||
event,
|
||||
eventSource,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -459,9 +472,10 @@ export function getCallDetailsFromGroupCallMeta(
|
|||
|
||||
export function getCallEventDetails(
|
||||
callDetails: CallDetails,
|
||||
event: LocalCallEvent
|
||||
event: LocalCallEvent,
|
||||
eventSource: string
|
||||
): CallEventDetails {
|
||||
return callEventDetailsSchema.parse({ ...callDetails, event });
|
||||
return callEventDetailsSchema.parse({ ...callDetails, event, eventSource });
|
||||
}
|
||||
|
||||
// transitions
|
||||
|
|
Loading…
Add table
Reference in a new issue