Review Board 1.7.16

dsp.c: dtmf_detect, Fix multiple issues when no-interdigit delay is present.

Review Request #2085 - Created Aug. 26, 2012 and submitted

Alec Davis
1.8 and trunk
Document DTMF events for different sequences.

* Fix extra hit required when new DIGIT is sent without any interdigit delay.
* Fix when DTMF_HITS_TO_BEGIN = 2, and no interdigit gap, that BEGIN is posted. 
* Fix situation where a flakey detect, would clear the current_hit (indicating an END), which may not have been the case.
On production box for 24 hours. 888 digit's now received.

The change here doesn't affect normal tone on/tone off, it changes the case when no interdigit pause is received between 2 digits, now the 2 digit has the same detect time as if there had been an interdigit pause before hand.
Review request changed
Updated (Aug. 31, 2012, 9:59 p.m.)
Revert to original -r349249 method with some changes, remove unnecessary;
  1. reseting of hits=0, when no signal, only need to set it once.
  2. incrementing of hits, when the hit is the same as the current hit.
  3. setting of lasthit, when it's the same as before.

It does limit the minimum hits_to_begin to 2
Ship it!
Posted (Sept. 4, 2012, 9:26 a.m.)
With these minor changes it will be good to go.
trunk/main/dsp.c (Diff revision 6)
You should add a spacing line between the note and the legend.
trunk/main/dsp.c (Diff revision 6)
Use tabs to indent as the original lines did.
trunk/main/dsp.c (Diff revision 6)
You can unconditionally set this to 1 here.
  1. However to be strictly as the original r349249 was, it allowed hits_to_begin to be as low as 1.
    So this is required, the double setting of 'hits' only happens when a new digit is started.
                    if (hit != s->td.dtmf.lasthit) {
                            s->td.dtmf.lasthit = hit;
                            s->td.dtmf.hits = 0;  << this presetting setting of 'hits' is perhaps unavoidable 
                    if (hit && hit != s->td.dtmf.current_hit) {
                            if (s->td.dtmf.hits == s->td.dtmf.hits_to_begin) {
                                    store_digit(s, hit);
                                    s->td.dtmf.current_hit = hit;
                                    s->td.dtmf.misses = 0;
                    } runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to