AGI recording audio while doing a playback

I would like to make a smarter AGI integration that when a playback is being played to the caller, it listens if the caller is saying something.

I have the parts of ASR and TTS figured out, with the ASR doing record file and sending the file to a TTS engine and a chatbot response is generated with a LLM and played back with a TTS that makes a file with AGI PLAYBACK command.

There is a way to record the channel while AGI playback is in execution?

There are already some techniques for speech detection?