0
votes

For the following code in pjsip.js

endpoint.on("call_received", (call) => {
      dispatch(onCallReceived(call))
    })

In Android, pjsip module still can receive incoming call while in background mode.

But, in IOS the event callback not fires. Still after i click the apps in IOS, then the incoming call will be received. Are there any setting have to be configured in iOS ? I have add the voip string in info.plist background UI.

Any solution ?

1

1 Answers

1
votes

Unfortunately to have this trigger in the background on iOS you'll have to use PushKit and CallKit. You will need to enable VOIP background mode in info.plist and create VOIP services certificates in Apple Developer portal.

When an inbound call is coming in, the server will need to send an iOS VOIP push notification. If you're using AWS you can use AWS SNS since they handle iOS VOIP push notifications. Firebase or GCM do not support these special VOIP notifications.

Basically this notification will wake up the iOS app and you can re-register PJSIP then the incoming SIP Invite can trigger CallKit to show the inbound call. You can see how this is setup in the React Native PJSIP example repo: https://github.com/datso/react-native-pjsip-app/blob/master/app/modules/pjsip.js#L106

Here are the 2 packages for CallKit and PushKit https://github.com/ianlin/react-native-voip-push-notification https://github.com/ianlin/react-native-callkit