<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:D="DAV:" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.apple-style-span
        {mso-style-name:apple-style-span;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:2.0cm 42.5pt 2.0cm 3.0cm;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=RU link=blue vlink=purple style='word-wrap: break-word;-webkit-nbsp-mode: space;
-webkit-line-break: after-white-space'>

<div class=Section1>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Well, speaking about &#8220;in practice&#8221; &#8211; I have a dozen
of analog phones which generate so short inter-digit interval that even Asterisk&#8217;s
dsp.c without any modifications is unable to catch double digits properly. I
haven&#8217;t measured actual interval yet (will do tomorrow) but from the way
how dsp.c works, I would guess interval is something about 20 ms. Which obviously
violates the spec but who cares &#8211; I have to do something about it.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Anyway, my personal opinion regarding all that tuning is: &#8220;compile
time options suck&#8221;. First, they affect all usages of DSP even on channels
where no problems exist and second, a few options interleaving the code can
easily make it unreadable. I would prefer making DSP code tunable using some API
so code always remain the same but channels may configure DSP per their needs.
(Eventually taking DTMF options from channel configuration files). But it is work
for future&#8230;<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Regards,<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Dmitry Andrianov<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> asterisk-dev-bounces@lists.digium.com
[mailto:asterisk-dev-bounces@lists.digium.com] <b>On Behalf Of </b>Daniel
Hazelbaker<br>
<b>Sent:</b> Tuesday, December 04, 2007 1:08 AM<br>
<b>To:</b> Asterisk Developers Mailing List<br>
<b>Subject:</b> Re: [asterisk-dev] DTMF end accepted without begin<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<div>

<div>

<div>

<p class=MsoNormal>On Dec 3, 2007, at 1:24 PM, Dmitry Andrianov wrote:<o:p></o:p></p>

</div>

<p class=MsoNormal><br>
<br>
<o:p></o:p></p>

<div>

<div>

<div>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Regarding the<span class=apple-converted-space>&nbsp;</span></span><span
lang=EN-US style='color:black'>&lt;</span><span style='color:black'><a
href="http://www.blueboxmoon.com/bitweaver/blogs/view_post.php?post_id=10"
target="_blank"><span lang=EN-US>http://www.blueboxmoon.com/bitweaver/blogs/view_post.php?post_id=10</span></a></span><span
lang=EN-US style='color:black'>&gt;<span class=apple-converted-space>&nbsp;</span></span><span
lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>patch &#8211; as I understand you allow up to 4 successive
misses inside a digit to still consider it a single digit. With block size of
102 samples (12.75 ms @ 8 KHz sampling) it means about 50 ms. However, 50 ms is
valid inter-digit interval (matching minimum interval duration requirements) .</span><span
style='color:black'><o:p></o:p></span></p>

</div>

</div>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>In terms of spec (which is what I believe you are referring
to), yes. &nbsp;In practice, pressing the buttons just as fast as I possibly
can (i.e. sitting there and pressing the number 2 over and over again) the
smallest interval I saw was 7 (or about 90ms). &nbsp;I tested a number of
different automated dialers (phone speed dials, computer modem dials, flash
transfer dials, etc) and all of those were also above 90ms...<o:p></o:p></p>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</div>

<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'>

<div>

<div>

<div>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Which means your patch is not for &#8220;general public&#8221;
because it will almost certainly be eliminating double-digits even where they
are should remain.</span><span style='color:black'><o:p></o:p></span></p>

</div>

</div>

</div>

</blockquote>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>... so it should be relatively safe, but I do agree whole
heartedly. &nbsp;I wouldn't ever recommend this patch to trunk (which is why I
have never posted it to mantis) except *possibly* as a compile time option,
kind of like the RELAX_RADIO option as it's only purpose is to help with noisy
lines, or other related issues. &nbsp;And especially with a lot of areas
beginning to go digital we should hopefully have less and less need for things
like this. &nbsp;I'm not a big fan of breaking specs, but being able to do this
solved a 2 year old problem of people complaining about dialing one extension
and getting another.<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>Daniel<o:p></o:p></p>

</div>

<p class=MsoNormal><br>
<br>
<o:p></o:p></p>

<div>

<div>

<div>

