Passer à la navigation

Prise en main

GitHub

Vous pouvez utiliser notre configuration assistée par l'IA pour installer le plugin. Ajoutez les Capgo compétences à votre outil IA en utilisant la commande suivante :

Fenêtre de terminal
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

Ensuite, utilisez la prompt suivante :

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-incoming-call-kit` plugin in my project.

Si vous préférez la configuration manuelle, installez le plugin en exécutant les commandes suivantes et suivez les instructions spécifiques au plateforme ci-dessous :

  1. Installez le package

    fenêtre de terminal
    bun add @capgo/capacitor-incoming-call-kit
  2. Syncronisez les projets natifs

    fenêtre de terminal
    bunx cap sync
  3. Synchroniser les projets natifs Decide whether the incoming-call event comes from your backend, an SDK such as Twilio or Stream, or a native push path such as FCM or PushKit.

Comment les composants s'intègrent

Comment les éléments s'ajustent-ils

Cette extension ne gère que la présentation des appels entrants natifs. Votre application conserve la gestion du transport, de l'authentification et de la session média réelle.

La stratégie de production courante est :

  1. Votre backend ou votre appel SDK émet un événement de sonnerie.
  2. Votre application appelle showIncomingCall().
  3. The plugin presents native incoming-call UI.
  4. callAccepted lui dit à votre application de rejoindre la salle ou la session VoIP réelle.
  5. callDeclined, callEnded, or callTimedOut ordonne à votre application de nettoyer l'état distant.

Section intitulée “Intégration minimale”

Copier dans le presse-papier
import { IncomingCallKit } from '@capgo/capacitor-incoming-call-kit';
await IncomingCallKit.requestPermissions();
await IncomingCallKit.requestFullScreenIntentPermission();
await IncomingCallKit.addListener('callAccepted', async ({ call }) => {
console.log('Accepted', call.callId, call.extra);
// Start or join your real call session here.
});
await IncomingCallKit.addListener('callDeclined', ({ call }) => {
console.log('Declined', call.callId);
// Tell your backend or SDK that the user declined.
});
await IncomingCallKit.addListener('callTimedOut', ({ call }) => {
console.log('Timed out', call.callId);
// Clear ringing state in your backend or SDK.
});
await IncomingCallKit.showIncomingCall({
callId: 'call-42',
callerName: 'Ada Lovelace',
handle: '+39 555 010 020',
appName: 'Capgo Phone',
hasVideo: true,
timeoutMs: 45_000,
extra: {
roomId: 'room-42',
callerUserId: 'user_ada',
},
android: {
channelId: 'calls',
channelName: 'Incoming Calls',
showFullScreen: true,
},
ios: {
handleType: 'phoneNumber',
},
});

Section intitulée “Options importantes”

: identifiant stable réutilisé plus tard avec
  • callId: identifiant stable réutilisé ultérieurement avec endCall()
  • timeoutMs: temps d'attente sans réponse
  • extra: JSON arbitraire renvoyé dans les payloads des écouteurs
  • android.channelId et android.channelName: réglage du canal de notification Android
  • android.showFullScreen: demande l'activité d'appel en plein écran Android
  • ios.handleType: choisir generic, phoneNumber, ou emailAddress pour CallKit
const { calls } = await IncomingCallKit.getActiveCalls();
await IncomingCallKit.endCall({
callId: 'call-42',
reason: 'remote-ended',
});
await IncomingCallKit.endAllCalls({
reason: 'session-reset',
});
  • incomingCallDisplayed: native UI was shown successfully
  • callAccepted: user accepted from the native UI
  • callDeclined: l'utilisateur a refusé avant de rejoindre
  • callEnded: votre application ou la plateforme a terminé l'appel suivi
  • callTimedOut: l'appel est resté sans réponse jusqu'à timeoutMs

Each event carries the normalized call Remarques de la plateforme extra object.

Remarques sur la plateforme

Lisez le guide de style
  • Lisez le Guide iOS avant de brancher CallKit dans un flux PushKit ou APNs.
  • Lisez le Guide Android pour Android Avant de vous fier aux intentions d'écran plein écran sur Android 14 et ultérieurs.
  • Le web n'est pas pris en charge.

Continuez de la section Getting Started

La version Web n'est pas prise en charge.

Continuez de la section « Commencer » Section intitulée “Continuez de la section « Commencer »” planer le tableau de bord et les opérations API, connectez-l’à Utilisation de @capgo/capacitor-kit-de-callbacks-entrant pour la capacité native dans Utiliser @capgo/capacitor-kit d'appel entrant, API Vue d'ensemble pour le détail d'implémentation dans API Vue d'ensemble, Introduction pour le détail d'implémentation dans Introduction, API Clés pour le détail d'implémentation dans API Clés, et Appareils pour les détails d'implémentation sur les appareils.