Use Of TONE_DETECT To Detect Dial Tone In Call (Asterisk18)
I am trying to use TONE_DETECT in a call that is made into a call centre and placed on hold, when the call has been answered by the agent (denoted by a dial tone of 2 seconds of dual tone 350Hz + 440Hz followed by 4
seconds of silence (North American dial tone), to act as a trigger t to bridge a call to our agent. I am using
exten => s,n,Set(TONE_DETECT(0,,d(5)crg(tonedetect-dialagent,s,1))=)
which should look for dial tone on the rx channel with a decibel threshold of 5 (tried default and didn’t work), and then jump to the context tonedetect-dialagent.
The documentation on the use of the options for TONE DETECT offers no explanation on the syntax to use, so I have guessed the above.
Does anyone know if this is correct usage of the function? Also it is still not detecting dial tone.
I noticed in Asterisk 20 there is a new function called WaitForTone() App on its way
https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Application_WaitForTone
Anyone know anything about this?
Thanks
Steve
One thought on - Use Of TONE_DETECT To Detect Dial Tone In Call (Asterisk18)
As the author of both TONE_DETECT and WaitForTone, hopefully I know a thing or two about it 😉
WaitForTone is present in recent versions of 16, 18[1], 19, and 20. You do not need to wait for 20 to be able to use that. If you can use WaitForTone over TONE_DETECT in your application, that may be easier since it works synchronously rather than asynchronously like TONE_DETECT
does. However, if you’re running this during a call, you would need to use TONE_DETECT.
Your syntax looks good for the most part. You need to use the built-in detector for dial tone in the core DSP, since TONE_DETECT for frequencies does not support multifrequency tones. There are special frequency pairs using the Goertzel algorithm for multifrequency detection (such as for DTMF), and dial tone is defined as one of them.
I would suggest removing the r option and seeing if it works (or, alternately, use the t option). The receive direction in Asterisk refers to audio received from you, I believe, as opposed to the distant send. Hence, it’s looking for a dial tone from you, I believe. Sometimes I
still get those mixed up, but I would start by trying the other direction and seeing if that works. The example in the documentation[2], for example, doesn’t specify the r option.
This probably *isn’t* the issue, but also doesn’t hurt to make sure you are using the [us] indications zone in indications.conf on that channel, or otherwise it might think dial tone is something else.
If that doesn’t fix it, make sure to do “core set enable 10 dsp” so any debug output from the DSP functions is available (you may need to add the debug log level to the console file in logger.conf)
DSP can sometimes be tricky, but hopefully that helps – feel free to follow up if it still doesn’t work.
[1]
https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Application_WaitForTone
[2]
https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Function_TONE_DETECT
—