<p class=MsoNormal><span class=apple-style-span><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:#144FAE'>From:</span></b></span><span
class=apple-style-span><span lang=EN-US style='font-size:10.0pt;font-family:
"Tahoma","sans-serif";color:#144FAE'>&nbsp;<a
href="mailto:asterisk-dev-bounces@lists.digium.com">asterisk-dev-bounces@lists.digium.com</a>&nbsp;[<a
href="mailto:asterisk-dev-bounces@lists.digium.com">mailto:asterisk-dev-bounces@lists.digium.com</a>]&nbsp;<b>On
Behalf Of&nbsp;</b>Daniel Hazelbaker</span></span><span style='color:black'><o:p></o:p></span></p>

</div>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm;
border-width:initial;border-color:initial'>

<div>

<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Tahoma","sans-serif";color:black'>Sent:</span></b><span
class=apple-converted-space><span lang=EN-US style='font-size:10.0pt;
font-family:"Tahoma","sans-serif";color:black'>&nbsp;</span></span><span
lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif";
color:black'>Monday, December 03, 2007 9:31 PM<br>
<b>To:</b><span class=apple-converted-space>&nbsp;</span>Asterisk Developers
Mailing List<br>
<b>Subject:</b><span class=apple-converted-space>&nbsp;</span>Re:
[asterisk-dev] DTMF end accepted without begin</span><span style='color:black'><o:p></o:p></span></p>

</div>

</div>

</div>

<div>

