Asterisk Recording Issue

Hi Everyone,

I am experiencing an issue with recording calls in Asterisk 22. Here’s the setup and the problem in detail:

Setup:

  • Using PJSIP endpoints.

  • Dialplan triggers ARI (Stasis app) for call handling.

  • MixMonitor is started in the dialplan to record calls, with recordings intended to be saved in a custom sounds directory.

  • I have Node.js handling TTS playback and trying to implement real-time STT on the call audio.

Problem:

  • Outbound audio (Asterisk → Client) works fine, and the client can hear the audio.

  • RTP packets are flowing in both directions according to Asterisk logs.

  • However, incoming audio from the client (Client → Asterisk) is not being converted into a usable recording file.

  • MixMonitor logs indicate the recording has started, but there is no log indicating that the recording ended, and no .wav file appears in the target directory after the call.

  • Node.js server and ARI app are running, but attempts to capture the audio stream for STT also fail.

Additional Notes:

  • I am using standard MixMonitor syntax in the dialplan:
exten => 5000,1,Answer()
 same => n,MixMonitor(/path/to/custom/recordings/call-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}.wav,b)
 same => n,Stasis(voicebot)

  • The call flow is unidirectional for recording purposes, but the RTP logs show bidirectional packets.

  • Attempts to pipe audio into Node.js for real-time STT have been unsuccessful.

What we are trying to achieve:

  1. Save full audio of the call (both directions) reliably to a .wav file.

  2. Optionally, process the incoming audio in real-time for STT transcription.

Questions:

  1. Are there known issues in Asterisk 22 where MixMonitor fails to finalize recordings if ARI/Stasis is involved?

  2. Are there recommended dialplan changes or MixMonitor flags to ensure the recording completes and file is written?

  3. Are there better approaches for capturing the inbound audio for both recording and real-time STT processing?

Any guidance or suggestions would be greatly appreciated!

The ‘b’ option causes MixMonitor to only record when bridged[1]. If it isn’t (which if just playing back sound files to a channel it is not bridged) then it is behaving as you’ve told it to behave. Realistically you most likely want to remove the ‘b’ option.

[1] MixMonitor - Asterisk Documentation

As for all the non-MixMonitor stuff, there’s been threads upon threads upon threads.

I also ask that if you use AI to construct your post, or write your implementation, that you disclose its usage.

Take a look at WebSocket - Asterisk Documentation for dealing with the audio.