How to detect silence in Asterisk?

Dear all,
I would like to stop 3-way calling by detecting silence and hook flash during call conversation in Asterisk.
If anybody experience in this feature, please share me a bit.
Thank you so much!