Skip to content

feat: handle MissedCallEvent in push isolate for reliable caller info #1204

Description

@SERDUN

Background

The signaling server emits a MissedCallEvent (with caller and optional callerDisplayName) but the push isolate (PushNotificationIsolateManager) does not handle it. Instead, missed-call state is reconstructed by inferring it from a HangupEvent combined with the absence of an answered call.

Problem

The current approach relies on two timing-sensitive data sources:

  1. IncomingCallEvent.caller — only available if the push isolate connected before the event passed through the hub. In late-connect scenarios the event is already gone.
  2. _metadata.handle.value (FCM push payload) — reliable for the phone number, but carries no display name if the server did not include one in the push payload.

This fragile fallback chain was the root cause of WT-1416 (missed call showing "Unknown"). A partial fix was applied in PR #1203, but the underlying architecture remains fragile.

Proposed Solution

Add a MissedCallEvent handler in PushNotificationIsolateManager:

// packages/webtrit_signaling/lib/src/events/call/missed_call_event.dart
// Already exists — no changes needed
class MissedCallEvent extends CallEvent {
  final String callee;
  final String caller;             // reliable phone number
  final String? callerDisplayName; // optional display name
}
// lib/features/call/services/isolate_manager.dart
case MissedCallEvent():
  _onHangupCall(syntheticHangupFrom(event), (
    direction: CallDirection.incoming,
    number: event.caller,
    username: event.callerDisplayName,
    ...
  ));

By consuming MissedCallEvent directly the isolate gets authoritative caller data from the server instead of reconstructing it from race-prone state.

Expected Outcome

  • caller always contains the real phone number
  • callerDisplayName contains the display name when the server provides it
  • Eliminates the race condition between IncomingCallEvent and HangupEvent
  • Simplifies _getDisplayNameForMissedCall() fallback chain

Scope

  • lib/features/call/services/isolate_manager.dart — add MissedCallEvent case in _onProtocolEvent
  • Verify the server actually sends MissedCallEvent in all missed-call scenarios (may need server-side confirmation)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions