Add call recording to Cheogram Android

For people who wish to have a record of conversations with businesses and similar, it would help to have call recording supported by Cheogram Android. This could be a per-call setting and/or global configuration (TBD), but off by default in any case.

~ossguy is this a duplicate of #104?

~ossguy is this a duplicate of #104?

No, this ticket is for in-app recording to the device itself (possibly showing the recording in-line in the conversation, as a link to the recording on the device). #104 is for recording to a JMP/Bandwidth server and including a link to the recording in the conversation, similar to how JMP voicemail is currently done.

Ideally want it to work both in the dialler when dialler integration is enabled and in Cheogram when dialler integration is disabled. If it already works in dialler, cool, otherwise should look into doing that as well.

https://lists.sr.ht/~singpolyma/dev/patches/60066

We discovered a lot of things:

  1. WebRTC’s AudioDeviceModule class has a SamplesReadyCallback that lets us write raw PCM from the input mic
  2. WebRTC does not seem to exposes anything that lets us capture raw bytes coming in from the network (ie, the remote end of the call).
  3. Some native APIs that aren’t available in JNI seem like they would do the trick. Namely:
  • AudioTrack.addSink (implementing a custom sink is easy enough in java, we just can’t add the sink to the track)
  • AudioDeviceModule.DeliverRecordedDataBlock (give us direct access to playback data)
  • either on their own would probably do the trick
  1. Probably best would be to patch upstream WebRTC, but theoretically we could also write a bespoke audio module in native code. To avoid fdroid problems, we’ve opened a ticket in the official Google repo (https://issues.webrtc.org/issues/427260686) asking to expose AudioTrack.addSink