[prev in list] [next in list] [prev in thread] [next in thread] 

List:       asterisk-dev
Subject:    Re: [asterisk-dev] [Code Review]: refactor dsp.c that can no longer detect a quick DTMF sequence.
From:       "rmudgett" <reviewboard () asterisk ! org>
Date:       2012-08-30 21:20:40
Message-ID: 20120830212040.27079.24970 () hotblack ! digium ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> On Aug. 30, 2012, 3:19 p.m., rmudgett wrote:
> > trunk/main/dsp.c, lines 745-767
> > <https://reviewboard.asterisk.org/r/2084/diff/4/?file=31094#file31094line745>
> >
> >     Maybe change to make 2 misses end any digit:
> >     if (s->td.dtmf.lasthit != s->td.dtmf.current_hit) {
> >     	/* 2 misses of current_hit */
> >     	if (hit == s->td.dtmf.lasthit) {
> >     		/* 2 of the same, either a BEGIN or END digit */
> >     		if (hit) {
> >     			store_digit(s, hit);
> >     		}
> >     		s->td.dtmf.current_hit = hit;
> >     	} else {
> >     		/* 2 misses ends current digit */
> >     		s->td.dtmf.current_hit = 0;
> >     	}
> >     }
> >
> 
> Alec Davis wrote:
>     I abandoned this, and produced https://reviewboard.asterisk.org/r/2085/

Then you should discard this review request.


- rmudgett


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2084/#review6979
-----------------------------------------------------------


On Aug. 26, 2012, 2:20 a.m., Alec Davis wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2084/
> -----------------------------------------------------------
> 
> (Updated Aug. 26, 2012, 2:20 a.m.)
> 
> 
> Review request for Asterisk Developers, rmudgett and Jason Parker.
> 
> 
> Summary
> -------
> 
> Use a simpler method to detect changes in DTMF ON/OFF tones.
> 
> Similar method to latest spandsp/dtmf.c
> 
>    We must detect 2 silences for DTMF END.
> 
> 
> Reverts some of 111022 that added DTMF_HITS_TO_BEGIN and DTMF_MISSES_TO_END
> 
> Exisiting dtmf events with;
> /* hits_to_begin = 3, misses to end = 2 */
> /* --------A    hits=1, misses=1, lasthit='A'
>  * -------AA    hits=2
>  * ------AAA    hits=3, store_digit, current_hit='A',	BEGIN A
>  * -----AAA-    hits=1, misses=1, lasthit=' '
>  * ----AAA--    misses=2, current_hit=' ', 		END A
>  * ---AAA--B    hits=1, misses=1, lasthit='B'
>  * --AAA--BB    hits=2
>  * -AAA--BBB    hits=3, store_digit, current_hit='B',	BEGIN B
>  * AAA--BBB-    hits=1, misses=1, lasthit=' '
>  * AA--BBB-B    hits=1, misses=1, lasthit='B'
>  * A--BBB-BB    digitlen += GSIZE
>  *              deal with an interruption
>  * --BBB-BB-    hits=1, misses=1, lasthit=' '
>  * -BBB-BB-B    hits=1, misses=1, lasthit='B'
>  * BBB-BB-BB    digitlen += GSIZE
>  *              deal with no interdigit pause
>  * BB-BB-BBC    hits=1, misses=1, lasthit='C'
>  * B-BB-BBCC    current_hit=' ',			END B
>  * -BB-BBCCC    hits=2
>  * BB-BBCCCC    hits=3, store_digit, current_hit='C',	BEGIN C
>  */
> 
> 
> How it would be without, hits_to_begin, and misses_to_end
> 
> /*  ------AA    Begin A
>  *  -----AA-    no change
>  *  ----AA--    End A
>  *  ---AA--B    no change
>  *  --AA--BC    no change
>  *  -AA--BCC    Start C
>  *  AA--BCCD    no change
>  *  A--BCCDD    Start D
>  *  --BCCDD-    no change
>  *  -BCCDD-E    no change
>  *  BCCDD-EE    Start E
>  *  CCDD-EE-    no change
>  *  CDD-EE-F    no change
>  *  DD-EE-F-    no change
>  *  D-EE-F--    End E
>  */
> 
> 
> This addresses bugs ASTERISK-17493 and ASTERISK-19610.
>     https://issues.asterisk.org/jira/browse/ASTERISK-17493
>     https://issues.asterisk.org/jira/browse/ASTERISK-19610
> 
> 
> Diffs
> -----
> 
>   trunk/main/dsp.c 371649 
> 
> Diff: https://reviewboard.asterisk.org/r/2084/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Alec
> 
>


