Skip to main content

🔔 VoIP Push Notification Setup (iOS)

⚠️ Important Notes:

  • Real Device Only: iOS VoIP Push only works on physical devices. It does not work on the iOS Simulator.
  • Annual VoIP Certificate Renewal (1-Year Expiry): Apple VoIP Services Certificates (.p12) expire every 1 year. You must generate a renewed certificate on the Apple Developer Portal and re-upload the updated .p12 file to the Portal periodically each year to maintain uninterrupted VoIP push notification delivery.

🌟 Overview​

When a user receives a call, VoIP Server sends a push notification to your app. The app then wakes up via CallKit to display the native incoming call UI.

VoIP Flow

Native Call Experience​

iOS (Alert)iOS (Lock Screen)iOS (Full Screen)
iOS AlertiOS Lock ScreeniOS Full Screen

🛠 Step-by-Step Guide​

📌 Step 1: Apple Developer Configuration​

You need to generate two items: a VoIP Services Certificate (for CallKit) and an APNs Key (for Firebase).

1.1 Create VoIP Services Certificate​

  1. Go to Apple Developer Certificates.
  2. Click (+) to create a new certificate.
  3. Select VoIP Services Certificate under Services. push_img_10
  4. Choose your App ID and click Continue. push_img_9
  5. Upload your Certificate Signing Request (CSR) and Download the .cer file. push_img_8
  6. Follow the instructions to create a certificate signing request.
  7. Double-click the .cer file to install it into Keychain Access.
  8. Right-click the certificate in Keychain Access and export it as a .p12 file. (Keep this file for Step 4). push_img_7

1.2 Create APNs Key (For Firebase)​

  1. Go to Keys in the Apple Developer sidebar.
  2. Create a new key and enable Apple Push Notifications service (APNs). apns_key
  3. Download the .p8 file. (Keep this file for Step 3).

📌 Step 2: Xcode & iOS Project Configuration​

2.1 Enable Capabilities​

Open your project in Xcode → Signing & Capabilities:

  1. Add Push Notifications.

  2. Add Background Modes and check all of the following:

    • ✅ Voice over IP (voip)
    • ✅ Audio, AirPlay, and Picture in Picture (audio)
    • ✅ Background fetch (fetch)
    • ✅ Remote notifications (remote-notification)

    push_img_5

    (Optional) Or configure directly in Info.plist:

    <key>UIBackgroundModes</key>
    <array>
    <string>audio</string>
    <string>fetch</string>
    <string>processing</string>
    <string>remote-notification</string>
    <string>voip</string>
    </array>

2.2 Add Firebase Configuration​

  1. Download GoogleService-Info.plist from your Firebase Console.

  2. Drag and drop it into your Xcode project root (under the main app target folder).

  3. Important: Ensure "Copy items if needed" is checked.

    ios_google_service_2

2.3 Configure CocoaPods for static linking​

RNFirebase autolinks Firebase. Do not add the Firebase umbrella pod or FirebaseMessaging manually. When the app uses static CocoaPods libraries, add the following module-map overrides inside the application target:

target 'YourApp' do
config = use_native_modules!

pod 'FirebaseCore', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true

# use_react_native!(...)
end

Skip these individual overrides if the Podfile already calls use_modular_headers! globally.

2.4 Integrate with AppDelegate​

Merge the initialization below into your existing AppDelegate. Keep its React Native startup code and sourceURL(for:) / bundleURL() overrides, as shown in the example AppDelegate.

Option A: Swift (AppDelegate.swift - RN 0.74+)​
import UIKit
import React
import React_RCTAppDelegate
import FirebaseCore
import react_native_pitel_voip_v2

@main
class AppDelegate: RCTAppDelegate {
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
self.moduleName = "YourAppName"
self.initialProps = [:]

FirebaseApp.configure()

// Initialize PushKit listener before bridge starts
_ = PitelVoIPDelegate()
PitelVoIP.configure()

let result = super.application(application, didFinishLaunchingWithOptions: launchOptions)

PitelVoIP.registerCallPresentationHostProvider { [weak self] in
self?.window.rootViewController
}

return result
}
}

Keep RNFirebase method swizzling enabled. Do not manually override APNs token or remote-notification callbacks in AppDelegate; RNFirebase must be the only owner of those callbacks.

