How to split recorded audio into incoming and outgoing recording file?

The audio is merged into a single stream, meaning you can’t easily split it out without doing probably some kind of audio analysis/machine learning approach to differentiate each speaker and split them out but even then there could be overlap.

For new calls MixMonitor provides functionality to store separate files[1].

[1] Asterisk 18 Application_MixMonitor - Asterisk Project - Asterisk Project Wiki