Single/Mono Tone Detection (not DTMF)


I need to listen for single/mono tones of different frequencies. For example, a 900Hz tone. I have been looking hard for examples of how to do this but have came up short. I really want an application like “WaitForSilence”, except "WaitForTone(hz/length, timeout).

Can anyone suggest an application to look at or, if not, suggest a way to do this?

Thank you!

You have a couple of choices, both of which will involve writing some sort of dialplan application to run under asterisk.

  1. Modify asterisk’s source code to detect the few tones you may need. Asterisk uses the Goertzel algorithm to detect pre-determined frequencies which is always the case with DTMF tones. The Goertzel algorithm is optimized to search for specific frequencies. You could modify the tables which list the frequencies looked for by asterisk’s DTMF detection code. Take a look at the asterisk source module dsp.c. This mod sounds easier than it is as you will need to make sure that you trap the tones you are looking for in all cases, and then pass control to you own code to do whatever processing you desire at the point of detection.

  2. Develop an asterisk dialplan application which can be called to analyze the frequencies appearing in packets coming to a voice channel.

The Goertzel algorithm is fast if there are a limited number of frequencies being targeted and these frequencies are known. If you are looking for unknown frequencies you will need to resort to a different algorithm, most likely some variant of a Fast Fourier Transform.