Available alternatives & issues encountered with detection of abrupt VoIP call disconnect of a remote device

Frameworks & Libraries used :
  • Kamailio + RTPEngine (Server)
  • PJSIP (client)
  • CSipSimple (android wrapper)

Approaches evaluated :

  1. Peer to peer ping-pong logic with SIP pager (SIP message).
  2. Monitoring user-agent client's (UAC) received RTP packets.
  3. Using Kamailio's dialog module with UAC keep-alive.

Approach used in production :

  • Using Kamailio's dialog module with UAC keep-alive

Implementation detail :

1. Peer to peer ping-pong logic with SIP pager (SIP message)

This is the most basic & simple way to detect abrupt disconnection of a remote device during an ongoing call. We had implemented this such that whenever a call is connected, the caller & callee devices start sending & receiving SIP messages.
If any message is not received within a given instance of time (say 5 seconds) then the device would explicitly disconnect the call after an additional timeout (say 5 seconds).

The above solution worked with iOS as well as android but we faced a peculiar issue with Nexus 5 (OS version 5.1.1). It caused random crashes in the app. Turns out the crashes were originating from the native OS stack. So we had to discard this solution.

2. Monitoring user-agent client's (UAC) received RTP packets

Another possible approach was to monitor the devices incoming VoIP traffic and if any disruption is detected then disconnect the call.
PJSIP's documentation had stated that 'pjmedia_stream_get_stat' method would  return the needed metrics. The stream statistics returned from the method were sufficient to detect disruption of the incoming traffic stream.
Alas, the method was not accessible from CSIPSimple's JNI wrapper. Thus, we decided to discard this solution as well. :(

3. Using Kamailio's dialog module with UAC keep-alive

After much reluctance (since this is production level version), we finally decided to modify the Kamailio server's configuration to enable dialog module.
We defined a few call routes & keep-alive timers for the dialog module and the new configuration worked without a hitch. :)

Podcast

Michael Patterson sat down with the CEO of Boston Byte, Mustapha Shaikh to discuss the significance and rapid digitization of the healthcar...