I am developing an app that uses the Telephony Session Events. The problem we face is detecting when the call is finished reliably. Initially, I assumed the call ended when all the parties involved (parties id) got the "Disconnect" message, but this algorithm failed because the events were not coming in the proper order (ordered sequence number), and on top of this, I cannot rely in the sequence number because is not sequential (there are gaps), so, I cannot assume that if I got the sequence 5, I could wait for the previous sequence in order to sort the events.
For instance, I can get the following sequence of event numbers: 3, 5, 2, 4, 7, 6, or I can get something completely different like: 2, 3, 5, 6, 4, 7
Can someone point me to the right solution?
Thanks!