chenxiaolong / BCR

A Basic Call Recorder for rooted Android devices
GNU General Public License v3.0
1.67k stars 109 forks source link

Add support for writing a JSON file containing call metadata #380

Closed chenxiaolong closed 1 year ago

chenxiaolong commented 1 year ago

(Idea from https://github.com/chenxiaolong/BCR/issues/135#issuecomment-1641213789)

The metadata would be stored in a .json file next to the audio file and would look something like this:

{
    // Raw timestamp as the number of milliseconds since the Unix epoch
    "timestamp_unix_ms": 1689806425000,

    // Timestamp in RFC3339/ISO8601-compatible format
    "timestamp": "2023-07-19 18:40:25-04:00",

    // Call direction: in, out, or conference. (null if unknown or Android <10)
    "direction": "in",

    // SIM slot (null if Android <11 or phone permission is denied)
    // Numbering starts from 1, not 0
    "sim_slot": 1,

    // Display name of the call, as shown in the dialer's call log
    // (This may include the business' name for dialers that perform reverse lookups, like Google Dialer)
    "call_log_name": "John Doe",

    // (Contains multiple items if it's a conference call)
    "calls": [
        {
            // Raw phone number as reported by Android (null for private calls)
            // For outgoing calls, this is usually what the user typed.
            // For incoming calls, this is usually E.164 formatted.
            "phone_number": "+11234567890",

            // Phone number in the country-specific format (null for private calls, unknown country, or if Android can't parse the phone number)
            "phone_number_formatted": "+1 (123) 456-7890",

            // Contact name (null if contact does not exist or contacts permission is denied)
            "contact_name": "John Doe",

            // Caller name (Caller ID) (null if unavailable)
            "caller_name": "John Doe"
        }
    ]
}
nicorac commented 1 year ago

This is a great idea, thanks for it! I'm ready to build a POC app once this will be available (or at least testable)...

chenxiaolong commented 1 year ago

This has been released in version 1.48!

nicorac commented 1 year ago

This has been released in version 1.48!

Great, I'll work on a "companion-app" πŸ˜‰. Should it be possible, in the future, to also have a "call duration" field in JSON? It's surely be easier for you to add this info than for me to "extract" length from each file...

chenxiaolong commented 1 year ago

Should it be possible, in the future, to also have a "call duration" field in JSON?

Sure! I've created #387, which will add a bunch of info about the output format and encoding process to the metadata file (which includes the duration in the duration_secs_encoded field).

nicorac commented 1 year ago

Great, I'll work on a "companion-app" πŸ˜‰. Should it be possible, in the future, to also have a "call duration" field in JSON? It's surely be easier for you to add this info than for me to "extract" length from each file...

Sure! I've created #387, which will add a bunch of info about the output format and encoding process to the metadata file (which includes the duration in the duration_secs_encoded field).

As promised... I did it πŸ˜‰

I've called my app BCR-GUI, to clearly show that it depends on BCR (which is actually doing the "hard work"). (if you don't like its name, or think it's misused, please let me know)

It basically shows recordings in a list; call details are shown for each recording and user can listen audio within the app (no external player needed). Next versions will have edit, share, delete, ... and other features (can't actually imagine others).

Please check it out and share your thoughts. It's still in early development stage, but already usable and working (at least basic features).

I don't want to further spam here πŸ˜‚; if you think it worths being mentioned in your readme... feel free to do it (or contact me).