How Do Push Notifications Work with PortSIP PBX?
Last updated
Last updated
A Voice over Internet Protocol (VoIP) app lets users make and receive phone calls by using an Internet connection instead of the device’s cellular service. Since the VoIP app relies heavily on the network, it’s not surprising that making calls usually results in high power consumption.
A VoIP app has to maintain a persistent network connection with a server to receive incoming calls and other data. This means writing complex code that sends periodic messages back and forth between the app and server to keep the connection alive, even when the app is not in use. This technique resulted in frequent device wakes that wasted energy. It also means if a user exits the VoIP app, calls from the server could no longer be received.
With push notifications, a VoIP app doesn't require to be running in the foreground or background. Whenever a push notification is received, the VoIP app could display an alert, and provide an option to accept or reject the call.
There are many advantages to using push notifications:
The device is woken only when a push notification occurs, saving energy.
Push notifications are regarded as high-priority notifications and are delivered without delay.
Usually, VoIP pushes can include more data than what is provided with standard push notifications.
Your app is automatically relaunched if it’s not running when a VoIP push is received.
Your app will be given runtime to process a push message, even if your app is operating in the background or was forced out.
PortSIP PBX supports mobile push notifications for iOS and Android from V9.0. All PortSIP users will benefit from this new feature.
The below architecture demonstrates how PortSIP PBX provides push notifications service.
PortSIP uses Apple Push Notification Service (APNs) to send push notifications to iOS devices and Google Firebase Cloud Messaging (FCM) to send push notifications to Android devices.
Requesting Device Token: The app requests a device token from APNs/Google FCM.
Receiving Device Token: The app receives the token, which functions as the address to send a push notification to.
Registering with PortSIP PBX: The app registers with PortSIP PBX using a SIP REGISTER message. An “X-Push” header must be added to the REGISTER message, including the device token and other necessary information to inform PortSIP PBX that the app would like to receive push notifications for this extension (e.g., extension 101).
App Termination: The user force terminates the app.
Incoming Call: When someone calls extension 101, PortSIP PBX will send an INVITE message to the appropriate contact address if the 101 registration is not expired and sends a push notification with the device token to APNs/FCM.
Push Notification: Since the app is terminated, the INVITE message will not be received by the app. APNs/FCM will send a push notification to the device.
Receiving Notification: The iOS/Android device receives the push notification and alerts the user that a call is coming. The user accepts the call.
App Launch and Registration: The app will be launched and registered to PortSIP PBX automatically.
Call Handling: After successful registration, PBX will send an INVITE message to the contact address obtained from the new registration. The app receives the INVITE message and answers the call.
The same process applies to Instant Messaging.
The example of the "X-Push" header in the REGISTER message.