-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Add call" (three-way call) results in five files #284
Comments
* RecorderInCallService and RecorderThread have been updated to be aware of parent/child relationships of calls. Previously, child calls were treated as independent calls, so a conference call would result in separate (but identical in audio) recordings for the parent conference call and every call it was merged from. * RecorderInCallService and RecorderThread now mute the recording when the corresponding call is in the HOLDING state. This prevents audio from a different call from being recorded while the call is on hold (due to call waiting). Fixes: #284 Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
Thanks for the detailed write-up! I gave this a try on my device following your exact steps and was able to reproduce this. Can you give the test build at #285 a try? I fixed a few things:
There are some limitations I found while testing:
With the way Android's telephony framework works right now, I believe the only way to do this is to decode all the separate recordings, join them, and reencode to a new file. Behind the scenes, Android disconnects the two original calls and creates a new conference call when the merge button is hit. As far as I can tell, there's no metadata in the conference call that links to the calls prior to merging. It would unfortunately be a guessing game to find the previous recordings that should be joined and I'd prefer not to implement that in BCR. |
And thank you, equally, for the deep-dive and swift code changes! I can confirm all fixes are working as advertised on this end, though I'd suggest pausing recording rather than muting it in the HOLDING state if that's sufficiently simple. In the call waiting scenario in particular, if I get another call and talk to the other person for, say, five minutes, there's no good (non-technical) reason to have five minutes of dead air on the original recording.
I vote for preserving the original call direction. If I get a call from someone who then calls someone else, that still qualifies as the same incoming call from my perspective even if the recordings are split up for technical reasons.
Unfortunate, but not surprising.
Is it not possible to manually query based on the phone number?
But now that you're tracking parents and children, iterating through them should be sufficient, no? You know (or can easily document) what you're recording, where you're recording it, and the order in which they should be joined. The stumbling point would be the decoding and re-encoding portion, which could be worked around by recording to PCM initially and encoding only after all portions of the call are disconnected. A bit of added complexity, no doubt, but ultimately the outcome users would expect. |
Good point! I'll make that change.
Unfortunately not. Android doesn't convert the two original calls into children of the new parent conference call. It first disconnects both original calls and then creates the parent with two new children. The new children have completely different metadata (eg. different ID and call creation/connection timestamps). At the point the user presses merge, I can't think of a good way determine that the call hasn't really ended yet from the user's perspective. The disconnection of the original two calls when merging looks exactly the same as hanging up when using call waiting. (I don't think this is an Android quirk. My understanding is that with VoNR/VoLTE/wifi calling, these disconnects + reconnects are actually what happens on the network.)
I did some digging into the Android telephony framework and it seems that the call direction for a conference call is (intentionally) nonsensical until enough participants drop out that it goes back to being a one-on-one call. I get a mix of
Another good idea. I've added this now. It turned out to be less complicated than I originally thought. And now that we have this, Android <11 users can see the contact name too. I looked at the AOSP dialer implementation and it looks like it also does manual queries itself. I guess lack of testing via the dialer might be why the "official" method of getting the contact name from the call is a bit buggy. EDIT: I've attached a new test build to #285. |
My limited understanding is the same. You remind me of another important scenario I hadn't yet considered, though -- what about network to roaming handoff and network to VoWiFi handoff? Both should produce the same issue -- a technically new call that should be part of the original recording. I feel like this is something that, while tough to pin down, deserves a proper resolution. I'll take a look at the logs later and see if I can come up with anything remotely feasible. First thought: Is there a way to differentiate between calls that ring and don't ring?
The good citizen in me wants to suggest you file issues with Google for all these quirks, but the pragmatist knows they'll all still be around in Android 37. Heading out now for the next couple days, but I've installed the new build and will make time to test as soon as I can. |
I gave this a quick try and it looks like Android keeps the same call going for the VoNR/VoLTE <-> VoWiFi handoff. The only visible change in the call I see is the addition and removal of the
Sometimes... From prior bug reports, the call states are quite unreliable on many devices. There is a |
So, I can confirm the pause fix works, and the manual query seems to work as well based on a couple tests (though you did note this can be intermittent, so I don't have 100% certainty). One weird issue: The conference portion is now being saved with a .mp3 file extension. A quick look at the file header confirms it's the same M4A format as the others, it's just getting a weird extension now for some reason.
Wow, definitely did not see that one coming. Do you have the means to test network to roaming?
Puzzlingly, there doesn't seem to be RINGING states on any of my calls since I started using the debug build, and this is on a Pixel 7 Pro where you'd most expect the rules to be followed. Possibly a network thing, not an OS thing? Sounds like a real clusterfuck in any case. I already don't envy the developers of call recording apps. |
Awesome, thanks for testing!
If you still happen to have the log file, it should have some messages like this near the very bottom if a manual query was required:
Wow, I'm baffled what might cause that. In the log file, if you see:
then I think you might've found a bug in the Android storage access framework. It's responsible for adding the file extension based on the file type.
It's very possible it's a network thing. Or possibly the modem firmware--I think at the lowest level, that's where all the call states come from, even for internet-based calls (VoNR/VoLTE/VoWiFi).
100% agreed there, the whole telephony stack is a giant clusterfuck. It's very slowly getting better though. A few years ago with my old Samsung Galaxy S8+, it was possible for the modem to get stuck in a bad state that could not be resolved by rebooting or reflashing the firmware. The modem didn't actually reset itself until the battery was completely drained. |
Yep, found it.
It occurs to me now that I ran into the same problem the other night when I briefly messed with filename formats. To reproduce, simply create a
Good/bad news: Mine doesn't. I'll see if I can make it happen on my way home.
Wild, and you still started this project? Brave man. 🤣 |
Just spent about an hour testing. I was able to get the call to drop many times, but it didn't once hand off to the roaming network. At any rate, given your hypothesis, I'm ready to concede that the current implementation is good enough. |
Thanks for the reliable reproducer. I've opened #292 to track this bug. The fact that |
I'm throwing the kitchen sink at BCR to see how well it holds up under various scenarios, and the only problem I've found so far is with three-way calls.
In Google Dialer, place a call, press the "Add call" button, choose a contact, and Dialer places the original call on hold and dials the new contact. "Add call" is then replaced with "Merge", which can be pressed to merge the two active calls. Although BCR does function in this scenario, recording the complete call (albeit over several files), it outputs one file for the first call before you press "Add call" that gets correctly named with contact name and number, a second file for the second call before you press "Merge" that also gets correctly named with contact name and number, a third file with the merged portion of the call with no contact name or number, a fourth file with the same merged portion named with contact name and number for the first call, and a fifth file with the same merged portion named with contact number for the second call but NOT contact name.
Sample output filenames:
In a perfect world, a merged call would output as a single file. If you take on this task, be sure not to break call waiting recordings, which I suspect have a similar flow behind the scenes and should write two separate files unless merged.
The text was updated successfully, but these errors were encountered: