Cordova VoIP Calls
Pushwoosh supports VoIP-style call notifications for iOS and Android using the pushwoosh-cordova-plugin. This enables native VoIP call functionality, including incoming call UI and call control events.
Before you start, integrate the plugin with your Pushwoosh Application Code as described in the basic integration guide.
1. Add the Pushwoosh Cordova plugin with VoIP enabled
Anchor link toInstall the plugin with the VoIP flag enabled:
cordova plugin add pushwoosh-cordova-plugin --variable PW_VOIP_IOS_ENABLED=true --variable PW_VOIP_ANDROID_ENABLED=trueThis will configure the plugin to support VoIP functionality on iOS.
2. Check the PushwooshVoIP dependency
Anchor link toThe plugin links the PushwooshVoIP module automatically. On cordova-ios 8, it adds the PushwooshVoIP Swift package and doesn’t change the Podfile. On earlier cordova-ios versions, it adds this line to your Podfile:
pod 'PushwooshXCFramework/PushwooshVoIP'This module is required to support PushKit-based VoIP notifications and system-level call handling.
3. Enable VoIP background mode in Xcode
Anchor link toOpen your project in Xcode and follow these steps:
- Go to Signing & Capabilities.
- Add Background Modes capability.
- Check the Voice over IP option.
This allows your app to receive incoming VoIP pushes while in the background.
4. Request call permission on Android
Anchor link toOn Android, the app needs the user’s permission to receive calls. Request it with requestCallPermission(). If the user denies it, the app ignores incoming VoIP calls.
pushwoosh.requestCallPermission();5. Set a custom ringtone (optional)
Anchor link toThe plugin initializes VoIP automatically. To play a custom ringtone for incoming calls, pass a sound file name from the app bundle:
pushwoosh.setRingtone("incoming.caf");6. Available VoIP callbacks and methods
Anchor link toVideo support and the caller ID format are set per call in the VoIP push payload: video and, on iOS, handleType (1 for generic, 2 for phone number, 3 for email).
The Cordova plugin supports the following VoIP-related methods and events:
answer– called when a user answers an incoming callendCall– called when a user ends the current callhangup– called when a call is hung upreject– called when an incoming call is rejectedmuted– toggle mute status, iOS-onlyheld– toggle hold status, iOS-onlyvoipPushPayload– returns push payload for the incoming VoIP callincomingCallSuccess– called when system call UI is successfully shown, iOS-onlyincomingCallFailure– called when system call UI fails to show, iOS-onlyspeakerOn– turn speaker onspeakerOff– turn speaker offplayDTMF– play DTMF tone during a call, iOS-onlyvoipDidRegisterTokenSuccessfully– called when the VoIP token is registered with Pushwoosh, iOS-onlyvoipDidFailToRegisterTokenWithError– called when VoIP token registration fails, iOS-onlyvoipDidCancelCall– called when a call is cancelled remotely via a VoIP pushvoipDidFailToCancelCall– called when a call cancellation attempt fails
These can be hooked using Cordova’s PushNotification object, allowing you to control and respond to VoIP call state changes.
On Android, you can also handle these events in your own native Java class, for example to open your own call screen when the user answers. See Custom call event handler on Android.