Option B: Objective-C (AppDelegate.mm)​
  1. Import the Swift bridging header of the VoIP module & Firebase:

    #import <FirebaseCore/FirebaseCore.h>
    #import <react_native_pitel_voip_v2/react_native_pitel_voip_v2-Swift.h>
  2. Initialize PitelVoIPDelegate, configure SDK bootstrap, and register call presentation host:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    self.moduleName = @"YourAppName";
    self.initialProps = @{};

    // 1. Configure Firebase Core
    [FIRApp configure];

    // 2. Initialize PitelVoIPDelegate before JS bridge starts
    (void)[[PitelVoIPDelegate alloc] init];
    [PitelVoIPBootstrap configure];

    BOOL result = [super application:application didFinishLaunchingWithOptions:launchOptions];

    // 3. Register presentation host for native Call Screen
    [PitelVoIPBootstrap registerCallPresentationHostProvider:^UIViewController * _Nullable{
    return self.window.rootViewController;
    }];

    return result;
    }

2.5 Configure Info.plist​

Add required usage descriptions and background modes in ios/<YourAppName>/Info.plist inside <dict>:

<!-- Microphone Permission (Mandatory) -->
<key>NSMicrophoneUsageDescription</key>
<string>Need microphone access for VoIP calls.</string>

<!-- Bluetooth Permission (Optional - for Bluetooth headsets) -->
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Need Bluetooth access for VoIP calls.</string>

<!-- Local Network Permission (for Metro Bundler Debugging & SIP Discovery) -->
<key>NSLocalNetworkUsageDescription</key>
<string>Need local network access to discover and connect to SIP server.</string>

<!-- Background Modes (can also be configured via Xcode Capabilities) -->
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>voip</string>
<string>fetch</string>
<string>remote-notification</string>
</array>

📌 Step 3: Firebase & Server Configuration​

3.1 Upload APNs Key to Firebase​

  1. Go to Firebase Console → Project Settings → Cloud Messaging.
  2. Under Apple app configuration, locate your iOS app. ios_app
  3. Upload the .p8 APNs Key (from Step 1.2).
  4. Enter your Key ID and Team ID. upload_key_firebase_popup

3.2 Generate Service Account​

VoIP Server uses this to send push notifications on your behalf.

  1. In Firebase Console, go to Project Settings → Service Accounts.
  2. Click Generate new private key. fcm7
  3. A .json file will be downloaded. (Keep this file for Step 4). fcm8

3.3 Obtain & Forward FCM Token in React Native​

React Native Firebase automatically registers with APNs. Request notification permission, then retrieve and forward the FCM token:

import { Platform } from 'react-native';
import { getMessaging, getToken, onTokenRefresh, requestPermission } from '@react-native-firebase/messaging';
import { PitelVoipClient } from 'react-native-pitel-voip-v2';

const messaging = getMessaging();

if (Platform.OS === 'ios') {
await requestPermission(messaging);
}

const fcmToken = await getToken(messaging);
if (fcmToken) {
await PitelVoipClient.instance.setFCMToken(fcmToken);
}

onTokenRefresh(messaging, async token => {
await PitelVoipClient.instance.setFCMToken(token);
});

Register the background handler once in the application entry file, before AppRegistry.registerComponent:

import { getMessaging, setBackgroundMessageHandler } from '@react-native-firebase/messaging';
import { PitelVoipClient } from 'react-native-pitel-voip-v2';

setBackgroundMessageHandler(getMessaging(), async message => {
if (message.data) {
await PitelVoipClient.instance.handlePushNotification(message.data);
}
});

Use onMessage for the same forwarding while the app is in the foreground. Do not also forward FCM payloads from AppDelegate.


🚀 Step 4: Update VoIP Portal​

Finally, upload the necessary credentials to the Portal to activate VoIP services.

  1. Upload .p12 File: The VoIP Certificate from Step 1.1.
  2. Upload .json File: The Service Account file from Step 3.2.
WARNING

Annual Renewal Requirement: Apple VoIP Certificates expire every 1 year. Remember to set an annual reminder to renew your certificate and re-upload the updated .p12 to the Portal.

Note: Ensure you have configured your app on the portal as described in the Portal Guide.


✅ Testing​

Run the app on a Real Device (iPhone) to test receiving calls in the background and locked state.

push_img_1