Hello,
I have an app which I have enabled VoIP entitlement and implemented all the CallKit and PushKit registries and delegates.
I can successfully get a VoIP token.
I can successfully send VoIP push notifications (and receive them via the PushKit delegate function) and then report an incoming call via CallKit, but only while my app is in the foreground.
I have checked the entitlement in XCode and the Info.plist directly, and they both (as expected) show voip as a background mode.
The VoIP notification is being sent via AWS SNS and everything works while the app is in the foreground. I cannot understand why the app is not waking up while in the background.
This is the VoIP notification sent via SNS:
aps: {
alert: "Intercom call",
"content-available": 1
}
SNS Message Attributes:
'AWS.SNS.MOBILE.APNS.TOPIC': {
DataType: 'String',
StringValue: `${bundleId}`
},
'AWS.SNS.MOBILE.APNS.PUSH_TYPE': {
DataType: 'String',
StringValue: 'voip'
},
'AWS.SNS.MOBILE.APNS_VOIP.TTL': {
DataType: 'String',
StringValue: '0'
},
'AWS.SNS.MOBILE.APNS_VOIP_SANDBOX.TTL': {
DataType: 'String',
StringValue: '0'
},
'AWS.SNS.MOBILE.APNS.PRIORITY': {
DataType: 'String',
StringValue: '10'
}
As I say,
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) async
works correctly when in the foreground. I cannot see any reason why it would not work from the background.
I am also receiving normal remote notifications correctly foreground and background.
Checking the console (console.app), I am seeing (when in the background)
VoIP push for app <private> dropped on the floor.
What could be the reason for this?
Quoting the class reference for "didReceiveIncomingPushWithPayload":
"On iOS 13.0 and later, if you fail to report a call to CallKit, the system will terminate your app. Repeatedly failing to report calls may cause the system to stop delivering any more VoIP push notifications to your app."
The "dropped on the floor" message is what's logged when callservicesd transitions from terminating your app to discarding the push entirely. As you're seeing, pushes will be delivered when your app is in the foreground and dropped when your app is in the background.
You can reset this by deleting your app and reinstalling. You can then debug why your app is failing to report calls as required by the API contract.
__
Kevin Elliott
DTS Engineer, CoreOS/Hardware