rebreak-monorepo/ops/CALLKIT_SETUP.md
chahinebrini 822053e11e feat(calls): CallKit/ConnectionService + VoIP-PushKit + EU-Ringback
Caller/Callee UX:
- lib/ringback.ts + assets/sounds/ringback_eu.mp3 (EU 425Hz Festnetz-Tone)
- stores/call.ts: stopRingback bei connected, hangup-reasons, logCallToChat fix
- locales: 'Wird angerufen…' statt 'Ruft an…'

CallKit (iOS) + ConnectionService (Android):
- lib/callkit.ts: setupCallKeep, displayIncomingCall, startOutgoingCall, reportConnected/Ended (appName 'ReBreak-Audio', includesCallsInRecents=false für DSGVO/DiGA)
- hooks/useCallKeepEvents.ts: native answer/end/mute → useCallStore-Actions
- stores/call.ts: CallKit-Aufrufe an allen lifecycle-Punkten
- app.config.ts: @config-plugins/react-native-callkeep + UIBackgroundModes voip/audio + Android-Telecom-Perms

VoIP-PushKit Backend:
- services/voip-push.ts: @parse/node-apn Provider mit .p12 (Topic org.rebreak.app.voip)
- services/push.ts sendCallRingPush: feuert beide Pfade (VoIP iOS + Expo Android/Fallback)
- prisma: push_tokens.voip_token Column + Migration 20260604
- api/users/me/push-token: optional voipToken im Body
- Env (Infisical): APNS_VOIP_P12_PATH/PASSWORD/TOPIC/PRODUCTION

Push-tap routing + cold-start handling:
- app/_layout.tsx: type:'call' Push → useCallStore.receiveIncoming + /call

Docs: ops/CALLKIT_SETUP.md (Apple-Portal-Steps für VoIP-Cert)
2026-06-04 09:27:13 +02:00

58 lines
2.3 KiB
Markdown

# CallKit + VoIP Setup für ReBreak
## 1. CSR generieren (Mac, 2 Min)
```bash
cd /tmp
# Private Key
openssl genrsa -out rebreak-voip.key 2048
# CSR (Common Name muss eindeutig sein — App-Identifier nehmen)
openssl req -new -key rebreak-voip.key -out rebreak-voip.csr \
-subj "/emailAddress=YOUR_APPLE_DEV_EMAIL@example.com/CN=ReBreak VoIP Push/C=DE"
```
`rebreak-voip.csr` an mich, `rebreak-voip.key` **bei dir behalten** (private key, nie teilen).
## 2. Apple Dev Portal (5 Min)
1. https://developer.apple.com/account → Identifiers → App-Identifier `org.rebreak.app` (oder wie deiner heißt)
2. **Capabilities** → ✅ "Push Notifications" + ✅ "Voice over IP" (= das CallKit-Entitlement)
3. → Speichern
4. Certificates → "+" → "**VoIP Services Certificate**"
5. App-Identifier auswählen → CSR von oben hochladen → Download `.cer`
6. **Provisioning Profile** für die App neu generieren + downloaden (weil neue Capabilities)
## 3. Files an mich
- `rebreak-voip.cer` (Apple Output)
- Neues Provisioning Profile `.mobileprovision`
- Den `rebreak-voip.key` NICHT — den brauchen wir nur auf dem Backend (du legst ihn unter `/root/.secrets/rebreak-voip.key` auf Hetzner oder via Infisical)
## 4. .cer in .p8/.p12 konvertieren (ich mach das)
```bash
# .cer (DER) → .pem
openssl x509 -inform DER -outform PEM -in rebreak-voip.cer -out rebreak-voip.pem
# .pem + .key → .p12 (für apn2/node-apn)
openssl pkcs12 -export -inkey rebreak-voip.key -in rebreak-voip.pem \
-out rebreak-voip.p12 -passout pass:CHOOSE_PASSWORD
```
## 5. Was Apple beim nächsten App-Review checkt
- VoIP-Push wird NUR für Calls verwendet (kein silent-sync)
- `reportNewIncomingCall` innerhalb 5s nach Push
- `includesCallsInRecents: false` (Privacy für DiGA — Anrufe sollen NICHT in iCloud sync)
- App-Description in Store sollte Call-Feature erwähnen
Apple-Review-Dauer aktuell: ~24h. Kein Sonder-Antrag, normaler Review.
## 6. Android (kein Apple-Antrag, aber Permission im Manifest)
- `FOREGROUND_SERVICE_PHONE_CALL` (Android 11+ für Mic-Access im Background)
- `MANAGE_OWN_CALLS` (ConnectionService)
- `USE_FULL_SCREEN_INTENT` (Android 14+ für Full-Screen-Call-UI)
- `READ_PHONE_STATE` für Account-Registrierung
→ Alles automatisch via callkeep Config-Plugin, kein Manual-Step von dir.