[Attachment #5 (text/html)]

<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/2084/">https://reviewboard.asterisk.org/r/2084/</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 30th, 2012, 3:19 p.m., <b>rmudgett</b> \
wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; \
padding-left: 10px;">  



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://reviewboard.asterisk.org/r/2084/diff/4/?file=31094#file31094line745" \
style="color: black; font-weight: bold; text-decoration: \
underline;">trunk/main/dsp.c</a>  <span style="font-weight: normal;">

     (Diff revision 4)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static \
int dtmf_detect(struct ast_dsp *dsp, digit_detect_state_t *s, int16_t amp[], int \
samples, int squelch, int relax)</pre></td>

  </tr>
 </tbody>




 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">731</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">			<span \
class="k">if</span> <span class="p">(</span><span class="n">s</span><span \
class="o">-&gt;</span><span class="n">td</span><span class="p">.</span><span \
class="n">dtmf</span><span class="p">.</span><span class="n">lasthit</span> <span \
class="o">!=</span> <span class="n">s</span><span class="o">-&gt;</span><span \
class="n">td</span><span class="p">.</span><span class="n">dtmf</span><span \
class="p">.</span><span class="n">current_hit</span><span class="p">)</span> <span \
class="p">{</span></pre></td>  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">732</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">				<span \
class="cm">/* 2 misses of current_hit */</span></pre></td>  </tr>

 </tbody>





 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">728</font></th>  <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">		<span class="k">if</span> \
<span class="p">(</span><span class="n">hit</span> <span class="o">==</span> <span \
class="n">s</span><span class="o">-&gt;</span><span class="n">td</span><span \
class="p">.</span><span class="n">dtmf</span><span class="p">.</span><span \
class="n">lasthit</span><span class="p">)</span> <span class="p">{</span></pre></td>  \
<th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">733</font></th>  <td bgcolor="#ffffff" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">				<span \
class="k">if</span> <span class="p">(</span><span class="n">hit</span> <span \
class="o">==</span> <span class="n">s</span><span class="o">-&gt;</span><span \
class="n">td</span><span class="p">.</span><span class="n">dtmf</span><span \
class="p">.</span><span class="n">lasthit</span><span class="p">)</span> <span \
class="p">{</span></pre></td>  </tr>

 </tbody>


 
 




 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">729</font></th>  <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">			<span class="k">if</span> \
<span class="p">(</span><span class="n">s</span><span class="o">-&gt;</span><span \
class="n">td</span><span class="p">.</span><span class="n">dtmf</span><span \
class="p">.</span><span class="n">current_hit</span><span class="p">)</span> <span \
class="p">{</span></pre></td>  <th bgcolor="#e9eaa8" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">734</font></th>  <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; ">					<span class="cm">/* 2 of the same, either a \
BEGIN or END digit */</span></pre></td>  </tr>

 </tbody>




 
 


 <tbody>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">730</font></th>  <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">				<span class="cm">/* We are \
in the middle of a digit already */</span></pre></td>  <th bgcolor="#ebb1ba" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  </tr>

 </tbody>





 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">731</font></th>  <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">				<span class="k">if</span> \
<span class="p">(</span><span class="n">hit</span><span class="p">)</span> <span \
class="p">{</span></pre></td>  <th bgcolor="#f0f0f0" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">735</font></th>  <td bgcolor="#ffffff" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; ">					<span class="k">if</span> <span \
class="p">(</span><span class="n">hit</span><span class="p">)</span> <span \
class="p">{</span></pre></td>  </tr>

 </tbody>


 
 




 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">732</font></th>  <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">					<span class="k">if</span> \
<span class="p">(</span><span class="n">hit</span> <span class="o">!=</span> <span \
class="n">s</span><span class="o">-&gt;</span><span class="n">td</span><span \
class="p">.</span><span class="n">dtmf</span><span class="p">.</span><span \
class="n">current_hit</span><span class="p">)</span> <span \
class="p">{</span></pre></td>  <th bgcolor="#e9eaa8" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">736</font></th>  <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; ">						<span class="n">store_digit</span><span \
class="p">(</span><span class="n">s</span><span class="p">,</span> <span \
class="n">hit</span><span class="p">);</span></pre></td>  </tr>

 </tbody>




 
 


 <tbody>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">733</font></th>  <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">						<span class="cm">/* Look \
for a start of a new digit.</span></pre></td>  <th bgcolor="#ebb1ba" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  </tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">734</font></th>  <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cm">						   This \
is because hits_to_begin may be smaller than misses_to_end</span></pre></td>  <th \
bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2"></font></th>  <td bgcolor="#ffc5ce" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  \
</tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">735</font></th>  <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cm">						   and \
we may find the beginning of new digit before we consider last one ended. \
*/</span></pre></td>  <th bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; \
border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>  <td \
bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; "></pre></td>  </tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">736</font></th>  <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">						<span \
class="n">s</span><span class="o">-&gt;</span><span class="n">td</span><span \
class="p">.</span><span class="n">dtmf</span><span class="p">.</span><span \
class="n">current_hit</span> <span class="o">=</span> <span class="mi">0</span><span \
class="p">;</span></pre></td>  <th bgcolor="#ebb1ba" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>  \
<td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; \
margin: 0; "></pre></td>  </tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">737</font></th>  <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">					<span class="p">}</span> \
<span class="k">else</span> <span class="p">{</span></pre></td>  <th \
bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2"></font></th>  <td bgcolor="#ffc5ce" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  \
</tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">738</font></th>  <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">						<span class="cm">/* \
Current hit was same as last, so increment digit duration (of last digit) \
*/</span></pre></td>  <th bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; \
border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>  <td \
bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; "></pre></td>  </tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">739</font></th>  <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">						<span \
class="n">s</span><span class="o">-&gt;</span><span class="n">digitlen</span><span \
class="p">[</span><span class="n">s</span><span class="o">-&gt;</span><span \
class="n">current_digits</span> <span class="o">-</span> <span \
class="mi">1</span><span class="p">]</span> <span class="o">+=</span> <span \
class="n">DTMF_GSIZE</span><span class="p">;</span></pre></td>  <th bgcolor="#ebb1ba" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  </tr>

 </tbody>





 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">740</font></th>  <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">					<span \
class="p">}</span></pre></td>  <th bgcolor="#f0f0f0" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">737</font></th>  <td bgcolor="#ffffff" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; ">					<span class="p">}</span></pre></td>  </tr>

 </tbody>


 
 




 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">741</font></th>  <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">				<span class="p">}</span> \
<span class="k">else</span> <span class="p">{</span></pre></td>  <th \
bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">738</font></th>  <td bgcolor="#fdfebc" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">					<span \
class="n">s</span><span class="o">-&gt;</span><span class="n">td</span><span \
class="p">.</span><span class="n">dtmf</span><span class="p">.</span><span \
class="n">current_hit</span> <span class="o">=</span> <span class="n">hit</span><span \
class="p">;</span></pre></td>  </tr>

 </tbody>




 
 


 <tbody>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">742</font></th>  <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">					<span class="cm">/* No \
Digit */</span></pre></td>  <th bgcolor="#ebb1ba" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>  \
<td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; \
margin: 0; "></pre></td>  </tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">743</font></th>  <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">					<span \
class="n">s</span><span class="o">-&gt;</span><span class="n">td</span><span \
class="p">.</span><span class="n">dtmf</span><span class="p">.</span><span \
class="n">misses</span><span class="o">++</span><span class="p">;</span></pre></td>  \
<th bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2"></font></th>  <td bgcolor="#ffc5ce" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  \
</tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">744</font></th>  <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">					<span class="k">if</span> \
<span class="p">(</span><span class="n">s</span><span class="o">-&gt;</span><span \
class="n">td</span><span class="p">.</span><span class="n">dtmf</span><span \
class="p">.</span><span class="n">misses</span> <span class="o">==</span> <span \
class="n">s</span><span class="o">-&gt;</span><span class="n">td</span><span \
class="p">.</span><span class="n">dtmf</span><span class="p">.</span><span \
class="n">misses_to_end</span><span class="p">)</span> <span \
class="p">{</span></pre></td>  <th bgcolor="#ebb1ba" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>  \
<td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; \
margin: 0; "></pre></td>  </tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">745</font></th>  <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">						<span class="cm">/* \
There were enough misses to consider digit ended */</span></pre></td>  <th \
bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2"></font></th>  <td bgcolor="#ffc5ce" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  \
</tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">746</font></th>  <td bgcolor="#ffc5ce" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">						<span \
class="n">s</span><span class="o">-&gt;</span><span class="n">td</span><span \
class="p">.</span><span class="n">dtmf</span><span class="p">.</span><span \
class="n">current_hit</span> <span class="o">=</span> <span class="mi">0</span><span \
class="p">;</span></pre></td>  <th bgcolor="#ebb1ba" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>  \
<td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; \
margin: 0; "></pre></td>  </tr>

 </tbody>





 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">747</font></th>  <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">					<span \
class="p">}</span></pre></td>  <th bgcolor="#f0f0f0" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">739</font></th>  <td bgcolor="#ffffff" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; ">				<span class="p">}</span></pre></td>  </tr>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">748</font></th>  <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">				<span \
class="p">}</span></pre></td>  <th bgcolor="#f0f0f0" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">740</font></th>  <td bgcolor="#ffffff" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; ">			<span class="p">}</span></pre></td>  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Maybe change to make 2 \
misses end any digit: if (s-&gt;td.dtmf.lasthit != s-&gt;td.dtmf.current_hit) {
	/* 2 misses of current_hit */
	if (hit == s-&gt;td.dtmf.lasthit) {
		/* 2 of the same, either a BEGIN or END digit */
		if (hit) {
			store_digit(s, hit);
		}
		s-&gt;td.dtmf.current_hit = hit;
	} else {
		/* 2 misses ends current digit */
		s-&gt;td.dtmf.current_hit = 0;
	}
}
</pre>
 </blockquote>



 <p>On August 30th, 2012, 3:48 p.m., <b>Alec Davis</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;">I abandoned this, and \
produced https://reviewboard.asterisk.org/r/2085/</pre>  </blockquote>







</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Then you \
should discard this review request.</pre> <br />




<p>- rmudgett</p>


<br />
<p>On August 26th, 2012, 2:20 a.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, rmudgett and Jason Parker.</div>
<div>By Alec Davis.</div>


<p style="color: grey;"><i>Updated Aug. 26, 2012, 2:20 a.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;">Use a simpler method to detect changes in DTMF ON/OFF tones.

Similar method to latest spandsp/dtmf.c

   We must detect 2 silences for DTMF END.


Reverts some of 111022 that added DTMF_HITS_TO_BEGIN and DTMF_MISSES_TO_END

Exisiting dtmf events with;
/* hits_to_begin = 3, misses to end = 2 */
/* --------A    hits=1, misses=1, lasthit=&#39;A&#39;
 * -------AA    hits=2
 * ------AAA    hits=3, store_digit, current_hit=&#39;A&#39;,	BEGIN A
 * -----AAA-    hits=1, misses=1, lasthit=&#39; &#39;
 * ----AAA--    misses=2, current_hit=&#39; &#39;, 		END A
 * ---AAA--B    hits=1, misses=1, lasthit=&#39;B&#39;
 * --AAA--BB    hits=2
 * -AAA--BBB    hits=3, store_digit, current_hit=&#39;B&#39;,	BEGIN B
 * AAA--BBB-    hits=1, misses=1, lasthit=&#39; &#39;
 * AA--BBB-B    hits=1, misses=1, lasthit=&#39;B&#39;
 * A--BBB-BB    digitlen += GSIZE
 *              deal with an interruption
 * --BBB-BB-    hits=1, misses=1, lasthit=&#39; &#39;
 * -BBB-BB-B    hits=1, misses=1, lasthit=&#39;B&#39;
 * BBB-BB-BB    digitlen += GSIZE
 *              deal with no interdigit pause
 * BB-BB-BBC    hits=1, misses=1, lasthit=&#39;C&#39;
 * B-BB-BBCC    current_hit=&#39; &#39;,			END B
 * -BB-BBCCC    hits=2
 * BB-BBCCCC    hits=3, store_digit, current_hit=&#39;C&#39;,	BEGIN C
 */


How it would be without, hits_to_begin, and misses_to_end

/*  ------AA    Begin A
 *  -----AA-    no change
 *  ----AA--    End A
 *  ---AA--B    no change
 *  --AA--BC    no change
 *  -AA--BCC    Start C
 *  AA--BCCD    no change
 *  A--BCCDD    Start D
 *  --BCCDD-    no change
 *  -BCCDD-E    no change
 *  BCCDD-EE    Start E
 *  CCDD-EE-    no change
 *  CDD-EE-F    no change
 *  DD-EE-F-    no change
 *  D-EE-F--    End E
 */
</pre>
  </td>
 </tr>
</table>




<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="https://issues.asterisk.org/jira/browse/ASTERISK-17493">ASTERISK-17493</a>, \


 <a href="https://issues.asterisk.org/jira/browse/ASTERISK-19610">ASTERISK-19610</a>


</div>


<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">(371649)</span></li>

</ul>

<p><a href="https://reviewboard.asterisk.org/r/2084/diff/" style="margin-left: \
3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>



--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic