<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/2085/">https://reviewboard.asterisk.org/r/2085/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On August 31st, 2012, 6:24 p.m., <b>rmudgett</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">After comparing this algorithm with the original algorithm (trunk -r349249) replaced by ASTERISK-17493, the original algorithm handles the same cases and is simpler.
Reverting to the original algorithm, keeping your "Character recognition: When not DRC" comments, and removing the unnecessary clearing of the hit count would be all that is necessary. Of course this just brings back the need for a fix to ASTERISK-17493.</pre>
</blockquote>
</blockquote>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The original -r349249 does indeed work
I agree regarding unnecessary clearing the hits every no signal.
I'd recommend the following changes to the -r349249 hit code;
This removes unnesesary;
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.
if (hit != s->td.dtmf.lasthit) {
s->td.dtmf.lasthit = hit;
s->td.dtmf.hits = hit ? 1 : 0;
}
if (hit && hit != s->td.dtmf.current_hit) {
s->td.dtmf.hits++;
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;
}
}
But does -r349249 need to support hits_to_begin=1 ?
If it doesn't then the 'hit' code could look like this.
if (hit != s->td.dtmf.lasthit) {
s->td.dtmf.lasthit = hit;
s->td.dtmf.hits = hit ? 1 : 0;
} else if (hit && hit != s->td.dtmf.current_hit) {
s->td.dtmf.hits++;
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;
}
}
Documenting -r349249 before recommended changes
/*
* Example: hits_to_begin=2 misses_to_end=3
* -------A hits=1
* ------AA hits=2 current_hit=A misses=0 BEGIN A
* -----AA- misses=1 hits=0
* ----AA-- misses=2 hits=0
* ---AA--- misses=3 current_hit=' ' hits=0 END A
* --AA---B hits=1
* -AA---BC hits=1
* AA---BCC hits=2 current_hit=C misses=0 BEGIN C
* A---BCC- misses=1 hits=0
* ---BCC-C misses=0 hits=1
* --BCC-CC misses=0 hits=2
* -BCC-CCC misses=0 hits=3 ??? hits=3 ???? but doesn't affect operation.
* Example: hits_to_begin=3 misses_to_end=2
* -------A hits=1
* ------AA hits=2
* -----AAA hits=3 current_hit=A misses=0 BEGIN A
* ----AAAB misses=1 hits=1
* ---AAABB misses=2 current_hit=' ' hits=2 END A
* --AAABBB hits=3 BEGIN B
* Example: hits_to_begin=2 misses_to_end=2
* -------A hits=1
* ------AA hits=2 current_hit=A misses=0 BEGIN A
* -----AAB misses=1 hits=1
* ----AABB misses=2 current_hit=' ' hits=2 current_hit=B misses=0 BEGIN B ??? double setting of current_hit and misses ???? but doesn't affect operation.
*/
</pre>
<br />
<p>- Alec</p>
<br />
<p>On August 31st, 2012, 6:11 p.m., Alec Davis wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers.</div>
<div>By Alec Davis.</div>
<p style="color: grey;"><i>Updated Aug. 31, 2012, 6:11 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.
</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.
</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>trunk/main/dsp.c <span style="color: grey">(371689)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/2085/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>