So I want to get the timings of the cellular call that I place from my app. I get call's start time as soon as call gets connected, but i also get start time block executed when calls ends which overwrites my callStartTime
property. Same thing happens with incoming calls as well (as you can see from the console log screenshot attached). I am using telprompt://
to place calls and return back to app. Is this a bug?
The CXCallObserver
delegate method is invoked whenever calls changed, and is invoked once when a call connects and then later if/when that call ends. The hasConnected
and hasEnded
properties should be interpreted as "has ever connected" and "has ever ended", respectively.
Thus, I recommend using logic such as this:
if (call.hasConnected) {
if (!call.hasEnded) {
// record start time (unless start time has already been recorded)
} else {
// record end time (unless end time has already been recorded)
}
}