How can i detect silence while recording to use record application

Hello, i am making a messagerie.I need to check if the audiofile recording with record application is empty or no.If someone can help me.
exten => _x,n,Record(${link_recorded_customers}${id_customer}/pseudo:wav,5,5)
exten =>_x,n,GotoIf($["${STAT(e,${RECORDED_FILE}"=“0”]?erreur_enregistrement_PPX17_1)

Try using the ‘s’ flag of stat, that should return the file size not just if the file exists.

Then decide if the file is large enough to be a valid recording.

Thank you for your answer.But for recording a “pseudonyme” what size is the minimal for example.
what size we will consider that the recording is not good.

Best regards

That logic will be up to you to provide, What size file works for me for a sane value could be totally different than for you.

I’d recommend recording a few files and seeing what the minimum file size is for what you determine to be a ‘good’ recording.