Recording Shows No Audio and Duration as NaN for Short Calls (<10s)

I’m encountering an issue with channel recordings in my Asterisk setup.

Here’s the scenario:

  • I initiate a recording after adding the channel to a bridge.
  • In most cases, the recording works as expected.
  • However, when the recording duration is less than 10 seconds, I notice two problems after the recording ends:
    1. The recording file has no audio (it appears completely silent).
    2. The duration metadata is either missing or shows up as NaN (Not a Number) in the system that accesses or displays the recording.

This behavior is inconsistent and seems to occur only for very short recordings. For recordings longer than 10 seconds(mostly duration around 5 seconds), everything works fine — audio is present and the duration is correctly displayed.

Additional Info:

  • The recording is started using the record function (via ARI or dialplan).
  • The media format is typically WAV or SLN (depending on the configuration).
  • No errors are seen in the Asterisk logs at the time of the recording.
  • The issue is not specific to a particular channel or bridge.

Could you b e accessing it before it has been closed?

I am reading the file only after i got the recording finished event. Also the file size is 44 bytes means when we start the recording asterisk create a file with this size.

44 bytes is the RIFF (.wav) header, and contains the meta data. It is certainly behaving as though you were reading it before it flushed its final buffer and updated the meta data.

When you say “read” after the event, can you confirm that you actually meant “open”, as opening before the file was closed could produce this effect, if you used stdio buffering.

When the finished even was triggered i am actually copying it to some audio storage server.