VoIP Notifications

Sending VoIP Notifications with OneSignal.

OneSignal does allow sending VoIP notifications for Android and iOS. However, our SDK does not support registration of a VoIP token at this time. This guide will share exact steps you need to take to get setup.

Android VoIP Setup

Android does not have the concept of "VoIP Push" the same as iOS. Notifications will just work, including data-only messages where you can start an Activity instead of showing a push.

If you need to call custom class for showing native UI for example, you would use the Android NotificationExtenderService so you can override the notification and show your custom UI or start your custom Activity.

Visit our Service Extensions docs for more on setting up the NotificationExtenderService.

Also, see Android's documentation for setting up a calling app and this Medium post by Lloyd Dcosta to Show incoming voip call notification and open activity for android OS>10.

iOS VoIP Setup

🚧

iOS 13 Update!

Please review this thread by an Apple Employee which talks about the iOS 13 requirements for VoIP needed to be implement in your app.
https://forums.developer.apple.com/thread/117939#thread-message-373438

1. Add PushKit into your app.

Implement Apple's PushKit API directly into your app to get a VoIP token.

See Apple's VoIP Best Practices for more help on getting setup.

2. Create a new OneSignal App for your VoIP device subscribers

We recommend using a 2nd OneSignal App with a different app_id specifically for your VoIP notifications. This way you can still send normal notifications and use all our features on your main OneSignal app_id.

Your OneSignal app_id for regular push notifications goes into your OneSignal Init method in your app.

Your OneSignal VoIP Notification app_id is used for sending VoIP notifications.

The certificate uploaded for the VoIP app must be a VoIP Services Certificate. You must use the same bundle id for the VoIP cert as you do for your main app.

1868

3. Add the device with a VOIP token

Once you have a VoIP token use the OneSignal API Add a Device POST call to add the device to your 2nd VoIP Notification App ID.

🚧

IMPORTANT: Common errors occur here

Include the test_type: 1 API parameter if you are testing the new device in a non-production environment.
This is the reason for seeing "Failed" or "Errored" notifications and a "Mismatched User Environment" error in your app's settings page, see details here here.

curl --include \
     --request POST \
     --header "Content-Type: application/json" \
     --data-binary "{\"app_id\" : \"YOUR_APP_ID\",
\"identifier\":\"DEVICE_VOIP_TOKEN\",
\"device_type\":0,
\"test_type\":1
}"
https://onesignal.com/api/v1/players

4. Send VoIP Notifications

You can then start using OneSignal create notification REST API POST call to send notifications.

Make sure you use the parameter apns_push_type_override with the value voip

Make sure to use the VoIP Notification app_id in your Notification POST call.

curl --include \
     --request POST \
     --header "Content-Type: application/json; charset=utf-8" \
     --header "Authorization: Basic YOUR_REST_API_KEY" \
     --data-binary "{\"app_id\": \"YOUR_VOIP_APP_ID\",
\"contents\": {\"en\": \"English Message\"},
\"apns_push_type_override\": \"voip\",
\"include_player_ids\": [\"YOUR_PLAYER_ID\"]}" \
     https://onesignal.com/api/v1/notifications

FAQ

Do Confirmed Deliveries work with VOIP?

Since VoIP notifications work much differently than regular push, Confirmed Deliveries will not be tracked for them. Confirmed Deliveries requires the Notification Service Extension which may not start with VoIP.

The recommended option is to setup the iOS VoIP event: pushRegistry(_:didReceiveIncomingPushWith:for:completion:) which is simpler as it is part of your main app target instead of having to bridge to the Notification Service Extension.

More details on this event in Apple's VoIP docs.