ACR Phone SIP Foreground Service is used to keep connectivity to SIP server(s). SIP is a VOIP protocol. Consumers can buy services from commercial providers or setup their own sip server for VOIP calling.
ACR Phone includes a SIP client and uses Android ConnectionService for seamless integration of SIP calling to Android Telecom. This feature was native to Android but was deprecated on Android 12. See https://developer.android.com/reference/kotlin/android/net/sip/SipManager
A SIP client must send keep-alive packets to SIP server so that calls can be received successfully. This service starts on boot, establishes connectivity to SIP server(s) added by user. It stops itself as soon as all SIP accounts are removed.
Push messaging systems operate on a different model compared to SIP keep-alive messages. While push messaging can be used to trigger events or notifications, it's not a direct substitute for keep-alive messages in the context of SIP.
Firebase secrets cannot be shared with world: ACR Phone SIP client can be configured to handle connectivity to and from many different commercial providers. This would mean commercial provider(s) would need to have access to our Firebase Keys to send push to ACR phone SIP client when there is an incoming call.
They would neither have intensive nor we could share our secrets.
LAN only SIP Servers: A SIP server can be configured to work on a Local Area Network (LAN) without internet access. Push messaging would not function in such cases.
Asynchronous vs. Synchronous Communication: Push messages are sent from a server to a client without a direct request from the client. In contrast, SIP keep-alive messages are part of the synchronous communication process between SIP endpoints. They are sent periodically to maintain the session state and keep the communication channel open. Using push messaging for SIP would introduce delays and disrupt the real-time nature of SIP communication.
Different Purposes: Push messaging systems are primarily designed for delivering notifications, updates, or triggering actions on a client device. They are not inherently designed for maintaining session state or detecting network failures, which are the primary purposes of SIP keep-alive messages. While push notifications could potentially inform endpoints about events relevant to SIP sessions, they don't serve the same role as keep-alive messages in maintaining session persistence and network connectivity.
Reliability and Real-Time Requirements: SIP communication, especially for real-time applications like voice and video calls, requires high reliability and low latency. Keep-alive messages are essential for ensuring that SIP sessions remain active and responsive, even in the presence of network address translation (NAT), firewalls, or other network devices. Push messaging systems may not guarantee the same level of reliability or real-time delivery required for SIP communication.
Protocol Compatibility: SIP is a standardized protocol used for initiating, modifying, and terminating communication sessions. Integrating push messaging systems with SIP would require significant modifications or extensions to SIP implementations to support push-based communication, which could introduce interoperability issues and compatibility challenges.
Push messaging systems, operate on a fundamentally different model compared to SIP keep-alive messages. While push messaging can be used to trigger events or notifications, it's not a direct substitute for keep-alive messages in the context of SIP.
On Android SIP requires FGS in order to send keep-alive messages, keep-alive messages are essential for maintaining the stability, persistence, and reliability of SIP communications, particularly in environments with NAT, firewalls, and load balancers. They help address various network challenges and ensure uninterrupted communication between SIP endpoints.
NAT Traversal: Network Address Translation (NAT) is commonly used in IP networks to conserve IP addresses. However, NAT can cause issues for SIP communications because it alters the IP address and port numbers in the packet headers. Keep-alive messages help maintain the NAT mappings by periodically sending packets to keep the NAT bindings active. Without keep-alive messages, NAT devices might close these bindings prematurely, causing communication failures.
Session Persistence: SIP is used for establishing and managing communication sessions, such as voice or video calls. Keep-alive messages ensure the persistence of these sessions by informing the endpoints that the communication channel is still active. This prevents session timeouts and premature session termination due to inactivity.
Firewall Traversal: Firewalls often have session timeout policies that close idle connections after a certain period of inactivity. Keep-alive messages help maintain the session state in firewalls by periodically sending packets, preventing the firewall from closing the SIP session.
Detecting Network Failures: Keep-alive messages also serve to detect network failures or disruptions. If one endpoint stops receiving keep-alive messages from the other endpoint, it can infer that there might be a network issue or that the other endpoint has become unreachable.
Load Balancing: In scenarios where SIP communication is load-balanced across multiple servers or proxies, keep-alive messages help ensure that the load balancer maintains an accurate view of the server's availability and load. This enables effective distribution of traffic among the available servers.