Chan_LEG - specially designed channel in Asterisk that allows you to perform audio processing of the conversation, regardless/independent of the conversation processing, and associated with this conversation channels.
For example: It is possible to process incoming, outgoing and both audio streams at the same time. Also, chan_LEG allows you to control the source channel through setting the values of the channel variables and has the ability to hangup the source channel (conversation). It could be actual for Outbound campaign with automated dial applications (autodialers).
App WaitForPattern designed to detect the presence of sound (early media messages) in the flow of current patterns (templates) of the sound. One call can recognize up to 256 patterns, which are specified as audio files of any format used in asterisk. The recognition algorithm is based on the determination of the duration of the voice and silence.
Typical applications of chan_LEG + WaitForPattern are: