Asterisk bridge recorder (ARI)

Hello everyone. I’m new to asterisk, my company is developing a voice-bot based on AI.
The problem is when I record the audio of the call, sometimes the audio file misses user’s voice. For an instance:

Our voice-bot: ‘Hello how can I help you today?’
User: ‘I’m good’
Our voice-bot: ‘What can I help you?’
User: ‘Tell me about the weather today!’ → [ This one can’t hear from full audio record a Bridge (with have a snoop channel in it) ]

Here’s my code:

So I create a snoop channel for recording audio, bridgeRecorder.record() will record the conversation to a file. externalChannel is for streaming audio stream to a Speech To Text server.

So I decided to separate recording into two part, bridgeRecorder will record our bot audio and bridgeIn will record user’s audio. And then I’ll merge two files into one file.
Separate into two part: Untitled (j7pos5a6) -

But the problem is, when I record on bridgeIn, the audio stream keep sending to externalService when our bot’s saying (playback wav file). So how can I pause streaming audio (using audiosocket) when our bot is playback the sound, and then start it again when it’s users turn.

Thanks in advance.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.