<p class=MsoNormal><span style='color:black'>&nbsp;<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='color:black'>Have you tried setting the
relaxdtmf setting in /etc/asterisk/zapata.conf? &nbsp;You also have to turn on
&quot;Relax DTMF for Radio Applications&quot; (even though it has nothing to do
with radio communications). &nbsp;That might solve the completely missing tones.<o:p></o:p></span></p>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>&nbsp;<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>Based upon my own research and
that of somebody else (sorry can't remember name) that did some major fixing up
of code in the dsp.c DTMF detection code recently, dsp.c does the actual DTMF
detection. &nbsp;Zaptel doesn't seem to do squat when it comes to DTMF
detection.<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>&nbsp;<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>You can play around in dsp.c near line
165. &nbsp;Play with those DTMF_ defines (make sure you are in the right
#ifdef) and you might be able to tweak some stuff to better detect in your
situation. &nbsp;Personally I found that when I turned on the relaxdtmf option
people's voices were being detected as tones, but you might be able to get a
more precise &quot;relaxed&quot; mode.<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>&nbsp;<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>Also, my patch stemmed from the
following logging information. &nbsp;You might be able to turn it on and see
exactly what is happening when tones are missed. &nbsp;(Warning: this will spit
out a TON of logging information).<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>&nbsp;<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>This is from 1.4.12, line 591 and
surrounding:<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>&nbsp;<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp;&amp;
goertzel_result(&amp;s-&gt;row_out2nd[best_row])*DTMF_2ND_HARMONIC_ROW &lt;
row_energy[best_row]) {<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>#else<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/* ... and fraction of
total energy test */<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>ADD-&gt; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp;ast_log(LOG_NOTICE, &quot;dtmf_detect row_energy=%f,
col_energy=%f, total=%f &gt; %f (%f + %f)&quot;, row_energy[best_row],
col_energy[best_col],<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>ADD-&gt; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(row_energy[best_row] + col_energy[best_col]),
(DTMF_TO_TOTAL_ENERGY * s-&gt;energy), DTMF_TO_TOTAL_ENERGY, s-&gt;energy);<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (i &gt;= 4 &amp;&amp;<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;(row_energy[best_row] + col_energy[best_col]) &gt;
DTMF_TO_TOTAL_ENERGY*s-&gt;energy) {<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>#endif<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;/* Got a hit */<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>&nbsp;<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>It is a bit messy, but it might
help track down exactly what &quot;energy&quot; values you would need to catch
those false negatives.<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>&nbsp;<o:p></o:p></span></p>

</div>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>Daniel<o:p></o:p></span></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>&nbsp;<o:p></o:p></span></p>

</div>

<div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>On Dec 3, 2007, at 9:55 AM, John
Aughey wrote:<o:p></o:p></span></p>

</div>

</div>

<div>

<p class=MsoNormal><span style='color:black'><br>
<br>
<br>
<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='color:black'>We actually get both the
&quot;wobble&quot; detection (multiple tones detected with one button press)
and missing detection (press 201 and it detects 01 missing the 2).&nbsp; The
suggestions on voip-info have not yet helped and the lack of DTMF_BEGIN events
concern me.&nbsp; It's also not clear right now where the dtmf detection is
done, if it's in the zaptel-1.4.6 code base or within
asterisk-1.4.14/main/dsp.c.&nbsp; They both seem to do tone detection.<br>
<br>
John<o:p></o:p></span></p>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>On Dec 3, 2007 10:31 AM, Daniel
Hazelbaker &lt;<a href="mailto:daniel@highdesertchurch.com"><span
class=apple-converted-space>&nbsp;</span>daniel@highdesertchurch.com</a>&gt;
wrote:<o:p></o:p></span></p>

</div>

<div>

<div>

<p class=MsoNormal><span style='color:black'>On Dec 2, 2007, at 5:35 PM, John
Aughey wrote:<span class=apple-converted-space>&nbsp;</span><br>
<br>
&gt; The begin frames (and associated end frames) are helpful to filter<br>
&gt; out short dtmf reads. &nbsp;There's even a #define which specifies the<br>
&gt; minimum length of a dtmf tone. &nbsp;One problem we're having is multiple<span
class=apple-converted-space>&nbsp;</span><br>
&gt; dtmf detections on a noisy cell phone connection, which should be<br>
&gt; mostly filtered by knowing the begin and end time so that the length<br>
&gt; can be properly measured and filtered if needed.<br>
&gt;<br>
&gt; John<o:p></o:p></span></p>

</div>

</div>

<div>

<p class=MsoNormal><span style='color:black'>If you are running 1.4.15 (it
should apply down to .12 as well I<br>
believe) then you can try this patch. &nbsp;We have a similar problem at<br>
our site, except it is due to a junky NEC that is currently the front-<span
class=apple-converted-space>&nbsp;</span><br>
end to the Telco. &nbsp;Tones would have a drop-out in the middle of them<br>
so Asterisk was detected double digits. &nbsp;i.e. they dial 235 and it<br>
reads 2335. &nbsp;With this patch the &quot;wobble&quot; tones are almost never
an<span class=apple-converted-space>&nbsp;</span><br>
issue anymore.<br>
<br>
&lt;<a
href="http://www.blueboxmoon.com/bitweaver/blogs/view_post.php?post_id=10"
target="_blank">http://www.blueboxmoon.com/bitweaver/blogs/view_post.php?post_id=10</a>&gt;<br>
</span><span style='color:#888888'><br>
Daniel</span><span style='color:black'><o:p></o:p></span></p>

</div>

<div>

<div>

<div>

<p class=MsoNormal><span style='color:black'><br>
_______________________________________________<br>
--Bandwidth and Colocation Provided by<span class=apple-converted-space>&nbsp;</span><a
href="http://www.api-digital.com--" target="_blank">http://www.api-digital.com--<span
class=apple-converted-space>&nbsp;</span></a><br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
&nbsp;<span class=apple-converted-space>&nbsp;</span><a
href="http://lists.digium.com/mailman/listinfo/asterisk-dev" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-dev</a><o:p></o:p></span></p>

</div>

</div>

</div>

</div>

<div>

<p class=MsoNormal><span style='color:black'><br>
_______________________________________________<br>
--Bandwidth and Colocation Provided by<span class=apple-converted-space>&nbsp;</span><a
href="http://www.api-digital.com">http://www.api-digital.com</a>--<br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
&nbsp;&nbsp;<a href="http://lists.digium.com/mailman/listinfo/asterisk-dev">http://lists.digium.com/mailman/listinfo/asterisk-dev</a><o:p></o:p></span></p>

</div>

</div>

<div>

<p class=MsoNormal><span style='color:black'>&nbsp;<o:p></o:p></span></p>

</div>

</div>

</div>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica","sans-serif";
color:black'>_______________________________________________<br>
--Bandwidth and Colocation Provided by<span class=apple-converted-space>&nbsp;</span><a
href="http://www.api-digital.com">http://www.api-digital.com</a>--<br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
&nbsp;&nbsp;<a href="http://lists.digium.com/mailman/listinfo/asterisk-dev">http://lists.digium.com/mailman/listinfo/asterisk-dev</a><o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</div>

</body>

</html>