feat(ios): native CallKit + PushKit VoIP calling plugin + web bridge

The native call feature (iOS). Backward-compatible: without the plugin (current
builds) nativeCallOn() is false and every CallKit branch is skipped, so web/older
builds behave exactly as before.

Native (mobile/plugins/native-call, a local Capacitor plugin like audio-route):
- PushKit: registers for VoIP pushes, reports the VoIP token to JS (-> /api/v1/devices
  'ios-voip'). On an incoming VoIP push, reports a CallKit incoming call (full-screen
  ring, works when the app is force-killed).
- CallKit: answer/decline/end -> events to JS; configures the call AVAudioSession on
  didActivate so the WebView's WebRTC audio rides a call-priority session (background).
- Outgoing calls register with CallKit too (reportOutgoingCall) so they get the same
  active-call background-audio context.
- NativeCall.podspec (frameworks CallKit/PushKit/AVFoundation); added to mobile deps;
  ios-patch.sh now sets UIBackgroundModes = [audio, voip] (voip required for PushKit).

Web bridge (home.html): setupNativeCall() registers the VoIP token, joins on CallKit
answer, leaves/declines on CallKit end; on CallKit devices the in-app call-invite popup
+ WebAudio ring are suppressed (the system rings instead); outgoing calls are reported
to CallKit; call-end events dismiss the CallKit call. calls.js threads a stable call
uuid through the dm-call/group-call WS events + start responses so both sides can match
the CallKit call.

Needs a Codemagic build to compile the plugin; first on-device iteration expected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-28 22:34:27 +05:30
parent fd2eb42e25
commit f63aba0ed1
7 changed files with 289 additions and 19 deletions
+5 -1
View File
@@ -46,10 +46,14 @@ set_bool LSSupportsOpeningDocumentsInPlace true
# or the phone locks. Declaring background audio keeps the audio session (and the app) running so a voice
# call continues in the background. (Video RENDERING still pauses while backgrounded — unavoidable in a
# WebView — but audio keeps flowing, which is what matters for a call.) Idempotent: rebuild the array each run.
# 'audio' keeps the call audio session alive when backgrounded; 'voip' is REQUIRED for PushKit to deliver
# VoIP pushes (CallKit incoming-call wake). Both are legitimate for a calling app and accepted by review
# because the app uses CallKit.
"$PB" -c "Delete :UIBackgroundModes" "$PLIST" 2>/dev/null || true
"$PB" -c "Add :UIBackgroundModes array" "$PLIST"
"$PB" -c "Add :UIBackgroundModes:0 string audio" "$PLIST"
echo "UIBackgroundModes: audio (calls keep audio when minimised)"
"$PB" -c "Add :UIBackgroundModes:1 string voip" "$PLIST"
echo "UIBackgroundModes: audio, voip (call audio + CallKit VoIP wake)"
# ── Custom URL scheme so the Share Extension can bounce the user back into the app ──────────────────
# The extension stages the shared files into the App Group, then opens bizconnect://share; the app reads