VoIP iOS App cannot receive incoming call when app in background

Hi everyone,

I’m developing an iOS VoIP app using jssip, WebRTC, and Asterisk over TCP. The app handles incoming calls via VoIP Push Notifications (using PushKit and CallKit). Our system logs CallData from asterisk into Firestore, and a CloudFunction listens for changes to trigger APNs for call notifications.

The problem I’m facing is When the app is in the background, it fails to receive incoming calls. After some debugging, I’ve found that the issue isn’t with the notifications themselves. The SIP messages (“100 Trying” and “180 Ringing”) are not reaching Asterisk while the app is in the background, preventing CallData from being logged in Firestore and consequently no call notifications being sent to the device. And when the app back to the foreground, these messages are sent successfully.

Observations:

  • SIP re-registration messages are sent and received fine, even in the background.
  • Push Notifications work correctly if call data is logged in Firestore, even if the app is in the background or the device is asleep.

Here’s what I’ve done:

  1. Enabled necessary Background Modes (VoIP, Background Fetch, Remote Notification).
  2. Set up VoIP Notification certificates and configuration.
  3. SIP Keep-Alive: Ensured the connection keep alive. The port and IP used to communicate with Asterisk stay the same.

Have anyone worked on this before?
Hi everyone,

I’m developing an iOS VoIP app using jssip, WebRTC, and Asterisk over TCP. The app handles incoming calls via VoIP Push Notifications (using PushKit and CallKit). Our system logs CallData from asterisk into Firestore, and a CloudFunction listens for changes to trigger APNs for call notifications.

The problem I’m facing is When the app is in the background, it fails to receive incoming calls. After some debugging, I’ve found that the issue isn’t with the notifications themselves. The SIP messages (“100 Trying” and “180 Ringing”) are not reaching Asterisk while the app is in the background, preventing CallData from being logged in Firestore and consequently no call notifications being sent to the device. And when the app back to the foreground, these messages are sent successfully.

Observations:

  • SIP re-registration messages are sent and received fine, even in the background.
  • Push Notifications work correctly if call data is logged in Firestore, even if the app is in the background or the device is asleep.

Here’s what I’ve done:

  1. Enabled necessary Background Modes (VoIP, Background Fetch, Remote Notification).
  2. Set up VoIP Notification certificates and configuration.
  3. SIP Keep-Alive: Ensured the connection keep alive. The port and IP used to communicate with Asterisk stay the same.

Have anyone worked on this before?