I’m using ARI with the Python ari library to record channels, and I’d like to know if it’s possible to specify maxSilenceSeconds in milliseconds rather than whole seconds.
Currently, the API seems to only accept integers, but I need to detect shorter silences like 300–500ms.
If this isn’t supported natively, I’m open to modifying the Asterisk source code or the Python client if necessary.
Has anyone managed to achieve sub-second silence detection during recording?
Just an update: I managed to get sub-second silence detection working in ARI recordings by modifying the Asterisk source code.
Here’s what I did:
In the function record_file (in res_stasis_recording.c), there was a line multiplying max_silence_seconds by 1000 when calling ast_play_and_record_full().
I simply removed the multiplication (* 1000), so the value passed from ARI is now directly used in milliseconds.
For example, sending maxSilenceSeconds=300 via ARI now correctly stops the recording after 300ms of silence.
I also updated the channels.json doc file to clarify that maxSilenceSeconds is in milliseconds.
So if anyone needs sub-second silence detection, this change works perfectly.