Skip to content

Recognise remote-cancellation pushes in managed PushKit mode - #11

Merged
PetrShtuka merged 1 commit into
mainfrom
feature/managed-pushkit-cancellation
Aug 7, 2026
Merged

Recognise remote-cancellation pushes in managed PushKit mode#11
PetrShtuka merged 1 commit into
mainfrom
feature/managed-pushkit-cancellation

Conversation

@PetrShtuka

@PetrShtuka PetrShtuka commented Aug 6, 2026

Copy link
Copy Markdown
Owner

What

SDK-managed PushKit (CallWaveIntegrationOptionManagesVoIPPushRegistry) previously treated every VoIP push as a new incoming call. Cancellation payload detection existed only in IntercomDemo, which manually called handleCancelledIncomingCall. This PR moves cancellation detection into the SDK.

Changes

  • CallWaveIncomingCallDescriptor: added the isCancellation flag and the +cancellationDescriptorWithUUID: factory method. The existing API remains unchanged.
  • descriptorForPushPayload: now recognizes built-in type / event markers with values cancel / cancelled / cancellation (case-insensitive, either inside data or at the top level). Hosts using a custom payload format can return a cancellation-marked descriptor from pushPayloadParser.
  • handleVoIPPushPayload:completion:: cancellation payloads are never passed to reportNewIncomingCallWithUUID:. Instead, they are routed through the existing handleCancelledIncomingCallWithUUID:reason:completion: path with CXCallEndedReasonRemoteEnded, including the tombstone case where the cancellation arrives before the announce push. The push completion handler is acknowledged exactly once through CallWavePushCompletionGate.
  • Duplicate announce-push handling in host-owned mode: a second push for a UUID that is already visible in CallKit no longer republishes the incoming event or restarts the ring timeout.
  • Documentation in CallWaveClient.h has been updated.

Tests

Added CallWavePushCancellationTests with 6 cases: cancellation before INVITE, all supported cancellation markers, the tombstone race (cancel → late announce push does not ring), “cancellation never becomes a new incoming call,” duplicate push handling, and cancellation through a custom parser.

iOS Simulator test run: 54 tests, 0 failures (Scripts/run-package-tests.sh).

Replaces #10 (that branch was based on the 0.3.1 line and conflicted with 0.4.x).

A payload whose descriptor isCancellation (built-in markers: type/event
equal to cancel/cancelled/cancellation under data or at the top level)
is no longer reported to CallKit as a new incoming call. It is routed
to -handleCancelledIncomingCallWithUUID:reason:completion: with
CXCallEndedReasonRemoteEnded instead — the incoming-call screen comes
down, a call whose INVITE has not arrived is remembered so the late
INVITE is answered 603, and a cancellation that overtook the
announcement push leaves a tombstone that cannot ring.

Hosts with a different marker shape return a descriptor whose
cancellation flag is set from pushPayloadParser.

Also deduplicates repeat announcement pushes in host-owned CallKit
mode: a second push for a UUID that is already on the CallKit screen
no longer re-publishes the incoming state or restarts the ring timeout.

Adds CallWavePushCancellationTests covering cancel-before-INVITE,
marker variants, the tombstone race, duplicate pushes and custom
parser cancellations.
@PetrShtuka
PetrShtuka merged commit fa3bb5f into main Aug 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant