Skip to main content

πŸ”” VoIP Push Notification Setup

For the full host-app setup sequence, see iOS setup in the primary integration guide. This page retains the detailed Apple, Firebase, and Portal walkthrough.

⚠️ Important Notes:

  • Real Device Only: iOS VoIP Push only works on physical devices. It does not work on the Simulator.
  • Annual Renewal: VoIP Certificates must be renewed annually on the Apple Developer Portal and updated on the Pitel Portal.

🌟 Overview​

When a user receives a call, Pitel Server sends a push notification to your app. Incoming iOS VoIP calls arrive through PushKit over APNs; the plugin integrates PushKit and CallKit to display the native incoming-call UI. Firebase Messaging callbacks are not the iOS VoIP wake-up path.

The SDK obtains PushKit's VoIP token through its native plugin lifecycle and uses it for VoIP call delivery. The Firebase FCM token is a separate value supplied by the host with PitelVoipClient.setFCMToken(); it does not replace the PushKit token or make Firebase Messaging callbacks the incoming-call route. Configure the Apple/Firebase/Portal credentials below and initialize Firebase in the host app as applicable. Allow time for both token sources to become available before treating push registration as ready: SIP registered confirms SIP registration, not successful push delivery.

Pitel 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 a VoIP Services Certificate (.p12) for the Pitel Portal and an APNs authentication key (.p8) for Firebase. The Firebase service-account JSON is a separate Portal/backend credential.

1.1 Create VoIP Services Certificate​

  1. Create a Certificate Signing Request (CSR) in Keychain Access by following Apple's instructions.
  2. Go to Apple Developer Certificates and click (+) to create a certificate.
  3. Select VoIP Services Certificate under Services. push_img_10
  4. Choose your App ID and click Continue. push_img_9
  5. Upload the CSR you created and download the .cer file. push_img_8
  6. Double-click the .cer file to install it into Keychain Access.
  7. Right-click the certificate in Keychain Access and export it as a .p12 file. Keep it for the Portal upload in 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 Project Configuration​

2.1 Enable Capabilities​

Open your project in Xcode β†’ Signing & Capabilities:

  1. Add Push Notifications.

  2. Add Background Modes required by the calling app. The tested example enables Voice over IP, Audio, AirPlay, and Picture in Picture, Background fetch, and Remote notifications. Use the calling-related modes needed by your app and verify them on a device; Background fetch is not itself the VoIP push mechanism.

    push_img_5

    (Optional) Or configure directly in ios/Runner/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 (ios/Runner/).

  3. Important: Ensure "Copy items if needed" is checked and the Runner target is selected under Target Membership in Xcode File Inspector.

    ios_google_service_2

2.3 Configure Info.plist (Microphone Permission)​

Open ios/Runner/Info.plist and add the microphone usage description to allow outbound and inbound VoIP calls:

<key>NSMicrophoneUsageDescription</key>
<string>Microphone access is required to make and receive VoIP calls.</string>

2.4 Verify Minimum iOS Target (Podfile)​

Open ios/Podfile and verify that the platform deployment target is set to 14.0 or higher:

Merge the following with Flutter’s generated Podfile. Keep its Flutter helper setup and use a single post_install block:

platform :ios, '14.0'

target 'Runner' do
use_frameworks!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end

These compatibility settings match the tested example. Run flutter pub get, then cd ios && pod install, and open Runner.xcworkspace.

2.5 AppDelegate​

Preserve the registration pattern generated for your host app in ios/Runner/AppDelegate.swift. Choose the matching pattern below; do not add both.

Newer templates with FlutterImplicitEngineDelegate (including the Flutter 3.44.0 app template): keep that protocol conformance and register plugins in its engine callback:

func didInitializeImplicitFlutterEngine(
_ engineBridge: FlutterImplicitEngineBridge
) {
GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
}

Keep the generated SceneDelegate and other host lifecycle code.

Legacy template used by the checked-in example: registration stays in didFinishLaunchingWithOptions:

import Flutter
import UIKit
import flutter_pitel_voip_v2

@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}

The Flutter plugin initializes PushKit/CallKit. No separate Pitel bootstrap or native bridge source is required. The plugin relies on Flutter's generated plugin registration to attach its application lifecycle delegate. Preserve the host template's registration point (including FlutterImplicitEngineDelegate where present), and keep the host app’s other lifecycle behavior when merging this setup. The checked-in example uses the legacy didFinishLaunchingWithOptions pattern.


πŸ“Œ 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​

Pitel 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 service-account .json file will be downloaded. (Keep this file for Step 4). It contains a private key; upload it only to the Portal/backend flow and never bundle it into the app or commit it. fcm8

πŸš€ Step 4: Update Pitel Portal​

Finally, upload the necessary credentials to the Pitel 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.

Note: Ensure the Portal app uses the exact iOS bundle ID. Upload the VoIP .p12 and the Firebase service-account JSON as requested by the Portal; the APNs .p8, Key ID, and Team ID are configured in Firebase. See the Portal Guide.

PushKit and Firebase token roles​

The SDK stores PushKit token updates natively. The host obtains its FCM token through Firebase Messaging and supplies it with setFCMToken(). When the iOS plugin has SIP account configuration and both tokens, a changed FCM token may trigger a registration refresh; completion of the Dart Future still does not confirm backend receipt or end-to-end push delivery. If token setup fails, keep app startup/listeners available, retry Firebase token acquisition, then verify registration and an incoming call on a physical iPhone. Do not use onMessage, onBackgroundMessage or getInitialMessage as a substitute for PushKit VoIP handling.

Check/request microphone permission while the app is foregrounded and before an outgoing call. If an incoming event reaches a foreground app without permission, explain and request it there; finish permission prompts before background and lock-screen tests.


βœ… Testing​

Run the app on a physical iPhone to test PushKit incoming calls in foreground, background, and lock-screen states. Normal background/OS-terminated behavior is distinct from user force-stop; delivery after force-stop is not guaranteed. Configure PitelSettings.teamId with the Apple Team ID, appId with the exact iOS bundle ID, and appMode ('dev' for Debug builds; 'production' for TestFlight and App Store releases).

push_img_1