<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][15084] </title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=15084">15084</a></dd>
<dt>Author</dt> <dd>anthm</dd>
<dt>Date</dt> <dd>2009-10-05 09:34:26 -0500 (Mon, 05 Oct 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>update to spandsp snapshot 20091005</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunklibsspandspupdate">freeswitch/trunk/libs/spandsp/.update</a></li>
<li><a href="#freeswitchtrunklibsspandspconfigureac">freeswitch/trunk/libs/spandsp/configure.ac</a></li>
<li><a href="#freeswitchtrunklibsspandspspandspfaxtestsdtd">freeswitch/trunk/libs/spandsp/spandsp/fax-tests.dtd</a></li>
<li><a href="#freeswitchtrunklibsspandspspandspsimline_modelc">freeswitch/trunk/libs/spandsp/spandsp-sim/line_model.c</a></li>
<li><a href="#freeswitchtrunklibsspandspspandspsimmake_line_modelsc">freeswitch/trunk/libs/spandsp/spandsp-sim/make_line_models.c</a></li>
<li><a href="#freeswitchtrunklibsspandspspandspsimspandspline_modelh">freeswitch/trunk/libs/spandsp/spandsp-sim/spandsp/line_model.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcMakefileam">freeswitch/trunk/libs/spandsp/src/Makefile.am</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcat_interpreterc">freeswitch/trunk/libs/spandsp/src/at_interpreter.c</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcechoc">freeswitch/trunk/libs/spandsp/src/echo.c</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcfaxc">freeswitch/trunk/libs/spandsp/src/fax.c</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcfax_modemsc">freeswitch/trunk/libs/spandsp/src/fax_modems.c</a></li>
<li><a href="#freeswitchtrunklibsspandspsrclibspandsp2005vcproj">freeswitch/trunk/libs/spandsp/src/libspandsp.2005.vcproj</a></li>
<li><a href="#freeswitchtrunklibsspandspsrclibspandsp2008vcproj">freeswitch/trunk/libs/spandsp/src/libspandsp.2008.vcproj</a></li>
<li><a href="#freeswitchtrunklibsspandspsrclibspandspdsp">freeswitch/trunk/libs/spandsp/src/libspandsp.dsp</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcmake_modem_filterc">freeswitch/trunk/libs/spandsp/src/make_modem_filter.c</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcmodem_echoc">freeswitch/trunk/libs/spandsp/src/modem_echo.c</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcmsvcspandsph">freeswitch/trunk/libs/spandsp/src/msvc/spandsp.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcsig_tonec">freeswitch/trunk/libs/spandsp/src/sig_tone.c</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcsilence_genc">freeswitch/trunk/libs/spandsp/src/silence_gen.c</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspechoh">freeswitch/trunk/libs/spandsp/src/spandsp/echo.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspexposeh">freeswitch/trunk/libs/spandsp/src/spandsp/expose.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspfast_converth">freeswitch/trunk/libs/spandsp/src/spandsp/fast_convert.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspmodem_echoh">freeswitch/trunk/libs/spandsp/src/spandsp/modem_echo.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspprivatefax_modemsh">freeswitch/trunk/libs/spandsp/src/spandsp/private/fax_modems.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspprivatesig_toneh">freeswitch/trunk/libs/spandsp/src/spandsp/private/sig_tone.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspprivatet30h">freeswitch/trunk/libs/spandsp/src/spandsp/private/t30.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspsig_toneh">freeswitch/trunk/libs/spandsp/src/spandsp/sig_tone.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspsilence_genh">freeswitch/trunk/libs/spandsp/src/spandsp/silence_gen.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspt30h">freeswitch/trunk/libs/spandsp/src/spandsp/t30.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandsptimingh">freeswitch/trunk/libs/spandsp/src/spandsp/timing.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspversionh">freeswitch/trunk/libs/spandsp/src/spandsp/version.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandsphin">freeswitch/trunk/libs/spandsp/src/spandsp.h.in</a></li>
<li><a href="#freeswitchtrunklibsspandspsrct30c">freeswitch/trunk/libs/spandsp/src/t30.c</a></li>
<li><a href="#freeswitchtrunklibsspandspsrct31c">freeswitch/trunk/libs/spandsp/src/t31.c</a></li>
<li><a href="#freeswitchtrunklibsspandspsrct38_terminalc">freeswitch/trunk/libs/spandsp/src/t38_terminal.c</a></li>
<li><a href="#freeswitchtrunklibsspandsptestsMakefileam">freeswitch/trunk/libs/spandsp/tests/Makefile.am</a></li>
<li><a href="#freeswitchtrunklibsspandsptestsfax_decodec">freeswitch/trunk/libs/spandsp/tests/fax_decode.c</a></li>
<li><a href="#freeswitchtrunklibsspandsptestsline_model_testsc">freeswitch/trunk/libs/spandsp/tests/line_model_tests.c</a></li>
<li><a href="#freeswitchtrunklibsspandsptestsregression_testssh">freeswitch/trunk/libs/spandsp/tests/regression_tests.sh</a></li>
<li><a href="#freeswitchtrunklibsspandsptestssig_tone_testsc">freeswitch/trunk/libs/spandsp/tests/sig_tone_tests.c</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#freeswitchtrunklibsspandspsrcspandspprivateechoh">freeswitch/trunk/libs/spandsp/src/spandsp/private/echo.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspprivatemodem_echoh">freeswitch/trunk/libs/spandsp/src/spandsp/private/modem_echo.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspprivateswept_toneh">freeswitch/trunk/libs/spandsp/src/spandsp/private/swept_tone.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcspandspswept_toneh">freeswitch/trunk/libs/spandsp/src/spandsp/swept_tone.h</a></li>
<li><a href="#freeswitchtrunklibsspandspsrcswept_tonec">freeswitch/trunk/libs/spandsp/src/swept_tone.c</a></li>
<li><a href="#freeswitchtrunklibsspandsptestsswept_tone_testsc">freeswitch/trunk/libs/spandsp/tests/swept_tone_tests.c</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunklibsspandspupdate"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/.update (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/.update        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/.update        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -1 +1 @@
</span><del>-Wed Oct  1 00:08:32 EDT 2008
</del><ins>+Mon Oct  5 09:33:55 CDT 2009
</ins></span></pre></div>
<a id="freeswitchtrunklibsspandspconfigureac"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/configure.ac (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/configure.ac        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/configure.ac        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -16,7 +16,7 @@
</span><span class="cx"> # License along with this program; if not, write to the Free Software
</span><span class="cx"> # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx"> #
</span><del>-# $Id: configure.ac,v 1.71 2009/07/12 09:29:18 steveu Exp $
</del><ins>+# $Id: configure.ac,v 1.73 2009/10/03 04:37:25 steveu Exp $
</ins><span class="cx"> 
</span><span class="cx"> # @start 1
</span><span class="cx"> 
</span><span class="lines">@@ -108,20 +108,20 @@
</span><span class="cx">   CXXFLAGS=${CXXFLAGS-&quot;-g -O2&quot;}
</span><span class="cx"> fi
</span><span class="cx"> 
</span><del>-AC_DEFUN([REMOVE_FROM_VAR],[                                                                                                                                     
-    new_val=&quot;&quot;                                                                                                                                           
-    removed=0                                                                                                                                               
-    for i in $$1; do                                                                                                                                            
-      if test &quot;x$i&quot; != &quot;x$2&quot;; then                                                                                                                              
-        new_val=&quot;$new_val $i&quot;                                                                                                                     
-      else                                                                                                                                                      
-        removed=1                                                                                                                                           
-      fi                                                                                                                                                        
-    done                                                                                                                                                        
-    if test $removed = &quot;1&quot;; then                                                                                                                            
-      echo &quot;  removed \&quot;$2\&quot; from $1&quot;                                                                                              
-      $1=$new_val                                                                                                                                        
-    fi                                                                                                                                                          
</del><ins>+AC_DEFUN([REMOVE_FROM_VAR],[
+    new_val=&quot;&quot;
+    removed=0
+    for i in $$1; do
+        if test &quot;x$i&quot; != &quot;x$2&quot;; then
+            new_val=&quot;$new_val $i&quot;
+        else
+            removed=1
+        fi
+    done
+    if test $removed = &quot;1&quot;; then
+        echo &quot;  removed \&quot;$2\&quot; from $1&quot;
+        $1=$new_val
+    fi
</ins><span class="cx"> ])
</span><span class="cx"> 
</span><span class="cx"> AC_C_CONST
</span><span class="lines">@@ -146,10 +146,10 @@
</span><span class="cx"> AC_ARG_ENABLE(sse4a,        [  --enable-sse4a       Enable SSE4A support])
</span><span class="cx"> AC_ARG_ENABLE(sse5,         [  --enable-sse5        Enable SSE5 support])
</span><span class="cx"> AC_ARG_ENABLE(fixed_point,  [  --enable-fixed-point Enable fixed point support])
</span><ins>+# The following is for MSVC, where we may be using a local copy of libtiff, built alongside spandsp
</ins><span class="cx"> AC_ARG_ENABLE(builtin_tiff,
</span><del>-[AC_HELP_STRING([--enable-builtin-tiff],[build with builtin libtiff])],[enable_builtin_tiff=&quot;$enableval&quot;],[enable_builtin_tiff=&quot;no&quot;])
</del><ins>+    [AC_HELP_STRING([--enable-builtin-tiff],[build with builtin libtiff])],[enable_builtin_tiff=&quot;$enableval&quot;],[enable_builtin_tiff=&quot;no&quot;])
</ins><span class="cx"> 
</span><del>-
</del><span class="cx"> AC_FUNC_ERROR_AT_LINE
</span><span class="cx"> AC_FUNC_VPRINTF
</span><span class="cx"> AC_FUNC_MALLOC
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspspandspfaxtestsdtd"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/spandsp/fax-tests.dtd (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/spandsp/fax-tests.dtd        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/spandsp/fax-tests.dtd        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -1,6 +1,7 @@
</span><span class="cx"> &lt;!-- FAX test scripts --&gt;
</span><span class="cx"> &lt;!ELEMENT fax-tests (config|messages|test-group)* &gt;
</span><span class="cx"> &lt;!ELEMENT config (path)* &gt;
</span><ins>+&lt;!ELEMENT path (EMPTY)* &gt;
</ins><span class="cx"> &lt;!ATTLIST path
</span><span class="cx">   type      CDATA   #REQUIRED
</span><span class="cx">   value     CDATA   #REQUIRED
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspspandspsimline_modelc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/spandsp-sim/line_model.c (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/spandsp-sim/line_model.c        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/spandsp-sim/line_model.c        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: line_model.c,v 1.12 2009/06/01 16:27:12 steveu Exp $
</del><ins>+ * $Id: line_model.c,v 1.14 2009/09/23 16:02:59 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #if defined(HAVE_CONFIG_H)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx"> #define NULL (void *) 0
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-float null_line_model[] =
</del><ins>+static const float null_line_model[] =
</ins><span class="cx"> {
</span><span class="cx">         0.0,
</span><span class="cx">         0.0,
</span><span class="lines">@@ -187,7 +187,7 @@
</span><span class="cx">         1.0
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-static float *models[] =
</del><ins>+SPAN_DECLARE_DATA const float *line_models[] =
</ins><span class="cx"> {
</span><span class="cx">     null_line_model,        /* 0 */
</span><span class="cx">     proakis_line_model,
</span><span class="lines">@@ -225,7 +225,7 @@
</span><span class="cx">     s-&gt;near_buf_ptr = p;
</span><span class="cx">     
</span><span class="cx">     /* Apply the filter */
</span><del>-    sum = 0;
</del><ins>+    sum = 0.0f;
</ins><span class="cx">     for (j = 0;  j &lt; s-&gt;near_filter_len;  j++)
</span><span class="cx">     {
</span><span class="cx">         sum += s-&gt;near_filter[j]*s-&gt;near_buf[p];
</span><span class="lines">@@ -254,7 +254,7 @@
</span><span class="cx">     s-&gt;far_buf_ptr = p;
</span><span class="cx">     
</span><span class="cx">     /* Apply the filter */
</span><del>-    sum = 0;
</del><ins>+    sum = 0.0f;
</ins><span class="cx">     for (j = 0;  j &lt; s-&gt;far_filter_len;  j++)
</span><span class="cx">     {
</span><span class="cx">         sum += s-&gt;far_filter[j]*s-&gt;far_buf[p];
</span><span class="lines">@@ -479,10 +479,10 @@
</span><span class="cx"> 
</span><span class="cx">     s-&gt;munge = codec_munge_init(codec, rbs_pattern);
</span><span class="cx"> 
</span><del>-    s-&gt;near_filter = models[model];
</del><ins>+    s-&gt;near_filter = line_models[model];
</ins><span class="cx">     s-&gt;near_filter_len = 129;
</span><span class="cx"> 
</span><del>-    s-&gt;far_filter = models[model];
</del><ins>+    s-&gt;far_filter = line_models[model];
</ins><span class="cx">     s-&gt;far_filter_len = 129;
</span><span class="cx"> 
</span><span class="cx">     /* Put half the noise in each analogue section */
</span><span class="lines">@@ -526,14 +526,14 @@
</span><span class="cx">     s-&gt;line1.bulk_delay_ptr = 0;
</span><span class="cx">     s-&gt;line2.bulk_delay_ptr = 0;
</span><span class="cx"> 
</span><del>-    s-&gt;line1.near_filter = models[model1];
</del><ins>+    s-&gt;line1.near_filter = line_models[model1];
</ins><span class="cx">     s-&gt;line1.near_filter_len = 129;
</span><del>-    s-&gt;line2.near_filter = models[model2];
</del><ins>+    s-&gt;line2.near_filter = line_models[model2];
</ins><span class="cx">     s-&gt;line2.near_filter_len = 129;
</span><span class="cx"> 
</span><del>-    s-&gt;line1.far_filter = models[model1];
</del><ins>+    s-&gt;line1.far_filter = line_models[model1];
</ins><span class="cx">     s-&gt;line1.far_filter_len = 129;
</span><del>-    s-&gt;line2.far_filter = models[model2];
</del><ins>+    s-&gt;line2.far_filter = line_models[model2];
</ins><span class="cx">     s-&gt;line2.far_filter_len = 129;
</span><span class="cx"> 
</span><span class="cx">     /* Put half the noise in each analogue section */
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspspandspsimmake_line_modelsc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/spandsp-sim/make_line_models.c (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/spandsp-sim/make_line_models.c        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/spandsp-sim/make_line_models.c        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: make_line_models.c,v 1.9 2009/02/10 17:49:20 steveu Exp $
</del><ins>+ * $Id: make_line_models.c,v 1.10 2009/09/23 16:02:59 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \page make_line_models_page Telephony line model construction
</span><span class="lines">@@ -849,7 +849,8 @@
</span><span class="cx">                     offset = (f - edd[l - 1].freq)/(edd[l].freq - edd[l - 1].freq);
</span><span class="cx">                     delay = (1.0f - offset)*edd[l - 1].edd[k] + offset*edd[l].edd[k];
</span><span class="cx">                 }
</span><del>-                phase = 2.0f*M_PI*f*delay*0.001f;
</del><ins>+                //phase = 2.0f*M_PI*f*delay*0.001f;
+                phase = 0.0f;
</ins><span class="cx"> #if defined(HAVE_FFTW3_H)    
</span><span class="cx">                 in[i][0] = amp*cosf(phase);
</span><span class="cx">                 in[i][1] = amp*sinf(phase);
</span><span class="lines">@@ -874,7 +875,7 @@
</span><span class="cx"> 
</span><span class="cx">             fprintf(outfile, &quot;/* V.56bis AD-%d, EDD%d */\n&quot;, (j == 0)  ?  1  :  j + 4, k + 1);
</span><span class="cx"> 
</span><del>-            fprintf(outfile, &quot;float ad_%d_edd_%d_model[] =\n&quot;, (j == 0)  ?  1  :  j + 4, k + 1);
</del><ins>+            fprintf(outfile, &quot;const float ad_%d_edd_%d_model[] =\n&quot;, (j == 0)  ?  1  :  j + 4, k + 1);
</ins><span class="cx">             fprintf(outfile, &quot;{\n&quot;);
</span><span class="cx">             /* Normalise the filter's gain */
</span><span class="cx">             pw = 0.0f;
</span><span class="lines">@@ -955,7 +956,8 @@
</span><span class="cx">         /* Linear interpolation */
</span><span class="cx">         amp = ((1.0f - offset)*proakis[index].amp + offset*proakis[index + 1].amp)/2.3f;
</span><span class="cx">         delay = (1.0f - offset)*proakis[index].delay + offset*proakis[index + 1].delay;
</span><del>-        phase = 2.0f*M_PI*f*delay*0.001f;
</del><ins>+        //phase = 2.0f*M_PI*f*delay*0.001f;
+        phase = 0.0f;
</ins><span class="cx"> #if defined(HAVE_FFTW3_H)
</span><span class="cx">         in[i][0] = amp*cosf(phase);
</span><span class="cx">         in[i][1] = amp*sinf(phase);
</span><span class="lines">@@ -978,7 +980,7 @@
</span><span class="cx">     fprintf(outfile, &quot;/* Medium range telephone line response\n&quot;);
</span><span class="cx">     fprintf(outfile, &quot;   (from p 537, Digital Communication, John G. Proakis */\n&quot;);
</span><span class="cx"> 
</span><del>-    fprintf(outfile, &quot;float proakis_line_model[] =\n&quot;);
</del><ins>+    fprintf(outfile, &quot;const float proakis_line_model[] =\n&quot;);
</ins><span class="cx">     fprintf(outfile, &quot;{\n&quot;);
</span><span class="cx">     /* Normalise the filter's gain */
</span><span class="cx">     pw = 0.0f;
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspspandspsimspandspline_modelh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/spandsp-sim/spandsp/line_model.h (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/spandsp-sim/spandsp/line_model.h        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/spandsp-sim/spandsp/line_model.h        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: line_model.h,v 1.6 2009/05/31 14:47:10 steveu Exp $
</del><ins>+ * $Id: line_model.h,v 1.7 2009/09/23 16:02:59 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -132,6 +132,8 @@
</span><span class="cx"> {
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+SPAN_DECLARE_DATA extern const float *line_models[];
+
</ins><span class="cx"> SPAN_DECLARE(void) both_ways_line_model(both_ways_line_model_state_t *s, 
</span><span class="cx">                                         int16_t output1[],
</span><span class="cx">                                         const int16_t input1[],
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcMakefileam"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/Makefile.am (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/Makefile.am        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/Makefile.am        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -16,7 +16,7 @@
</span><span class="cx"> ## License along with this program; if not, write to the Free Software
</span><span class="cx"> ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx"> ##
</span><del>-## $Id: Makefile.am,v 1.135 2009/07/12 09:23:09 steveu Exp $
</del><ins>+## $Id: Makefile.am,v 1.137 2009/09/22 14:52:31 steveu Exp $
</ins><span class="cx"> 
</span><span class="cx"> AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
</span><span class="cx"> AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
</span><span class="lines">@@ -110,6 +110,7 @@
</span><span class="cx">                         silence_gen.c \
</span><span class="cx">                         super_tone_rx.c \
</span><span class="cx">                         super_tone_tx.c \
</span><ins>+                        swept_tone.c \
</ins><span class="cx">                         t4.c \
</span><span class="cx">                         t30.c \
</span><span class="cx">                         t30_api.c \
</span><span class="lines">@@ -188,6 +189,7 @@
</span><span class="cx">                          spandsp/silence_gen.h \
</span><span class="cx">                          spandsp/super_tone_rx.h \
</span><span class="cx">                          spandsp/super_tone_tx.h \
</span><ins>+                         spandsp/swept_tone.h \
</ins><span class="cx">                          spandsp/t4.h \
</span><span class="cx">                          spandsp/t30.h \
</span><span class="cx">                          spandsp/t30_api.h \
</span><span class="lines">@@ -226,6 +228,7 @@
</span><span class="cx">                          spandsp/private/bert.h \
</span><span class="cx">                          spandsp/private/bitstream.h \
</span><span class="cx">                          spandsp/private/dtmf.h \
</span><ins>+                         spandsp/private/echo.h \
</ins><span class="cx">                          spandsp/private/fax.h \
</span><span class="cx">                          spandsp/private/fax_modems.h \
</span><span class="cx">                          spandsp/private/fsk.h \
</span><span class="lines">@@ -238,6 +241,7 @@
</span><span class="cx">                          spandsp/private/logging.h \
</span><span class="cx">                          spandsp/private/lpc10.h \
</span><span class="cx">                          spandsp/private/modem_connect_tones.h \
</span><ins>+                         spandsp/private/modem_echo.h \
</ins><span class="cx">                          spandsp/private/noise.h \
</span><span class="cx">                          spandsp/private/oki_adpcm.h \
</span><span class="cx">                          spandsp/private/queue.h \
</span><span class="lines">@@ -246,6 +250,7 @@
</span><span class="cx">                          spandsp/private/silence_gen.h \
</span><span class="cx">                          spandsp/private/super_tone_rx.h \
</span><span class="cx">                          spandsp/private/super_tone_tx.h \
</span><ins>+                         spandsp/private/swept_tone.h \
</ins><span class="cx">                          spandsp/private/t30.h \
</span><span class="cx">                          spandsp/private/t31.h \
</span><span class="cx">                          spandsp/private/t38_core.h \
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcat_interpreterc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/at_interpreter.c (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/at_interpreter.c        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/at_interpreter.c        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: at_interpreter.c,v 1.40 2009/07/10 13:15:56 steveu Exp $
</del><ins>+ * $Id: at_interpreter.c,v 1.41 2009/10/03 04:37:25 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -80,7 +80,7 @@
</span><span class="cx"> static at_profile_t profiles[3] =
</span><span class="cx"> {
</span><span class="cx">     {
</span><del>-#if defined(_MSC_VER)  ||  defined(__sunos)  ||  defined(__solaris) || defined(__sun)
</del><ins>+#if defined(_MSC_VER)  ||  defined(__sunos)  ||  defined(__solaris)  ||  defined(__sun)
</ins><span class="cx">         /*.echo =*/ TRUE,
</span><span class="cx">         /*.verbose =*/ TRUE,
</span><span class="cx">         /*.result_code_format =*/ ASCII_RESULT_CODES,
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcechoc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/echo.c (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/echo.c        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/echo.c        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: echo.c,v 1.32 2009/02/10 13:06:46 steveu Exp $
</del><ins>+ * $Id: echo.c,v 1.33 2009/09/22 13:11:04 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -102,6 +102,8 @@
</span><span class="cx"> #include &quot;spandsp/bit_operations.h&quot;
</span><span class="cx"> #include &quot;spandsp/echo.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;spandsp/private/echo.h&quot;
+
</ins><span class="cx"> #if !defined(NULL)
</span><span class="cx"> #define NULL (void *) 0
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcfaxc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/fax.c (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/fax.c        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/fax.c        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: fax.c,v 1.93 2009/05/24 07:18:36 steveu Exp $
</del><ins>+ * $Id: fax.c,v 1.94 2009/09/04 14:38:46 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -128,9 +128,13 @@
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><del>-static void set_rx_handler(fax_state_t *s, span_rx_handler_t *handler, void *user_data)
</del><ins>+static void set_rx_handler(fax_state_t *s,
+                           span_rx_handler_t *rx_handler,
+                           span_rx_fillin_handler_t *fillin_handler,
+                           void *user_data)
</ins><span class="cx"> {
</span><del>-    s-&gt;modems.rx_handler = handler;
</del><ins>+    s-&gt;modems.rx_handler = rx_handler;
+    s-&gt;modems.rx_fillin_handler = fillin_handler;
</ins><span class="cx">     s-&gt;modems.rx_user_data = user_data;
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="lines">@@ -162,7 +166,7 @@
</span><span class="cx">         /* The fast modem has trained, so we no longer need to run the slow
</span><span class="cx">            one in parallel. */
</span><span class="cx">         span_log(&amp;t-&gt;logging, SPAN_LOG_FLOW, &quot;Switching from V.17 + V.21 to V.17 (%.2fdBm0)\n&quot;, v17_rx_signal_power(&amp;s-&gt;v17_rx));
</span><del>-        set_rx_handler(t, (span_rx_handler_t *) &amp;v17_rx, &amp;s-&gt;v17_rx);
</del><ins>+        set_rx_handler(t, (span_rx_handler_t *) &amp;v17_rx, (span_rx_fillin_handler_t *) &amp;v17_rx_fillin, &amp;s-&gt;v17_rx);
</ins><span class="cx">     }
</span><span class="cx">     else
</span><span class="cx">     {
</span><span class="lines">@@ -172,13 +176,26 @@
</span><span class="cx">             /* We have received something, and the fast modem has not trained. We must
</span><span class="cx">                be receiving valid V.21 */
</span><span class="cx">             span_log(&amp;t-&gt;logging, SPAN_LOG_FLOW, &quot;Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n&quot;, fsk_rx_signal_power(&amp;s-&gt;v21_rx));
</span><del>-            set_rx_handler(t, (span_rx_handler_t *) &amp;fsk_rx, &amp;s-&gt;v21_rx);
</del><ins>+            set_rx_handler(t, (span_rx_handler_t *) &amp;fsk_rx, (span_rx_fillin_handler_t *) &amp;fsk_rx_fillin, &amp;s-&gt;v21_rx);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><ins>+static int v17_v21_rx_fillin(void *user_data, int len)
+{
+    fax_state_t *t;
+    fax_modems_state_t *s;
+
+    t = (fax_state_t *) user_data;
+    s = &amp;t-&gt;modems;
+    v17_rx_fillin(&amp;s-&gt;v17_rx, len);
+    fsk_rx_fillin(&amp;s-&gt;v21_rx, len);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
</ins><span class="cx"> static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len)
</span><span class="cx"> {
</span><span class="cx">     fax_state_t *t;
</span><span class="lines">@@ -192,7 +209,7 @@
</span><span class="cx">         /* The fast modem has trained, so we no longer need to run the slow
</span><span class="cx">            one in parallel. */
</span><span class="cx">         span_log(&amp;t-&gt;logging, SPAN_LOG_FLOW, &quot;Switching from V.27ter + V.21 to V.27ter (%.2fdBm0)\n&quot;, v27ter_rx_signal_power(&amp;s-&gt;v27ter_rx));
</span><del>-        set_rx_handler(t, (span_rx_handler_t *) &amp;v27ter_rx, &amp;s-&gt;v27ter_rx);
</del><ins>+        set_rx_handler(t, (span_rx_handler_t *) &amp;v27ter_rx, (span_rx_fillin_handler_t *) &amp;v27ter_rx_fillin, &amp;s-&gt;v27ter_rx);
</ins><span class="cx">     }
</span><span class="cx">     else
</span><span class="cx">     {
</span><span class="lines">@@ -202,13 +219,26 @@
</span><span class="cx">             /* We have received something, and the fast modem has not trained. We must
</span><span class="cx">                be receiving valid V.21 */
</span><span class="cx">             span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n&quot;, fsk_rx_signal_power(&amp;s-&gt;v21_rx));
</span><del>-            set_rx_handler(t, (span_rx_handler_t *) &amp;fsk_rx, &amp;s-&gt;v21_rx);
</del><ins>+            set_rx_handler(t, (span_rx_handler_t *) &amp;fsk_rx, (span_rx_fillin_handler_t *) &amp;fsk_rx_fillin, &amp;s-&gt;v21_rx);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><ins>+static int v27ter_v21_rx_fillin(void *user_data, int len)
+{
+    fax_state_t *t;
+    fax_modems_state_t *s;
+
+    t = (fax_state_t *) user_data;
+    s = &amp;t-&gt;modems;
+    v27ter_rx_fillin(&amp;s-&gt;v27ter_rx, len);
+    fsk_rx_fillin(&amp;s-&gt;v21_rx, len);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
</ins><span class="cx"> static int v29_v21_rx(void *user_data, const int16_t amp[], int len)
</span><span class="cx"> {
</span><span class="cx">     fax_state_t *t;
</span><span class="lines">@@ -222,7 +252,7 @@
</span><span class="cx">         /* The fast modem has trained, so we no longer need to run the slow
</span><span class="cx">            one in parallel. */
</span><span class="cx">         span_log(&amp;t-&gt;logging, SPAN_LOG_FLOW, &quot;Switching from V.29 + V.21 to V.29 (%.2fdBm0)\n&quot;, v29_rx_signal_power(&amp;s-&gt;v29_rx));
</span><del>-        set_rx_handler(t, (span_rx_handler_t *) &amp;v29_rx, &amp;s-&gt;v29_rx);
</del><ins>+        set_rx_handler(t, (span_rx_handler_t *) &amp;v29_rx, (span_rx_fillin_handler_t *) &amp;v29_rx_fillin, &amp;s-&gt;v29_rx);
</ins><span class="cx">     }
</span><span class="cx">     else
</span><span class="cx">     {
</span><span class="lines">@@ -232,13 +262,26 @@
</span><span class="cx">             /* We have received something, and the fast modem has not trained. We must
</span><span class="cx">                be receiving valid V.21 */
</span><span class="cx">             span_log(&amp;t-&gt;logging, SPAN_LOG_FLOW, &quot;Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n&quot;, fsk_rx_signal_power(&amp;s-&gt;v21_rx));
</span><del>-            set_rx_handler(t, (span_rx_handler_t *) &amp;fsk_rx, &amp;s-&gt;v21_rx);
</del><ins>+            set_rx_handler(t, (span_rx_handler_t *) &amp;fsk_rx, (span_rx_fillin_handler_t *) &amp;fsk_rx_fillin, &amp;s-&gt;v21_rx);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><ins>+static int v29_v21_rx_fillin(void *user_data, int len)
+{
+    fax_state_t *t;
+    fax_modems_state_t *s;
+
+    t = (fax_state_t *) user_data;
+    s = &amp;t-&gt;modems;
+    v29_rx_fillin(&amp;s-&gt;v29_rx, len);
+    fsk_rx_fillin(&amp;s-&gt;v21_rx, len);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
</ins><span class="cx"> SPAN_DECLARE(int) fax_rx(fax_state_t *s, int16_t *amp, int len)
</span><span class="cx"> {
</span><span class="cx">     int i;
</span><span class="lines">@@ -276,26 +319,9 @@
</span><span class="cx">         write(s-&gt;modems.audio_rx_log, amp, len*sizeof(int16_t));
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><ins>+    /* Call the fillin function of the current modem (if there is one). */
+    s-&gt;modems.rx_fillin_handler(s-&gt;modems.rx_user_data, len);
</ins><span class="cx">     t30_timer_update(&amp;s-&gt;t30, len);
</span><del>-    /* Call the fillin function of the current modem (if there is one). */
-    switch (s-&gt;modems.current_rx_type)
-    {
-    case T30_MODEM_V21:
-        len = fsk_rx_fillin(&amp;s-&gt;modems.v21_rx, len);
-        break;
-    case T30_MODEM_V27TER:
-        /* TODO: what about FSK in the early stages */
-        len = v27ter_rx_fillin(&amp;s-&gt;modems.v27ter_rx, len);
-        break;
-    case T30_MODEM_V29:
-        /* TODO: what about FSK in the early stages */
-        len = v29_rx_fillin(&amp;s-&gt;modems.v29_rx, len);
-        break;
-    case T30_MODEM_V17:
-        /* TODO: what about FSK in the early stages */
-        len = v17_rx_fillin(&amp;s-&gt;modems.v17_rx, len);
-        break;
-    }
</del><span class="cx">     return len;
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="lines">@@ -399,27 +425,27 @@
</span><span class="cx">     case T30_MODEM_V21:
</span><span class="cx">         fsk_rx_init(&amp;t-&gt;v21_rx, &amp;preset_fsk_specs[FSK_V21CH2], TRUE, (put_bit_func_t) hdlc_rx_put_bit, put_bit_user_data);
</span><span class="cx">         fsk_rx_signal_cutoff(&amp;t-&gt;v21_rx, -45.5f);
</span><del>-        set_rx_handler(s, (span_rx_handler_t *) &amp;fsk_rx, &amp;t-&gt;v21_rx);
</del><ins>+        set_rx_handler(s, (span_rx_handler_t *) &amp;fsk_rx, (span_rx_fillin_handler_t *) &amp;fsk_rx_fillin, &amp;t-&gt;v21_rx);
</ins><span class="cx">         break;
</span><span class="cx">     case T30_MODEM_V27TER:
</span><span class="cx">         v27ter_rx_restart(&amp;t-&gt;v27ter_rx, bit_rate, FALSE);
</span><span class="cx">         v27ter_rx_set_put_bit(&amp;t-&gt;v27ter_rx, put_bit_func, put_bit_user_data);
</span><del>-        set_rx_handler(s, &amp;v27ter_v21_rx, s);
</del><ins>+        set_rx_handler(s, &amp;v27ter_v21_rx, &amp;v27ter_v21_rx_fillin, s);
</ins><span class="cx">         break;
</span><span class="cx">     case T30_MODEM_V29:
</span><span class="cx">         v29_rx_restart(&amp;t-&gt;v29_rx, bit_rate, FALSE);
</span><span class="cx">         v29_rx_set_put_bit(&amp;t-&gt;v29_rx, put_bit_func, put_bit_user_data);
</span><del>-        set_rx_handler(s, &amp;v29_v21_rx, s);
</del><ins>+        set_rx_handler(s, &amp;v29_v21_rx, &amp;v29_v21_rx_fillin, s);
</ins><span class="cx">         break;
</span><span class="cx">     case T30_MODEM_V17:
</span><span class="cx">         v17_rx_restart(&amp;t-&gt;v17_rx, bit_rate, short_train);
</span><span class="cx">         v17_rx_set_put_bit(&amp;t-&gt;v17_rx, put_bit_func, put_bit_user_data);
</span><del>-        set_rx_handler(s, &amp;v17_v21_rx, s);
</del><ins>+        set_rx_handler(s, &amp;v17_v21_rx, &amp;v17_v21_rx_fillin, s);
</ins><span class="cx">         break;
</span><span class="cx">     case T30_MODEM_DONE:
</span><span class="cx">         span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;FAX exchange complete\n&quot;);
</span><span class="cx">     default:
</span><del>-        set_rx_handler(s, (span_rx_handler_t *) &amp;span_dummy_rx, s);
</del><ins>+        set_rx_handler(s, (span_rx_handler_t *) &amp;span_dummy_rx, (span_rx_fillin_handler_t *) &amp;span_dummy_rx_fillin, s);
</ins><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcfax_modemsc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/fax_modems.c (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/fax_modems.c        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/fax_modems.c        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: fax_modems.c,v 1.5 2009/04/12 03:29:58 steveu Exp $
</del><ins>+ * $Id: fax_modems.c,v 1.6 2009/09/04 14:38:46 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -101,6 +101,7 @@
</span><span class="cx">            be receiving valid V.21 */
</span><span class="cx">         span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n&quot;, fsk_rx_signal_power(&amp;s-&gt;v21_rx));
</span><span class="cx">         s-&gt;rx_handler = (span_rx_handler_t *) &amp;fsk_rx;
</span><ins>+        s-&gt;rx_fillin_handler = (span_rx_fillin_handler_t *) &amp;fsk_rx_fillin;
</ins><span class="cx">         s-&gt;rx_user_data = &amp;s-&gt;v21_rx;
</span><span class="cx">     }
</span><span class="cx">     return 0;
</span><span class="lines">@@ -131,6 +132,7 @@
</span><span class="cx">            be receiving valid V.21 */
</span><span class="cx">         span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n&quot;, fsk_rx_signal_power(&amp;s-&gt;v21_rx));
</span><span class="cx">         s-&gt;rx_handler = (span_rx_handler_t *) &amp;fsk_rx;
</span><ins>+        s-&gt;rx_fillin_handler = (span_rx_fillin_handler_t *) &amp;fsk_rx_fillin;
</ins><span class="cx">         s-&gt;rx_user_data = &amp;s-&gt;v21_rx;
</span><span class="cx">     }
</span><span class="cx">     return 0;
</span><span class="lines">@@ -161,6 +163,7 @@
</span><span class="cx">            be receiving valid V.21 */
</span><span class="cx">         span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n&quot;, fsk_rx_signal_power(&amp;s-&gt;v21_rx));
</span><span class="cx">         s-&gt;rx_handler = (span_rx_handler_t *) &amp;fsk_rx;
</span><ins>+        s-&gt;rx_fillin_handler = (span_rx_fillin_handler_t *) &amp;fsk_rx_fillin;
</ins><span class="cx">         s-&gt;rx_user_data = &amp;s-&gt;v21_rx;
</span><span class="cx">     }
</span><span class="cx">     return 0;
</span><span class="lines">@@ -196,6 +199,7 @@
</span><span class="cx">     case SIG_STATUS_TRAINING_SUCCEEDED:
</span><span class="cx">         span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;Switching to V.17 (%.2fdBm0)\n&quot;, v17_rx_signal_power(&amp;s-&gt;v17_rx));
</span><span class="cx">         s-&gt;rx_handler = (span_rx_handler_t *) &amp;v17_rx;
</span><ins>+        s-&gt;rx_fillin_handler = (span_rx_fillin_handler_t *) &amp;v17_rx_fillin;
</ins><span class="cx">         s-&gt;rx_user_data = &amp;s-&gt;v17_rx;
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="lines">@@ -212,6 +216,7 @@
</span><span class="cx">     case SIG_STATUS_TRAINING_SUCCEEDED:
</span><span class="cx">         span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;Switching to V.27ter (%.2fdBm0)\n&quot;, v27ter_rx_signal_power(&amp;s-&gt;v27ter_rx));
</span><span class="cx">         s-&gt;rx_handler = (span_rx_handler_t *) &amp;v27ter_rx;
</span><ins>+        s-&gt;rx_fillin_handler = (span_rx_fillin_handler_t *) &amp;v27ter_rx_fillin;
</ins><span class="cx">         s-&gt;rx_user_data = &amp;s-&gt;v27ter_rx;
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="lines">@@ -228,6 +233,7 @@
</span><span class="cx">     case SIG_STATUS_TRAINING_SUCCEEDED:
</span><span class="cx">         span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;Switching to V.29 (%.2fdBm0)\n&quot;, v29_rx_signal_power(&amp;s-&gt;v29_rx));
</span><span class="cx">         s-&gt;rx_handler = (span_rx_handler_t *) &amp;v29_rx;
</span><ins>+        s-&gt;rx_fillin_handler = (span_rx_fillin_handler_t *) &amp;v29_rx_fillin;
</ins><span class="cx">         s-&gt;rx_user_data = &amp;s-&gt;v29_rx;
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="lines">@@ -300,6 +306,7 @@
</span><span class="cx"> 
</span><span class="cx">     s-&gt;rx_signal_present = FALSE;
</span><span class="cx">     s-&gt;rx_handler = (span_rx_handler_t *) &amp;span_dummy_rx;
</span><ins>+    s-&gt;rx_fillin_handler = (span_rx_fillin_handler_t *) &amp;span_dummy_rx;
</ins><span class="cx">     s-&gt;rx_user_data = NULL;
</span><span class="cx">     s-&gt;tx_handler = (span_tx_handler_t *) &amp;silence_gen;
</span><span class="cx">     s-&gt;tx_user_data = &amp;s-&gt;silence_gen;
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrclibspandsp2005vcproj"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/libspandsp.2005.vcproj (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/libspandsp.2005.vcproj        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/libspandsp.2005.vcproj        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -142,6 +142,7 @@
</span><span class="cx"> &lt;File RelativePath=&quot;silence_gen.c&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;super_tone_rx.c&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;super_tone_tx.c&quot;&gt;&lt;/File&gt;
</span><ins>+&lt;File RelativePath=&quot;swept_tone.c&quot;&gt;&lt;/File&gt;
</ins><span class="cx"> &lt;File RelativePath=&quot;t4.c&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;t30.c&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;t30_api.c&quot;&gt;&lt;/File&gt;
</span><span class="lines">@@ -219,6 +220,7 @@
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/silence_gen.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/super_tone_rx.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/super_tone_tx.h&quot;&gt;&lt;/File&gt;
</span><ins>+&lt;File RelativePath=&quot;spandsp/swept_tone.h&quot;&gt;&lt;/File&gt;
</ins><span class="cx"> &lt;File RelativePath=&quot;spandsp/t4.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/t30.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/t30_api.h&quot;&gt;&lt;/File&gt;
</span><span class="lines">@@ -257,6 +259,7 @@
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/bert.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/bitstream.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/dtmf.h&quot;&gt;&lt;/File&gt;
</span><ins>+&lt;File RelativePath=&quot;spandsp/private/echo.h&quot;&gt;&lt;/File&gt;
</ins><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/fax.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/fax_modems.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/fsk.h&quot;&gt;&lt;/File&gt;
</span><span class="lines">@@ -269,6 +272,7 @@
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/logging.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/lpc10.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/modem_connect_tones.h&quot;&gt;&lt;/File&gt;
</span><ins>+&lt;File RelativePath=&quot;spandsp/private/modem_echo.h&quot;&gt;&lt;/File&gt;
</ins><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/noise.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/oki_adpcm.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/queue.h&quot;&gt;&lt;/File&gt;
</span><span class="lines">@@ -277,6 +281,7 @@
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/silence_gen.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/super_tone_rx.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/super_tone_tx.h&quot;&gt;&lt;/File&gt;
</span><ins>+&lt;File RelativePath=&quot;spandsp/private/swept_tone.h&quot;&gt;&lt;/File&gt;
</ins><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/t30.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/t31.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/t38_core.h&quot;&gt;&lt;/File&gt;
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrclibspandsp2008vcproj"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/libspandsp.2008.vcproj (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/libspandsp.2008.vcproj        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/libspandsp.2008.vcproj        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -212,6 +212,7 @@
</span><span class="cx"> &lt;File RelativePath=&quot;silence_gen.c&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;super_tone_rx.c&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;super_tone_tx.c&quot;&gt;&lt;/File&gt;
</span><ins>+&lt;File RelativePath=&quot;swept_tone.c&quot;&gt;&lt;/File&gt;
</ins><span class="cx"> &lt;File RelativePath=&quot;t4.c&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;t30.c&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;t30_api.c&quot;&gt;&lt;/File&gt;
</span><span class="lines">@@ -289,6 +290,7 @@
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/silence_gen.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/super_tone_rx.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/super_tone_tx.h&quot;&gt;&lt;/File&gt;
</span><ins>+&lt;File RelativePath=&quot;spandsp/swept_tone.h&quot;&gt;&lt;/File&gt;
</ins><span class="cx"> &lt;File RelativePath=&quot;spandsp/t4.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/t30.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/t30_api.h&quot;&gt;&lt;/File&gt;
</span><span class="lines">@@ -327,6 +329,7 @@
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/bert.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/bitstream.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/dtmf.h&quot;&gt;&lt;/File&gt;
</span><ins>+&lt;File RelativePath=&quot;spandsp/private/echo.h&quot;&gt;&lt;/File&gt;
</ins><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/fax.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/fax_modems.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/fsk.h&quot;&gt;&lt;/File&gt;
</span><span class="lines">@@ -339,6 +342,7 @@
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/logging.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/lpc10.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/modem_connect_tones.h&quot;&gt;&lt;/File&gt;
</span><ins>+&lt;File RelativePath=&quot;spandsp/private/modem_echo.h&quot;&gt;&lt;/File&gt;
</ins><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/noise.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/oki_adpcm.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/queue.h&quot;&gt;&lt;/File&gt;
</span><span class="lines">@@ -347,6 +351,7 @@
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/silence_gen.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/super_tone_rx.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/super_tone_tx.h&quot;&gt;&lt;/File&gt;
</span><ins>+&lt;File RelativePath=&quot;spandsp/private/swept_tone.h&quot;&gt;&lt;/File&gt;
</ins><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/t30.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/t31.h&quot;&gt;&lt;/File&gt;
</span><span class="cx"> &lt;File RelativePath=&quot;spandsp/private/t38_core.h&quot;&gt;&lt;/File&gt;
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrclibspandspdsp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/libspandsp.dsp (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/libspandsp.dsp        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/libspandsp.dsp        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -293,6 +293,10 @@
</span><span class="cx"> # End Source File
</span><span class="cx"> # Begin Source File
</span><span class="cx"> 
</span><ins>+SOURCE=.\swept_tone.c
+# End Source File
+# Begin Source File
+
</ins><span class="cx"> SOURCE=.\t4.c
</span><span class="cx"> # End Source File
</span><span class="cx"> # Begin Source File
</span><span class="lines">@@ -599,6 +603,10 @@
</span><span class="cx"> # End Source File
</span><span class="cx"> # Begin Source File
</span><span class="cx"> 
</span><ins>+SOURCE=.\spandsp/swept_tone.h
+# End Source File
+# Begin Source File
+
</ins><span class="cx"> SOURCE=.\spandsp/t4.h
</span><span class="cx"> # End Source File
</span><span class="cx"> # Begin Source File
</span><span class="lines">@@ -751,6 +759,10 @@
</span><span class="cx"> # End Source File
</span><span class="cx"> # Begin Source File
</span><span class="cx"> 
</span><ins>+SOURCE=.\spandsp/private/echo.h
+# End Source File
+# Begin Source File
+
</ins><span class="cx"> SOURCE=.\spandsp/private/fax.h
</span><span class="cx"> # End Source File
</span><span class="cx"> # Begin Source File
</span><span class="lines">@@ -799,6 +811,10 @@
</span><span class="cx"> # End Source File
</span><span class="cx"> # Begin Source File
</span><span class="cx"> 
</span><ins>+SOURCE=.\spandsp/private/modem_echo.h
+# End Source File
+# Begin Source File
+
</ins><span class="cx"> SOURCE=.\spandsp/private/noise.h
</span><span class="cx"> # End Source File
</span><span class="cx"> # Begin Source File
</span><span class="lines">@@ -831,6 +847,10 @@
</span><span class="cx"> # End Source File
</span><span class="cx"> # Begin Source File
</span><span class="cx"> 
</span><ins>+SOURCE=.\spandsp/private/swept_tone.h
+# End Source File
+# Begin Source File
+
</ins><span class="cx"> SOURCE=.\spandsp/private/t30.h
</span><span class="cx"> # End Source File
</span><span class="cx"> # Begin Source File
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcmake_modem_filterc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/make_modem_filter.c (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/make_modem_filter.c        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/make_modem_filter.c        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx">  * along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: make_modem_filter.c,v 1.16 2009/07/10 13:15:56 steveu Exp $
</del><ins>+ * $Id: make_modem_filter.c,v 1.17 2009/10/03 04:37:25 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #if defined(HAVE_CONFIG_H)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> #include &lt;stdio.h&gt;
</span><span class="cx"> #include &lt;time.h&gt;
</span><span class="cx"> #include &lt;fcntl.h&gt;
</span><del>-#if defined(__sunos)  ||  defined(__solaris) || defined(__sun)
</del><ins>+#if defined(__sunos)  ||  defined(__solaris)  ||  defined(__sun)
</ins><span class="cx"> #include &lt;getopt.h&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcmodem_echoc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/modem_echo.c (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/modem_echo.c        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/modem_echo.c        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: modem_echo.c,v 1.25 2009/02/03 16:28:39 steveu Exp $
</del><ins>+ * $Id: modem_echo.c,v 1.26 2009/09/22 13:11:04 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -53,6 +53,8 @@
</span><span class="cx"> #include &quot;spandsp/dc_restore.h&quot;
</span><span class="cx"> #include &quot;spandsp/modem_echo.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;spandsp/private/modem_echo.h&quot;
+
</ins><span class="cx"> SPAN_DECLARE(modem_echo_can_state_t *) modem_echo_can_create(int len)
</span><span class="cx"> {
</span><span class="cx">     modem_echo_can_state_t *ec;
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcmsvcspandsph"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/msvc/spandsp.h (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/msvc/spandsp.h        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/msvc/spandsp.h        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: spandsp.h.in,v 1.18 2009/04/02 13:43:49 steveu Exp $
</del><ins>+ * $Id: spandsp.h.in,v 1.19 2009/09/22 13:11:04 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -69,6 +69,7 @@
</span><span class="cx"> #include &lt;spandsp/complex_filters.h&gt;
</span><span class="cx"> #include &lt;spandsp/dc_restore.h&gt;
</span><span class="cx"> #include &lt;spandsp/dds.h&gt;
</span><ins>+#include &lt;spandsp/swept_tone.h&gt;
</ins><span class="cx"> #include &lt;spandsp/echo.h&gt;
</span><span class="cx"> #include &lt;spandsp/modem_echo.h&gt;
</span><span class="cx"> #include &lt;spandsp/crc.h&gt;
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcsig_tonec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/sig_tone.c (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/sig_tone.c        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/sig_tone.c        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: sig_tone.c,v 1.32 2009/04/12 14:18:02 steveu Exp $
</del><ins>+ * $Id: sig_tone.c,v 1.33 2009/09/04 14:38:46 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -44,14 +44,17 @@
</span><span class="cx"> #include &quot;floating_fudge.h&quot;
</span><span class="cx"> #include &lt;memory.h&gt;
</span><span class="cx"> #include &lt;string.h&gt;
</span><ins>+#include &lt;limits.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #undef SPANDSP_USE_FIXED_POINT
</span><span class="cx"> #include &quot;spandsp/telephony.h&quot;
</span><span class="cx"> #include &quot;spandsp/fast_convert.h&quot;
</span><span class="cx"> #include &quot;spandsp/dc_restore.h&quot;
</span><span class="cx"> #include &quot;spandsp/saturated.h&quot;
</span><ins>+#include &quot;spandsp/vector_int.h&quot;
</ins><span class="cx"> #include &quot;spandsp/complex.h&quot;
</span><span class="cx"> #include &quot;spandsp/dds.h&quot;
</span><ins>+#include &quot;spandsp/super_tone_rx.h&quot;
</ins><span class="cx"> #include &quot;spandsp/sig_tone.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;spandsp/private/sig_tone.h&quot;
</span><span class="lines">@@ -67,12 +70,12 @@
</span><span class="cx">     {
</span><span class="cx">         /* 2280Hz (e.g. AC15, and many other European protocols) */
</span><span class="cx">         {2280,  0},
</span><del>-        {-10, -20},                 /* -10+-1 dBmO and -20+-1 dBm0 */
-        400*(SAMPLE_RATE/1000),     /* 300ms to 550ms */
</del><ins>+        {{-10, -20}, {0, 0}},       /* -10+-1 dBmO and -20+-1 dBm0 */
+        ms_to_samples(400),         /* 300ms to 550ms */
</ins><span class="cx">     
</span><del>-        225*(SAMPLE_RATE/1000),
</del><ins>+        ms_to_samples(225),
</ins><span class="cx">     
</span><del>-        225*(SAMPLE_RATE/1000),
</del><ins>+        ms_to_samples(225),
</ins><span class="cx">         TRUE,
</span><span class="cx">     
</span><span class="cx">         24,
</span><span class="lines">@@ -135,12 +138,12 @@
</span><span class="cx">     {
</span><span class="cx">         /* 2600Hz (e.g. many US protocols) */
</span><span class="cx">         {2600, 0},
</span><del>-        {-8, -8},
-        400*(SAMPLE_RATE/1000),
</del><ins>+        {{-8, -8}, {0, 0}},
+        ms_to_samples(400),
</ins><span class="cx">     
</span><del>-        225*(SAMPLE_RATE/1000),
</del><ins>+        ms_to_samples(225),
</ins><span class="cx">     
</span><del>-        225*(SAMPLE_RATE/1000),
</del><ins>+        ms_to_samples(225),
</ins><span class="cx">         FALSE,
</span><span class="cx">     
</span><span class="cx">         24,
</span><span class="lines">@@ -202,13 +205,13 @@
</span><span class="cx">     },
</span><span class="cx">     {
</span><span class="cx">         /* 2400Hz/2600Hz (e.g. SS5 and SS5bis) */
</span><del>-        {2400, 2600},
-        {-8, -8},
-        400*(SAMPLE_RATE/1000),
</del><ins>+        {2600, 2400},
+        {{-8, -8}, {-8, -8}},
+        ms_to_samples(400),
</ins><span class="cx"> 
</span><del>-        225*(SAMPLE_RATE/1000),
</del><ins>+        ms_to_samples(225),
</ins><span class="cx"> 
</span><del>-        225*(SAMPLE_RATE/1000),
</del><ins>+        ms_to_samples(225),
</ins><span class="cx">         FALSE,
</span><span class="cx"> 
</span><span class="cx">         24,
</span><span class="lines">@@ -276,19 +279,40 @@
</span><span class="cx">     int j;
</span><span class="cx">     int n;
</span><span class="cx">     int16_t tone;
</span><del>-    int update;
</del><ins>+    int need_update;
</ins><span class="cx">     int high_low;
</span><span class="cx"> 
</span><span class="cx">     for (i = 0;  i &lt; len;  i += n)
</span><span class="cx">     {
</span><del>-        if (s-&gt;current_tx_timeout &lt; len - i)
-            n = s-&gt;current_tx_timeout;
</del><ins>+        if (s-&gt;current_tx_timeout)
+        {
+            if (s-&gt;current_tx_timeout &lt;= len - i)
+            {
+                n = s-&gt;current_tx_timeout;
+                need_update = TRUE;
+            }
+            else
+            {
+                n = len - i;
+                need_update = FALSE;
+            }
+            s-&gt;current_tx_timeout -= n;
+        }
</ins><span class="cx">         else
</span><ins>+        {
</ins><span class="cx">             n = len - i;
</span><ins>+            need_update = FALSE;
+        }
+        if (!(s-&gt;current_tx_tone &amp; SIG_TONE_TX_PASSTHROUGH))
+            vec_zeroi16(&amp;amp[i], n);
+        /*endif*/
</ins><span class="cx">         if ((s-&gt;current_tx_tone &amp; (SIG_TONE_1_PRESENT  ||  SIG_TONE_2_PRESENT)))
</span><span class="cx">         {
</span><span class="cx">             /* Are we in the early phase (high tone energy level), or the sustaining
</span><span class="cx">                phase (low tone energy level) of tone generation? */
</span><ins>+            /* This doesn't try to get the high/low timing precise, as there is no
+               value in doing so. It works block by block, and the blocks are normally
+               quite short. */
</ins><span class="cx">             if (s-&gt;high_low_timer &gt; 0)
</span><span class="cx">             {
</span><span class="cx">                 if (n &gt; s-&gt;high_low_timer)
</span><span class="lines">@@ -301,47 +325,30 @@
</span><span class="cx">                 high_low = 1;
</span><span class="cx">             }
</span><span class="cx">             /*endif*/
</span><del>-            if (s-&gt;current_tx_tone &amp; SIG_TONE_TX_PASSTHROUGH)
</del><ins>+            if ((s-&gt;current_tx_tone &amp; SIG_TONE_1_PRESENT)  &amp;&amp;  s-&gt;phase_rate[0])
</ins><span class="cx">             {
</span><span class="cx">                 for (j = i;  j &lt; i + n;  j++)
</span><span class="cx">                 {
</span><del>-                    tone = dds_mod(&amp;(s-&gt;phase_acc[0]), s-&gt;phase_rate[0], s-&gt;tone_scaling[high_low], 0);
</del><ins>+                    tone = dds_mod(&amp;(s-&gt;phase_acc[0]), s-&gt;phase_rate[0], s-&gt;tone_scaling[0][high_low], 0);
</ins><span class="cx">                     amp[j] = saturate(amp[j] + tone);
</span><span class="cx">                 }
</span><span class="cx">                 /*endfor*/
</span><span class="cx">             }
</span><del>-            else
</del><ins>+            /*endif*/
+            if ((s-&gt;current_tx_tone &amp; SIG_TONE_2_PRESENT)  &amp;&amp;  s-&gt;phase_rate[1])
</ins><span class="cx">             {
</span><span class="cx">                 for (j = i;  j &lt; i + n;  j++)
</span><del>-                    amp[j] = dds_mod(&amp;(s-&gt;phase_acc[0]), s-&gt;phase_rate[0], s-&gt;tone_scaling[high_low], 0);
</del><ins>+                {
+                    tone = dds_mod(&amp;(s-&gt;phase_acc[1]), s-&gt;phase_rate[1], s-&gt;tone_scaling[1][high_low], 0);
+                    amp[j] = saturate(amp[j] + tone);
+                }
</ins><span class="cx">                 /*endfor*/
</span><span class="cx">             }
</span><span class="cx">             /*endif*/
</span><span class="cx">         }
</span><del>-        else
-        {
-            /* There is no tone. We either leave the audio in the buffer, or silence it. */
-            if (!(s-&gt;current_tx_tone &amp; SIG_TONE_TX_PASSTHROUGH))
-            {
-                /* Zap any audio in the buffer */
-                memset(amp + i, 0, sizeof(int16_t)*n);
-            }
-            /*endif*/
-        }
</del><span class="cx">         /*endif*/
</span><del>-        if ((s-&gt;current_tx_timeout -= n) &lt;= 0)
-        {
-            if (s-&gt;sig_update)
-            {
-                update = s-&gt;sig_update(s-&gt;user_data, SIG_TONE_UPDATE_REQUEST);
-                if ((update &amp; 0x03) == 0x03)
-                    s-&gt;high_low_timer = s-&gt;desc-&gt;high_low_timeout;
-                /*endif*/
-                s-&gt;current_tx_tone = update &amp; 0xFFFF;
-                s-&gt;current_tx_timeout = (update &gt;&gt; 16) &amp; 0xFFFF;
-            }
-            /*endif*/
-        }
</del><ins>+        if (need_update  &amp;&amp;  s-&gt;sig_update)
+            s-&gt;sig_update(s-&gt;user_data, SIG_TONE_TX_UPDATE_REQUEST, 0, 0);
</ins><span class="cx">         /*endif*/
</span><span class="cx">     }
</span><span class="cx">     /*endfor*/
</span><span class="lines">@@ -349,17 +356,22 @@
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><del>-SPAN_DECLARE(void) sig_tone_tx_set_mode(sig_tone_tx_state_t *s, int mode)
</del><ins>+SPAN_DECLARE(void) sig_tone_tx_set_mode(sig_tone_tx_state_t *s, int mode, int duration)
</ins><span class="cx"> {
</span><del>-    if ((mode &amp; 0x03) == 0x03  &amp;&amp;  !(s-&gt;current_tx_tone &amp; SIG_TONE_1_PRESENT))
</del><ins>+    int old_tones;
+    int new_tones;
+    
+    old_tones = s-&gt;current_tx_tone &amp; (SIG_TONE_1_PRESENT | SIG_TONE_2_PRESENT);
+    new_tones = mode &amp; (SIG_TONE_1_PRESENT | SIG_TONE_2_PRESENT);
+    if (new_tones  &amp;&amp;  old_tones != new_tones)
</ins><span class="cx">         s-&gt;high_low_timer = s-&gt;desc-&gt;high_low_timeout;
</span><span class="cx">     /*endif*/
</span><del>-    s-&gt;current_tx_tone = mode &amp; 0xFFFF;
-    s-&gt;current_tx_timeout = (mode &gt;&gt; 16) &amp; 0xFFFF;
</del><ins>+    s-&gt;current_tx_tone = mode;
+    s-&gt;current_tx_timeout = duration;
</ins><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><del>-SPAN_DECLARE(sig_tone_tx_state_t *) sig_tone_tx_init(sig_tone_tx_state_t *s, int tone_type, sig_tone_func_t sig_update, void *user_data)
</del><ins>+SPAN_DECLARE(sig_tone_tx_state_t *) sig_tone_tx_init(sig_tone_tx_state_t *s, int tone_type, tone_report_func_t sig_update, void *user_data)
</ins><span class="cx"> {
</span><span class="cx">     int i;
</span><span class="cx"> 
</span><span class="lines">@@ -385,7 +397,8 @@
</span><span class="cx">             s-&gt;phase_rate[i] = dds_phase_rate((float) s-&gt;desc-&gt;tone_freq[i]);
</span><span class="cx">         else
</span><span class="cx">             s-&gt;phase_rate[i] = 0;
</span><del>-        s-&gt;tone_scaling[i] = dds_scaling_dbm0((float) s-&gt;desc-&gt;tone_amp[i]);
</del><ins>+        s-&gt;tone_scaling[i][0] = dds_scaling_dbm0((float) s-&gt;desc-&gt;tone_amp[i][0]);
+        s-&gt;tone_scaling[i][1] = dds_scaling_dbm0((float) s-&gt;desc-&gt;tone_amp[i][1]);
</ins><span class="cx">     }
</span><span class="cx">     return s;
</span><span class="cx"> }
</span><span class="lines">@@ -404,6 +417,7 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><ins>+
</ins><span class="cx"> SPAN_DECLARE(int) sig_tone_rx(sig_tone_rx_state_t *s, int16_t amp[], int len)
</span><span class="cx"> {
</span><span class="cx"> #if defined(SPANDSP_USE_FIXED_POINT)
</span><span class="lines">@@ -422,7 +436,7 @@
</span><span class="cx"> 
</span><span class="cx">     for (i = 0;  i &lt; len;  i++)
</span><span class="cx">     {
</span><del>-        if (s-&gt;signaling_state_duration &lt; 0xFFFF)
</del><ins>+        if (s-&gt;signaling_state_duration &lt; INT_MAX)
</ins><span class="cx">             s-&gt;signaling_state_duration++;
</span><span class="cx">         /*endif*/
</span><span class="cx">         notched_signal = 0;
</span><span class="lines">@@ -529,7 +543,7 @@
</span><span class="cx">                 if (!s-&gt;tone_present)
</span><span class="cx">                 {
</span><span class="cx">                     if (s-&gt;sig_update)
</span><del>-                        s-&gt;sig_update(s-&gt;user_data, SIG_TONE_1_CHANGE | (s-&gt;signaling_state_duration &lt;&lt; 16));
</del><ins>+                        s-&gt;sig_update(s-&gt;user_data, SIG_TONE_1_CHANGE, 0, s-&gt;signaling_state_duration);
</ins><span class="cx">                     /*endif*/
</span><span class="cx">                     s-&gt;signaling_state_duration = 0;
</span><span class="cx">                 }
</span><span class="lines">@@ -541,15 +555,15 @@
</span><span class="cx">                 if (s-&gt;tone_present)
</span><span class="cx">                 {
</span><span class="cx">                     if (s-&gt;sig_update)
</span><del>-                        s-&gt;sig_update(s-&gt;user_data, SIG_TONE_1_CHANGE | SIG_TONE_1_PRESENT | (s-&gt;signaling_state_duration &lt;&lt; 16));
</del><ins>+                        s-&gt;sig_update(s-&gt;user_data, SIG_TONE_1_CHANGE | SIG_TONE_1_PRESENT, 0, s-&gt;signaling_state_duration);
</ins><span class="cx">                     /*endif*/
</span><span class="cx">                     s-&gt;signaling_state_duration = 0;
</span><span class="cx">                 }
</span><span class="cx">                 /*endif*/
</span><span class="cx">             }
</span><span class="cx">             /*endif*/
</span><del>-            /* Notch insertion logic */
-    
</del><ins>+
+            /* Notch insertion logic */    
</ins><span class="cx">             /* tone_present and tone_on are equivalent in flat mode */
</span><span class="cx">             if (s-&gt;tone_present)
</span><span class="cx">             {
</span><span class="lines">@@ -590,7 +604,7 @@
</span><span class="cx">                         s-&gt;tone_persistence_timeout = s-&gt;desc-&gt;tone_off_check_time;
</span><span class="cx">                         s-&gt;notch_insertion_timeout = s-&gt;desc-&gt;notch_lag_time;
</span><span class="cx">                         if (s-&gt;sig_update)
</span><del>-                            s-&gt;sig_update(s-&gt;user_data, SIG_TONE_1_CHANGE | SIG_TONE_1_PRESENT | (s-&gt;signaling_state_duration &lt;&lt; 16));
</del><ins>+                            s-&gt;sig_update(s-&gt;user_data, SIG_TONE_1_CHANGE | SIG_TONE_1_PRESENT, 0, s-&gt;signaling_state_duration);
</ins><span class="cx">                         /*endif*/
</span><span class="cx">                         s-&gt;signaling_state_duration = 0;
</span><span class="cx">                     }
</span><span class="lines">@@ -626,7 +640,7 @@
</span><span class="cx">                         s-&gt;tone_present = FALSE;
</span><span class="cx">                         s-&gt;tone_persistence_timeout = s-&gt;desc-&gt;tone_on_check_time;
</span><span class="cx">                         if (s-&gt;sig_update)
</span><del>-                            s-&gt;sig_update(s-&gt;user_data, SIG_TONE_1_CHANGE | (s-&gt;signaling_state_duration &lt;&lt; 16));
</del><ins>+                            s-&gt;sig_update(s-&gt;user_data, SIG_TONE_1_CHANGE, 0, s-&gt;signaling_state_duration);
</ins><span class="cx">                         /*endif*/
</span><span class="cx">                         s-&gt;signaling_state_duration = 0;
</span><span class="cx">                     }
</span><span class="lines">@@ -648,7 +662,7 @@
</span><span class="cx"> 
</span><span class="cx">         if ((s-&gt;current_rx_tone &amp; SIG_TONE_RX_PASSTHROUGH))
</span><span class="cx">         {
</span><del>-            if (s-&gt;notch_enabled)
</del><ins>+            if ((s-&gt;current_rx_tone &amp; SIG_TONE_RX_FILTER_TONE)  ||  s-&gt;notch_enabled)
</ins><span class="cx">                 amp[i] = (int16_t) notched_signal;
</span><span class="cx">             /*endif*/
</span><span class="cx">         }
</span><span class="lines">@@ -663,8 +677,14 @@
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><del>-SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int tone_type, sig_tone_func_t sig_update, void *user_data)
</del><ins>+SPAN_DECLARE(void) sig_tone_rx_set_mode(sig_tone_rx_state_t *s, int mode, int duration)
</ins><span class="cx"> {
</span><ins>+    s-&gt;current_rx_tone = mode;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int tone_type, tone_report_func_t sig_update, void *user_data)
+{
</ins><span class="cx">     if (sig_update == NULL  ||  tone_type &lt; 1  ||  tone_type &gt; 3)
</span><span class="cx">         return NULL;
</span><span class="cx">     /*endif*/
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcsilence_genc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/silence_gen.c (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/silence_gen.c        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/silence_gen.c        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: silence_gen.c,v 1.22 2009/06/02 16:03:56 steveu Exp $
</del><ins>+ * $Id: silence_gen.c,v 1.23 2009/09/04 14:38:46 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -158,4 +158,10 @@
</span><span class="cx">     return len;
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><ins>+
+SPAN_DECLARE_NONSTD(int) span_dummy_rx_fillin(void *user_data, int len)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
</ins><span class="cx"> /*- End of file ------------------------------------------------------------*/
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspechoh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/echo.h (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/echo.h        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/echo.h        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -24,7 +24,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: echo.h,v 1.19 2009/02/10 13:06:47 steveu Exp $
</del><ins>+ * $Id: echo.h,v 1.20 2009/09/22 13:11:04 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -133,60 +133,8 @@
</span><span class="cx">     G.168 echo canceller descriptor. This defines the working state for a line
</span><span class="cx">     echo canceller.
</span><span class="cx"> */
</span><del>-typedef struct
-{
-    int tx_power[4];
-    int rx_power[3];
-    int clean_rx_power;
</del><ins>+typedef struct echo_can_state_s echo_can_state_t;
</ins><span class="cx"> 
</span><del>-    int rx_power_threshold;
-    int nonupdate_dwell;
-
-    int curr_pos;
-        
-    int taps;
-    int tap_mask;
-    int adaption_mode;
-    
-    int32_t supp_test1;
-    int32_t supp_test2;
-    int32_t supp1;
-    int32_t supp2;
-    int vad;
-    int cng;
-
-    int16_t geigel_max;
-    int geigel_lag;
-    int dtd_onset;
-    int tap_set;
-    int tap_rotate_counter;
-
-    int32_t latest_correction;  /* Indication of the magnitude of the latest
-                                   adaption, or a code to indicate why adaption
-                                   was skipped, for test purposes */
-    int32_t last_acf[28];
-    int narrowband_count;
-    int narrowband_score;
-
-    fir16_state_t fir_state;
-    /*! Echo FIR taps (16 bit version) */
-    int16_t *fir_taps16[4];
-    /*! Echo FIR taps (32 bit version) */
-    int32_t *fir_taps32;
-
-    /* DC and near DC blocking filter states */
-    int32_t tx_hpf[2];
-    int32_t rx_hpf[2];
-   
-    /* Parameters for the optional Hoth noise generator */
-    int cng_level;
-    int cng_rndnum;
-    int cng_filter;
-    
-    /* Snapshot sample of coeffs used for development */
-    int16_t *snapshot;       
-} echo_can_state_t;
-
</del><span class="cx"> #if defined(__cplusplus)
</span><span class="cx"> extern &quot;C&quot;
</span><span class="cx"> {
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspexposeh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/expose.h (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/expose.h        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/expose.h        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: expose.h,v 1.13 2009/05/16 03:34:45 steveu Exp $
</del><ins>+ * $Id: expose.h,v 1.14 2009/09/22 13:11:04 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -56,6 +56,9 @@
</span><span class="cx"> #include &lt;spandsp/private/super_tone_tx.h&gt;
</span><span class="cx"> #include &lt;spandsp/private/super_tone_rx.h&gt;
</span><span class="cx"> #include &lt;spandsp/private/silence_gen.h&gt;
</span><ins>+#include &lt;spandsp/private/swept_tone.h&gt;
+#include &lt;spandsp/private/echo.h&gt;
+#include &lt;spandsp/private/modem_echo.h&gt;
</ins><span class="cx"> #include &lt;spandsp/private/async.h&gt;
</span><span class="cx"> #include &lt;spandsp/private/fsk.h&gt;
</span><span class="cx"> #include &lt;spandsp/private/v29rx.h&gt;
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspfast_converth"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/fast_convert.h (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/fast_convert.h        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/fast_convert.h        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: fast_convert.h,v 1.8 2009/07/10 13:15:56 steveu Exp $
</del><ins>+ * $Id: fast_convert.h,v 1.9 2009/10/03 04:37:25 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #if !defined(_SPANDSP_FAST_CONVERT_H_)
</span><span class="lines">@@ -150,7 +150,7 @@
</span><span class="cx">         );
</span><span class="cx">         return retval;
</span><span class="cx">     }
</span><del>-#elif defined(__GNUC__)  || (__SUNPRO_C &gt;= 0x0590)
</del><ins>+#elif defined(__GNUC__)  ||  (__SUNPRO_C &gt;= 0x0590)
</ins><span class="cx"> 
</span><span class="cx"> #if defined(__i386__)
</span><span class="cx">     /* These routines are guaranteed fast on an i386 machine. Using the built in
</span><span class="lines">@@ -403,7 +403,7 @@
</span><span class="cx">        the accuracy issues related to changing the rounding scheme are of little concern
</span><span class="cx">        to us. */
</span><span class="cx"> 
</span><del>-    #if !defined(__sgi)  &amp;&amp;  !defined(__sunos)  &amp;&amp;  !defined(__solaris) &amp;&amp; !defined(__sun)
</del><ins>+    #if !defined(__sgi)  &amp;&amp;  !defined(__sunos)  &amp;&amp;  !defined(__solaris)  &amp;&amp;  !defined(__sun)
</ins><span class="cx">         #warning &quot;No usable lrint() and lrintf() functions available.&quot;
</span><span class="cx">         #warning &quot;Replacing these functions with a simple C cast.&quot;
</span><span class="cx">     #endif
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspmodem_echoh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/modem_echo.h (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/modem_echo.h        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/modem_echo.h        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: modem_echo.h,v 1.13 2009/02/03 16:28:41 steveu Exp $
</del><ins>+ * $Id: modem_echo.h,v 1.14 2009/09/22 13:11:04 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -84,23 +84,8 @@
</span><span class="cx">     Modem line echo canceller descriptor. This defines the working state for a line
</span><span class="cx">     echo canceller.
</span><span class="cx"> */
</span><del>-typedef struct
-{
-    int adapt;
-    int taps;
</del><ins>+typedef struct modem_echo_can_state_s modem_echo_can_state_t;
</ins><span class="cx"> 
</span><del>-    fir16_state_t fir_state;
-    /*! Echo FIR taps (16 bit version) */
-    int16_t *fir_taps16;
-    /*! Echo FIR taps (32 bit version) */
-    int32_t *fir_taps32;
-
-    int tx_power;
-    int rx_power;
-
-    int curr_pos;
-} modem_echo_can_state_t;
-
</del><span class="cx"> #if defined(__cplusplus)
</span><span class="cx"> extern &quot;C&quot;
</span><span class="cx"> {
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspprivateechoh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/libs/spandsp/src/spandsp/private/echo.h (0 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/private/echo.h                                (rev 0)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/private/echo.h        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/echo.h - An echo cancellor, suitable for electrical and acoustic
+ *                        cancellation. This code does not currently comply with
+ *                        any relevant standards (e.g. G.164/5/7/8).
+ *
+ * Written by Steve Underwood &lt;steveu@coppice.org&gt;
+ *
+ * Copyright (C) 2001 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: echo.h,v 1.1 2009/09/22 13:11:04 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_PRIVATE_ECHO_H_)
+#define _SPANDSP_PRIVATE_ECHO_H_
+
+/*!
+    G.168 echo canceller descriptor. This defines the working state for a line
+    echo canceller.
+*/
+struct echo_can_state_s
+{
+    int tx_power[4];
+    int rx_power[3];
+    int clean_rx_power;
+
+    int rx_power_threshold;
+    int nonupdate_dwell;
+
+    int curr_pos;
+        
+    int taps;
+    int tap_mask;
+    int adaption_mode;
+    
+    int32_t supp_test1;
+    int32_t supp_test2;
+    int32_t supp1;
+    int32_t supp2;
+    int vad;
+    int cng;
+
+    int16_t geigel_max;
+    int geigel_lag;
+    int dtd_onset;
+    int tap_set;
+    int tap_rotate_counter;
+
+    int32_t latest_correction;  /* Indication of the magnitude of the latest
+                                   adaption, or a code to indicate why adaption
+                                   was skipped, for test purposes */
+    int32_t last_acf[28];
+    int narrowband_count;
+    int narrowband_score;
+
+    fir16_state_t fir_state;
+    /*! Echo FIR taps (16 bit version) */
+    int16_t *fir_taps16[4];
+    /*! Echo FIR taps (32 bit version) */
+    int32_t *fir_taps32;
+
+    /* DC and near DC blocking filter states */
+    int32_t tx_hpf[2];
+    int32_t rx_hpf[2];
+   
+    /* Parameters for the optional Hoth noise generator */
+    int cng_level;
+    int cng_rndnum;
+    int cng_filter;
+    
+    /* Snapshot sample of coeffs used for development */
+    int16_t *snapshot;       
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/
</ins></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspprivatefax_modemsh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/private/fax_modems.h (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/private/fax_modems.h        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/private/fax_modems.h        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: fax_modems.h,v 1.3 2009/03/23 14:17:42 steveu Exp $
</del><ins>+ * $Id: fax_modems.h,v 1.4 2009/09/04 14:38:47 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -95,11 +95,9 @@
</span><span class="cx"> 
</span><span class="cx">     /*! The current receive signal handler */
</span><span class="cx">     span_rx_handler_t *rx_handler;
</span><del>-    void *rx_user_data;
-
</del><span class="cx">     /*! The current receive missing signal fill-in handler */
</span><span class="cx">     span_rx_fillin_handler_t *rx_fillin_handler;
</span><del>-    void *rx_fillin_user_data;
</del><ins>+    void *rx_user_data;
</ins><span class="cx"> 
</span><span class="cx">     /*! The current transmit signal handler */
</span><span class="cx">     span_tx_handler_t *tx_handler;
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspprivatemodem_echoh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/libs/spandsp/src/spandsp/private/modem_echo.h (0 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/private/modem_echo.h                                (rev 0)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/private/modem_echo.h        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/modem_echo.h - An echo cancellor, suitable for electrical echos in GSTN modems
+ *
+ * Written by Steve Underwood &lt;steveu@coppice.org&gt;
+ *
+ * Copyright (C) 2001, 2004 Steve Underwood
+ *
+ * Based on a bit from here, a bit from there, eye of toad,
+ * ear of bat, etc - plus, of course, my own 2 cents.
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: modem_echo.h,v 1.1 2009/09/22 13:11:04 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_PRIVATE_MODEM_ECHO_H_)
+#define _SPANDSP_PRIVATE_MODEM_ECHO_H_
+
+/*!
+    Modem line echo canceller descriptor. This defines the working state for a line
+    echo canceller.
+*/
+struct modem_echo_can_state_s
+{
+    int adapt;
+    int taps;
+
+    fir16_state_t fir_state;
+    /*! Echo FIR taps (16 bit version) */
+    int16_t *fir_taps16;
+    /*! Echo FIR taps (32 bit version) */
+    int32_t *fir_taps32;
+
+    int tx_power;
+    int rx_power;
+
+    int curr_pos;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/
</ins></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspprivatesig_toneh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/private/sig_tone.h (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/private/sig_tone.h        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/private/sig_tone.h        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: sig_tone.h,v 1.3 2009/04/12 14:18:02 steveu Exp $
</del><ins>+ * $Id: sig_tone.h,v 1.4 2009/09/04 14:38:47 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #if !defined(_SPANDSP_PRIVATE_SIG_TONE_H_)
</span><span class="lines">@@ -38,8 +38,8 @@
</span><span class="cx"> {
</span><span class="cx">     /*! \brief The tones used. */
</span><span class="cx">     int tone_freq[2];
</span><del>-    /*! \brief The high and low tone amplitudes. */
-    int tone_amp[2];
</del><ins>+    /*! \brief The high and low tone amplitudes for each of the tones. */
+    int tone_amp[2][2];
</ins><span class="cx"> 
</span><span class="cx">     /*! \brief The delay, in audio samples, before the high level tone drops
</span><span class="cx">                to a low level tone. */
</span><span class="lines">@@ -80,7 +80,6 @@
</span><span class="cx"> #endif
</span><span class="cx">     } tone[2];
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> #if defined(SPANDSP_USE_FIXED_POINT)
</span><span class="cx">     /*! \brief Flat mode bandpass bi-quad parameters */
</span><span class="cx">     int32_t broad_a[3];
</span><span class="lines">@@ -128,23 +127,23 @@
</span><span class="cx"> struct sig_tone_tx_state_s
</span><span class="cx"> {
</span><span class="cx">     /*! \brief The callback function used to handle signaling changes. */
</span><del>-    sig_tone_func_t sig_update;
</del><ins>+    tone_report_func_t sig_update;
</ins><span class="cx">     /*! \brief A user specified opaque pointer passed to the callback function. */
</span><span class="cx">     void *user_data;
</span><span class="cx"> 
</span><span class="cx">     /*! \brief Tone descriptor */
</span><span class="cx">     sig_tone_descriptor_t *desc;
</span><span class="cx"> 
</span><del>-    /*! The scaling values for the high and low level tones */
-    int16_t tone_scaling[2];
-    /*! The sample timer, used to switch between the high and low level tones. */
-    int high_low_timer;
-
</del><span class="cx">     /*! The phase rates for the one or two tones */
</span><span class="cx">     int32_t phase_rate[2];
</span><span class="cx">     /*! The phase accumulators for the one or two tones */
</span><span class="cx">     uint32_t phase_acc[2];
</span><span class="cx"> 
</span><ins>+    /*! The scaling values for the one or two tones, and the high and low level of each tone */
+    int16_t tone_scaling[2][2];
+    /*! The sample timer, used to switch between the high and low level tones. */
+    int high_low_timer;
+
</ins><span class="cx">     /*! \brief Current transmit tone */
</span><span class="cx">     int current_tx_tone;
</span><span class="cx">     /*! \brief Current transmit timeout */
</span><span class="lines">@@ -159,7 +158,7 @@
</span><span class="cx"> struct sig_tone_rx_state_s
</span><span class="cx"> {
</span><span class="cx">     /*! \brief The callback function used to handle signaling changes. */
</span><del>-    sig_tone_func_t sig_update;
</del><ins>+    tone_report_func_t sig_update;
</ins><span class="cx">     /*! \brief A user specified opaque pointer passed to the callback function. */
</span><span class="cx">     void *user_data;
</span><span class="cx"> 
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspprivateswept_toneh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/libs/spandsp/src/spandsp/private/swept_tone.h (0 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/private/swept_tone.h                                (rev 0)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/private/swept_tone.h        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/swept_tone.h - Swept tone generation
+ *
+ * Written by Steve Underwood &lt;steveu@coppice.org&gt;
+ *
+ * Copyright (C) 2009 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: swept_tone.h,v 1.1 2009/09/22 12:54:33 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_SWEPT_TONE_H_)
+#define _SPANDSP_PRIVATE_SWEPT_TONE_H_
+
+struct swept_tone_state_s
+{
+    int32_t starting_phase_inc;
+    int32_t phase_inc_step;
+    int scale;
+    int duration;
+    int repeating;
+    int pos;
+    int32_t current_phase_inc;
+    uint32_t phase;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/
</ins></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspprivatet30h"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/private/t30.h (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/private/t30.h        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/private/t30.h        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: t30.h,v 1.4 2009/04/12 14:18:02 steveu Exp $
</del><ins>+ * $Id: t30.h,v 1.5 2009/09/20 13:42:29 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -221,10 +221,10 @@
</span><span class="cx">     /*! \brief A bit map of the OK ECM frames, constructed as a PPR frame. */
</span><span class="cx">     uint8_t ecm_frame_map[3 + 32];
</span><span class="cx">     
</span><del>-    /*! \brief The current page number for receiving, in ECM mode. This is reset at the start of a call. */
-    int ecm_rx_page;
-    /*! \brief The current page number for sending, in ECM mode. This is reset at the start of a call. */
-    int ecm_tx_page;
</del><ins>+    /*! \brief The current page number for receiving, in ECM or non-ECM mode. This is reset at the start of a call. */
+    int rx_page_number;
+    /*! \brief The current page number for sending, in ECM or non-ECM mode. This is reset at the start of a call. */
+    int tx_page_number;
</ins><span class="cx">     /*! \brief The current block number, in ECM mode */
</span><span class="cx">     int ecm_block;
</span><span class="cx">     /*! \brief The number of frames in the current block number, in ECM mode */
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspsig_toneh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/sig_tone.h (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/sig_tone.h        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/sig_tone.h        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: sig_tone.h,v 1.19 2009/04/12 14:18:02 steveu Exp $
</del><ins>+ * $Id: sig_tone.h,v 1.20 2009/09/04 14:38:46 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -54,32 +54,39 @@
</span><span class="cx"> #if !defined(_SPANDSP_SIG_TONE_H_)
</span><span class="cx"> #define _SPANDSP_SIG_TONE_H_
</span><span class="cx"> 
</span><del>-typedef int (*sig_tone_func_t)(void *user_data, int what);
-
</del><span class="cx"> /* The optional tone sets */
</span><span class="cx"> enum
</span><span class="cx"> {
</span><del>-    /*! European 2280Hz signaling tone */
</del><ins>+    /*! European 2280Hz signaling tone. Tone 1 is 2280Hz. Tone 2 is not used. */
</ins><span class="cx">     SIG_TONE_2280HZ = 1,
</span><del>-    /*! US 2600Hz signaling tone */
</del><ins>+    /*! US 2600Hz signaling tone. Tone 1 is 2600Hz. Tone 2 is not used. */
</ins><span class="cx">     SIG_TONE_2600HZ,
</span><del>-    /*! US 2400Hz + 2600Hz signaling tones */
</del><ins>+    /*! US 2400Hz + 2600Hz signaling tones. Tone 1 is 2600Hz. Tone 2 is 2400Hz. */
</ins><span class="cx">     SIG_TONE_2400HZ_2600HZ
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+/* Mode control and report bits for transmit and receive */
</ins><span class="cx"> enum
</span><span class="cx"> {
</span><span class="cx">     /*! Signaling tone 1 is present */
</span><span class="cx">     SIG_TONE_1_PRESENT          = 0x001,
</span><ins>+    /*! Signaling tone 1 has changed state (ignored when setting tx mode) */
</ins><span class="cx">     SIG_TONE_1_CHANGE           = 0x002,
</span><span class="cx">     /*! Signaling tone 2 is present */
</span><span class="cx">     SIG_TONE_2_PRESENT          = 0x004,
</span><ins>+    /*! Signaling tone 2 has changed state (ignored when setting tx mode) */
</ins><span class="cx">     SIG_TONE_2_CHANGE           = 0x008,
</span><span class="cx">     /*! The media signal is passing through. Tones might be added to it. */
</span><span class="cx">     SIG_TONE_TX_PASSTHROUGH     = 0x010,
</span><span class="cx">     /*! The media signal is passing through. Tones might be extracted from it, if detected. */
</span><del>-    SIG_TONE_RX_PASSTHROUGH     = 0x020,
-    SIG_TONE_UPDATE_REQUEST     = 0x100
</del><ins>+    SIG_TONE_RX_PASSTHROUGH     = 0x040,
+    /*! Force filtering of the signaling tone, whether signaling is being detected or not.
+        This is mostly useful for test purposes. */
+    SIG_TONE_RX_FILTER_TONE     = 0x080,
+    /*! Request an update of the transmit status, upon timeout of the previous status. */
+    SIG_TONE_TX_UPDATE_REQUEST  = 0x100,
+    /*! Request an update of the receiver status, upon timeout of the previous status. */
+    SIG_TONE_RX_UPDATE_REQUEST  = 0x200
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> /*!
</span><span class="lines">@@ -106,6 +113,14 @@
</span><span class="cx">     \return The number of samples unprocessed. */
</span><span class="cx"> SPAN_DECLARE(int) sig_tone_rx(sig_tone_rx_state_t *s, int16_t amp[], int len);
</span><span class="cx"> 
</span><ins>+/*! Set the receive mode.
+    \brief Set the receive mode.
+    \param s The signaling tone context.
+    \param mode The new mode for the receiver.
+    \param duration The duration for this mode, before an update is requested.
+                    A duration of zero means forever. */
+SPAN_DECLARE(void) sig_tone_rx_set_mode(sig_tone_rx_state_t *s, int mode, int duration);
+
</ins><span class="cx"> /*! Initialise a signaling tone receiver context.
</span><span class="cx">     \brief Initialise a signaling tone context.
</span><span class="cx">     \param s The signaling tone context.
</span><span class="lines">@@ -113,7 +128,7 @@
</span><span class="cx">     \param sig_update Callback function to handle signaling updates.
</span><span class="cx">     \param user_data An opaque pointer.
</span><span class="cx">     \return A pointer to the signalling tone context, or NULL if there was a problem. */
</span><del>-SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int tone_type, sig_tone_func_t sig_update, void *user_data);
</del><ins>+SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int tone_type, tone_report_func_t sig_update, void *user_data);
</ins><span class="cx"> 
</span><span class="cx"> /*! Release a signaling tone receiver context.
</span><span class="cx">     \brief Release a signaling tone receiver context.
</span><span class="lines">@@ -138,8 +153,10 @@
</span><span class="cx"> /*! Set the tone mode.
</span><span class="cx">     \brief Set the tone mode.
</span><span class="cx">     \param s The signaling tone context.
</span><del>-    \param mode The new mode for the transmitted tones. */
-SPAN_DECLARE(void) sig_tone_tx_set_mode(sig_tone_tx_state_t *s, int mode);
</del><ins>+    \param mode The new mode for the transmitted tones.
+    \param duration The duration for this mode, before an update is requested.
+                    A duration of zero means forever. */
+SPAN_DECLARE(void) sig_tone_tx_set_mode(sig_tone_tx_state_t *s, int mode, int duration);
</ins><span class="cx"> 
</span><span class="cx"> /*! Initialise a signaling tone transmitter context.
</span><span class="cx">     \brief Initialise a signaling tone context.
</span><span class="lines">@@ -148,7 +165,7 @@
</span><span class="cx">     \param sig_update Callback function to handle signaling updates.
</span><span class="cx">     \param user_data An opaque pointer.
</span><span class="cx">     \return A pointer to the signalling tone context, or NULL if there was a problem. */
</span><del>-SPAN_DECLARE(sig_tone_tx_state_t *) sig_tone_tx_init(sig_tone_tx_state_t *s, int tone_type, sig_tone_func_t sig_update, void *user_data);
</del><ins>+SPAN_DECLARE(sig_tone_tx_state_t *) sig_tone_tx_init(sig_tone_tx_state_t *s, int tone_type, tone_report_func_t sig_update, void *user_data);
</ins><span class="cx"> 
</span><span class="cx"> /*! Release a signaling tone transmitter context.
</span><span class="cx">     \brief Release a signaling tone transmitter context.
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspsilence_genh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/silence_gen.h (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/silence_gen.h        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/silence_gen.h        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: silence_gen.h,v 1.18 2009/06/02 16:03:56 steveu Exp $
</del><ins>+ * $Id: silence_gen.h,v 1.19 2009/09/04 14:38:47 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #if !defined(_SPANDSP_SILENCE_GEN_H_)
</span><span class="lines">@@ -125,6 +125,16 @@
</span><span class="cx"> */
</span><span class="cx"> SPAN_DECLARE(int) span_dummy_mod(void *user_data, int16_t amp[], int len);
</span><span class="cx"> 
</span><ins>+/*! A dummy routine to use as a receive fillin callback, when we aren't really
+    trying to process what is received. It just absorbs and ignores the
+    request.
+    \brief Dummy receive fillin callback.
+    \param user_data The context.
+    \param len The length of the signal buffer
+    \return 0.
+*/
+SPAN_DECLARE_NONSTD(int) span_dummy_rx_fillin(void *user_data, int len);
+
</ins><span class="cx"> #if defined(__cplusplus)
</span><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspswept_toneh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/libs/spandsp/src/spandsp/swept_tone.h (0 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/swept_tone.h                                (rev 0)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/swept_tone.h        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * swept_tone.h - Swept tone generation
+ *
+ * Written by Steve Underwood &lt;steveu@coppice.org&gt;
+ *
+ * Copyright (C) 2009 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: swept_tone.h,v 1.1 2009/09/22 12:54:33 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_SWEPT_TONE_H_)
+#define _SPANDSP_SWEPT_TONE_H_
+
+/*! \page swept_tone_page The swept tone generator
+\section swept_tone_page_sec_1 What does it do?
+*/
+
+typedef struct swept_tone_state_s swept_tone_state_t;
+
+#if defined(__cplusplus)
+extern &quot;C&quot;
+{
+#endif
+
+SPAN_DECLARE(swept_tone_state_t *) swept_tone_init(swept_tone_state_t *s, float start, float end, float level, int duration, int repeating);
+
+SPAN_DECLARE(int) swept_tone(swept_tone_state_t *s, int16_t amp[], int len);
+
+SPAN_DECLARE(float) swept_tone_current_frequency(swept_tone_state_t *s);
+
+SPAN_DECLARE(int) swept_tone_release(swept_tone_state_t *s);
+
+SPAN_DECLARE(int) swept_tone_free(swept_tone_state_t *s);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+/*- End of file ------------------------------------------------------------*/
</ins></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspt30h"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/t30.h (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/t30.h        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/t30.h        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: t30.h,v 1.125 2009/04/12 09:12:10 steveu Exp $
</del><ins>+ * $Id: t30.h,v 1.126 2009/09/21 15:52:39 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -524,9 +524,9 @@
</span><span class="cx">     int pages_rx;
</span><span class="cx">     /*! \brief The number of pages in the file (&lt;0 if not known). */
</span><span class="cx">     int pages_in_file;
</span><del>-    /*! \brief The horizontal column-to-column resolution of the page, in pixels per metre */
</del><ins>+    /*! \brief The horizontal column-to-column resolution of the most recent page, in pixels per metre */
</ins><span class="cx">     int x_resolution;
</span><del>-    /*! \brief The vertical row-to-row resolution of the page, in pixels per metre */
</del><ins>+    /*! \brief The vertical row-to-row resolution of the most recent page, in pixels per metre */
</ins><span class="cx">     int y_resolution;
</span><span class="cx">     /*! \brief The number of horizontal pixels in the most recent page. */
</span><span class="cx">     int width;
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandsptimingh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/timing.h (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/timing.h        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/timing.h        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: timing.h,v 1.13 2008/04/17 14:27:01 steveu Exp $
</del><ins>+ * $Id: timing.h,v 1.14 2009/09/04 14:38:47 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #if !defined(_SPANDSP_TIMING_H_)
</span><span class="lines">@@ -56,8 +56,8 @@
</span><span class="cx"> #elif defined(__x86_64__)
</span><span class="cx"> static __inline__ uint64_t rdtscll(void)
</span><span class="cx"> {
</span><del>-    unsigned int a;
-    unsigned int d;
</del><ins>+    uint32_t a;
+    uint32_t d;
</ins><span class="cx"> 
</span><span class="cx">     /* For x86_64 we need to merge the result in 2 32 bit registers
</span><span class="cx">        into one clean 64 bit result. */
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandspversionh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp/version.h (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp/version.h        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/version.h        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -30,9 +30,9 @@
</span><span class="cx"> 
</span><span class="cx"> /* The date and time of the version are in UTC form. */
</span><span class="cx"> 
</span><del>-#define SPANDSP_RELEASE_DATE            20090714
-#define SPANDSP_RELEASE_TIME            135534
-#define SPANDSP_RELEASE_DATETIME_STRING &quot;20090714 135534&quot;
</del><ins>+#define SPANDSP_RELEASE_DATE            20091005
+#define SPANDSP_RELEASE_TIME            132812
+#define SPANDSP_RELEASE_DATETIME_STRING &quot;20091005 132812&quot;
</ins><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> /*- End of file ------------------------------------------------------------*/
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcspandsphin"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/spandsp.h.in (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/spandsp.h.in        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/spandsp.h.in        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: spandsp.h.in,v 1.18 2009/04/02 13:43:49 steveu Exp $
</del><ins>+ * $Id: spandsp.h.in,v 1.19 2009/09/22 13:11:04 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -66,6 +66,7 @@
</span><span class="cx"> #include &lt;spandsp/complex_filters.h&gt;
</span><span class="cx"> #include &lt;spandsp/dc_restore.h&gt;
</span><span class="cx"> #include &lt;spandsp/dds.h&gt;
</span><ins>+#include &lt;spandsp/swept_tone.h&gt;
</ins><span class="cx"> #include &lt;spandsp/echo.h&gt;
</span><span class="cx"> #include &lt;spandsp/modem_echo.h&gt;
</span><span class="cx"> #include &lt;spandsp/crc.h&gt;
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrcswept_tonec"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/libs/spandsp/src/swept_tone.c (0 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/swept_tone.c                                (rev 0)
+++ freeswitch/trunk/libs/spandsp/src/swept_tone.c        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -0,0 +1,128 @@
</span><ins>+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * swept_tone.c - Swept tone generation
+ *
+ * Written by Steve Underwood &lt;steveu@coppice.org&gt;
+ *
+ * Copyright (C) 2009 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: swept_tone.c,v 1.2 2009/09/23 16:02:59 steveu Exp $
+ */
+
+/*! \file */
+
+#if defined(HAVE_CONFIG_H)
+#include &quot;config.h&quot;
+#endif
+
+#include &lt;stdlib.h&gt;
+#include &lt;inttypes.h&gt;
+#include &lt;string.h&gt;
+#include &lt;stdio.h&gt;
+#if defined(HAVE_TGMATH_H)
+#include &lt;tgmath.h&gt;
+#endif
+#if defined(HAVE_MATH_H)
+#include &lt;math.h&gt;
+#endif
+#include &quot;floating_fudge.h&quot;
+
+#include &quot;spandsp/telephony.h&quot;
+#include &quot;spandsp/logging.h&quot;
+#include &quot;spandsp/complex.h&quot;
+#include &quot;spandsp/vector_float.h&quot;
+#include &quot;spandsp/complex_vector_float.h&quot;
+#include &quot;spandsp/vector_int.h&quot;
+#include &quot;spandsp/complex_vector_int.h&quot;
+#include &quot;spandsp/dds.h&quot;
+
+#include &quot;spandsp/swept_tone.h&quot;
+
+#include &quot;spandsp/private/logging.h&quot;
+#include &quot;spandsp/private/swept_tone.h&quot;
+
+SPAN_DECLARE(swept_tone_state_t *) swept_tone_init(swept_tone_state_t *s, float start, float end, float level, int duration, int repeating)
+{
+    if (s == NULL)
+    {
+        if ((s = (swept_tone_state_t *) malloc(sizeof(*s))) == NULL)
+            return NULL;
+    }
+    memset(s, 0, sizeof(*s));
+    s-&gt;current_phase_inc =
+    s-&gt;starting_phase_inc = dds_phase_rate(start);
+    s-&gt;phase_inc_step = dds_phase_rate((end - start)/(float) duration);
+    s-&gt;scale = dds_scaling_dbm0(level);
+    s-&gt;duration = duration;
+    s-&gt;repeating = repeating;
+    s-&gt;pos = 0;
+    s-&gt;phase = 0;
+    return s;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) swept_tone(swept_tone_state_t *s, int16_t amp[], int max_len)
+{
+    int i;
+    int len;
+    int chunk_len;
+    
+    for (len = 0;  len &lt; max_len;  )
+    {
+        chunk_len = max_len - len;
+        if (chunk_len &gt; s-&gt;duration - s-&gt;pos)
+            chunk_len = s-&gt;duration - s-&gt;pos;
+        for (i = len;  i &lt; len + chunk_len;  i++)
+        {
+            amp[i] = (dds(&amp;s-&gt;phase, s-&gt;current_phase_inc)*s-&gt;scale) &gt;&gt; 15;
+            s-&gt;current_phase_inc += s-&gt;phase_inc_step;
+        }
+        len += chunk_len;
+        s-&gt;pos += chunk_len;
+        if (s-&gt;pos &gt;= s-&gt;duration)
+        {
+            if (!s-&gt;repeating)
+                break;
+            s-&gt;pos = 0;
+            s-&gt;current_phase_inc = s-&gt;starting_phase_inc;
+        }
+    }
+    return len;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(float) swept_tone_current_frequency(swept_tone_state_t *s)
+{
+    return dds_frequency(s-&gt;current_phase_inc);
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) swept_tone_release(swept_tone_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) swept_tone_free(swept_tone_state_t *s)
+{
+    free(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+/*- End of file ------------------------------------------------------------*/
</ins></span></pre></div>
<a id="freeswitchtrunklibsspandspsrct30c"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/t30.c (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/t30.c        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/t30.c        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: t30.c,v 1.301 2009/05/25 12:37:38 steveu Exp $
</del><ins>+ * $Id: t30.c,v 1.303 2009/09/21 15:51:18 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -421,7 +421,7 @@
</span><span class="cx">     }
</span><span class="cx">     s-&gt;ecm_block = 0;
</span><span class="cx">     s-&gt;error_correcting_mode_retries = 0;
</span><del>-    span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;Starting page %d of transfer\n&quot;, s-&gt;ecm_tx_page + 1);
</del><ins>+    span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;Starting page %d of transfer\n&quot;, s-&gt;tx_page_number + 1);
</ins><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="lines">@@ -431,7 +431,7 @@
</span><span class="cx">     s-&gt;retries = 0;
</span><span class="cx">     if (t4_tx_end_page(&amp;(s-&gt;t4)) == 0)
</span><span class="cx">     {
</span><del>-        s-&gt;ecm_tx_page++;
</del><ins>+        s-&gt;tx_page_number++;
</ins><span class="cx">         s-&gt;ecm_block = 0;
</span><span class="cx">     }
</span><span class="cx">     return 0;
</span><span class="lines">@@ -470,7 +470,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (t4_rx_end_page(&amp;(s-&gt;t4)) == 0)
</span><span class="cx">     {
</span><del>-        s-&gt;ecm_rx_page++;
</del><ins>+        s-&gt;rx_page_number++;
</ins><span class="cx">         s-&gt;ecm_block = 0;
</span><span class="cx">     }
</span><span class="cx">     return 0;
</span><span class="lines">@@ -1042,7 +1042,7 @@
</span><span class="cx">     frame[1] = CONTROL_FIELD_FINAL_FRAME;
</span><span class="cx">     frame[2] = (uint8_t) (T30_PPS | s-&gt;dis_received);
</span><span class="cx">     frame[3] = (s-&gt;ecm_at_page_end)  ?  ((uint8_t) (s-&gt;next_tx_step | s-&gt;dis_received))  :  T30_NULL;
</span><del>-    frame[4] = (uint8_t) (s-&gt;ecm_tx_page &amp; 0xFF);
</del><ins>+    frame[4] = (uint8_t) (s-&gt;tx_page_number &amp; 0xFF);
</ins><span class="cx">     frame[5] = (uint8_t) (s-&gt;ecm_block &amp; 0xFF);
</span><span class="cx">     frame[6] = (uint8_t) ((s-&gt;ecm_frames_this_tx_burst == 0)  ?  0  :  (s-&gt;ecm_frames_this_tx_burst - 1));
</span><span class="cx">     span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;Sending PPS + %s\n&quot;, t30_frametype(frame[3]));
</span><span class="lines">@@ -1957,30 +1957,19 @@
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><del>-static void unexpected_frame(t30_state_t *s, const uint8_t *msg, int len)
-{
-    span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;Unexpected %s received in state %d\n&quot;, t30_frametype(msg[2]), s-&gt;state);
-    switch (s-&gt;state)
-    {
-    case T30_STATE_F_DOC_ECM:
-    case T30_STATE_F_DOC_NON_ECM:
-        s-&gt;current_status = T30_ERR_RX_INVALCMD;
-        break;
-    }
-}
-/*- End of function --------------------------------------------------------*/
-
</del><span class="cx"> static void unexpected_non_final_frame(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><span class="cx">     span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;Unexpected %s frame in state %d\n&quot;, t30_frametype(msg[2]), s-&gt;state);
</span><del>-    s-&gt;current_status = T30_ERR_UNEXPECTED;
</del><ins>+    if (s-&gt;current_status == T30_ERR_OK)
+        s-&gt;current_status = T30_ERR_UNEXPECTED;
</ins><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><span class="cx"> static void unexpected_final_frame(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;Unexpected %s received in state %d\n&quot;, t30_frametype(msg[2]), s-&gt;state);
-    s-&gt;current_status = T30_ERR_UNEXPECTED;
</del><ins>+    span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;Unexpected %s frame in state %d\n&quot;, t30_frametype(msg[2]), s-&gt;state);
+    if (s-&gt;current_status == T30_ERR_OK)
+        s-&gt;current_status = T30_ERR_UNEXPECTED;
</ins><span class="cx">     send_dcn(s);
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="lines">@@ -1988,7 +1977,8 @@
</span><span class="cx"> static void unexpected_frame_length(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><span class="cx">     span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;Unexpected %s frame length - %d\n&quot;, t30_frametype(msg[0]), len);
</span><del>-    s-&gt;current_status = T30_ERR_UNEXPECTED;
</del><ins>+    if (s-&gt;current_status == T30_ERR_OK)
+        s-&gt;current_status = T30_ERR_UNEXPECTED;
</ins><span class="cx">     send_dcn(s);
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="lines">@@ -2372,9 +2362,9 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;Received PPS + %s - page %d, block %d, %d frames\n&quot;, t30_frametype(msg[3]), page, block, frames);
</span><del>-    if (page != s-&gt;ecm_rx_page)
</del><ins>+    if (page != s-&gt;rx_page_number)
</ins><span class="cx">     {
</span><del>-        span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;ECM rx page mismatch - expected %d, but received %d.\n&quot;, s-&gt;ecm_rx_page, page);
</del><ins>+        span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;ECM rx page mismatch - expected %d, but received %d.\n&quot;, s-&gt;rx_page_number, page);
</ins><span class="cx">     }
</span><span class="cx">     if (block != s-&gt;ecm_block)
</span><span class="cx">     {
</span><span class="lines">@@ -2645,7 +2635,11 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_answering(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    uint8_t fcf;
+
+    /* We should be sending the TCF data right now */
+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_DIS:
</span><span class="cx">         /* TODO: This is a fudge to allow for starting up in T.38, where the other end has
</span><span class="lines">@@ -2675,7 +2669,11 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_b(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    uint8_t fcf;
+
+    /* We should be sending the TCF data right now */
+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_DCN:
</span><span class="cx">         /* Just ignore any DCN's which appear at this stage. */
</span><span class="lines">@@ -2696,7 +2694,10 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_c(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    uint8_t fcf;
+
+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_DCN:
</span><span class="cx">         /* Just ignore any DCN's which appear at this stage. */
</span><span class="lines">@@ -2717,8 +2718,11 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_d(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><ins>+    uint8_t fcf;
+
</ins><span class="cx">     /* We should be sending the DCS sequence right now */
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_DCN:
</span><span class="cx">         s-&gt;current_status = T30_ERR_TX_BADDCS;
</span><span class="lines">@@ -2740,8 +2744,11 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_d_tcf(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><ins>+    uint8_t fcf;
+
</ins><span class="cx">     /* We should be sending the TCF data right now */
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_DCN:
</span><span class="cx">         s-&gt;current_status = T30_ERR_TX_BADDCS;
</span><span class="lines">@@ -2763,7 +2770,10 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_d_post_tcf(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    uint8_t fcf;
+
+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_CFR:
</span><span class="cx">         /* Trainability test succeeded. Send the document. */
</span><span class="lines">@@ -2832,8 +2842,11 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_f_tcf(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><ins>+    uint8_t fcf;
+
</ins><span class="cx">     /* We should be receiving TCF right now, not HDLC messages */
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_CRP:
</span><span class="cx">         repeat_last_command(s);
</span><span class="lines">@@ -2851,8 +2864,11 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_f_cfr(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><ins>+    uint8_t fcf;
+
</ins><span class="cx">     /* We're waiting for a response to the CFR we sent */
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_DCS:
</span><span class="cx">         /* If we received another DCS, they must have missed our CFR */
</span><span class="lines">@@ -2874,8 +2890,11 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_f_ftt(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><ins>+    uint8_t fcf;
+
</ins><span class="cx">     /* We're waiting for a response to the FTT we sent */
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_DCS:
</span><span class="cx">         process_rx_dcs(s, msg, len);
</span><span class="lines">@@ -2896,12 +2915,15 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_f_doc_non_ecm(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><ins>+    uint8_t fcf;
+
</ins><span class="cx">     /* If we are getting HDLC messages, and we have not moved to the _POST_DOC_NON_ECM
</span><span class="cx">        state, it looks like either:
</span><span class="cx">         - we didn't see the image data carrier properly, or
</span><span class="cx">         - they didn't see our T30_CFR, and are repeating the DCS/TCF sequence.
</span><span class="cx">         - they didn't see out T30_MCF, and are repeating the end of page message. */
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_DIS:
</span><span class="cx">         process_rx_dis_dtc(s, msg, len);
</span><span class="lines">@@ -2912,7 +2934,7 @@
</span><span class="cx">     case T30_MPS:
</span><span class="cx">         /* Treat this as a bad quality page. */
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, msg[2] &amp; 0xFE);
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">         s-&gt;next_rx_step = msg[2] &amp; 0xFE;
</span><span class="cx">         queue_phase(s, T30_PHASE_D_TX);
</span><span class="cx">         set_state(s, T30_STATE_III_Q_RTN);
</span><span class="lines">@@ -2922,7 +2944,7 @@
</span><span class="cx">         /* Treat this as a bad quality page. */
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><span class="cx">         {
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, msg[2] &amp; 0xFE);
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">             s-&gt;timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
</span><span class="cx">         }
</span><span class="cx">         s-&gt;next_rx_step = msg[2] &amp; 0xFE;
</span><span class="lines">@@ -2932,7 +2954,7 @@
</span><span class="cx">     case T30_EOS:
</span><span class="cx">         /* Treat this as a bad quality page. */
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, msg[2] &amp; 0xFE);
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">         s-&gt;next_rx_step = msg[2] &amp; 0xFE;
</span><span class="cx">         /* Return to phase B */
</span><span class="cx">         queue_phase(s, T30_PHASE_B_TX);
</span><span class="lines">@@ -2943,7 +2965,7 @@
</span><span class="cx">         /* Treat this as a bad quality page. */
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><span class="cx">         {
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, msg[2] &amp; 0xFE);
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">             s-&gt;timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
</span><span class="cx">         }
</span><span class="cx">         s-&gt;next_rx_step = T30_PRI_EOM;
</span><span class="lines">@@ -2952,7 +2974,7 @@
</span><span class="cx">     case T30_EOP:
</span><span class="cx">         /* Treat this as a bad quality page. */
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, msg[2] &amp; 0xFE);
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">         s-&gt;next_rx_step = msg[2] &amp; 0xFE;
</span><span class="cx">         queue_phase(s, T30_PHASE_D_TX);
</span><span class="cx">         set_state(s, T30_STATE_III_Q_RTN);
</span><span class="lines">@@ -2962,7 +2984,7 @@
</span><span class="cx">         /* Treat this as a bad quality page. */
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><span class="cx">         {
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, msg[2] &amp; 0xFE);
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">             s-&gt;timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
</span><span class="cx">         }
</span><span class="cx">         s-&gt;next_rx_step = msg[2] &amp; 0xFE;
</span><span class="lines">@@ -2980,6 +3002,7 @@
</span><span class="cx">         break;
</span><span class="cx">     default:
</span><span class="cx">         /* We don't know what to do with this. */
</span><ins>+        s-&gt;current_status = T30_ERR_RX_INVALCMD;
</ins><span class="cx">         unexpected_final_frame(s, msg, len);
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="lines">@@ -2988,12 +3011,15 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_f_post_doc_non_ecm(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    uint8_t fcf;
+
+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_MPS:
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, msg[2] &amp; 0xFE);
-        s-&gt;next_rx_step = msg[2] &amp; 0xFE;
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
+        s-&gt;next_rx_step = fcf;
</ins><span class="cx">         queue_phase(s, T30_PHASE_D_TX);
</span><span class="cx">         switch (copy_quality(s))
</span><span class="cx">         {
</span><span class="lines">@@ -3020,10 +3046,10 @@
</span><span class="cx">     case T30_PRI_MPS:
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><span class="cx">         {
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, msg[2] &amp; 0xFE);
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">             s-&gt;timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
</span><span class="cx">         }
</span><del>-        s-&gt;next_rx_step = msg[2] &amp; 0xFE;
</del><ins>+        s-&gt;next_rx_step = fcf;
</ins><span class="cx">         switch (copy_quality(s))
</span><span class="cx">         {
</span><span class="cx">         case T30_COPY_QUALITY_PERFECT:
</span><span class="lines">@@ -3049,8 +3075,8 @@
</span><span class="cx">     case T30_EOM:
</span><span class="cx">     case T30_EOS:
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, msg[2] &amp; 0xFE);
-        s-&gt;next_rx_step = msg[2] &amp; 0xFE;
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
+        s-&gt;next_rx_step = fcf;
</ins><span class="cx">         /* Return to phase B */
</span><span class="cx">         queue_phase(s, T30_PHASE_B_TX);
</span><span class="cx">         switch (copy_quality(s))
</span><span class="lines">@@ -3078,10 +3104,10 @@
</span><span class="cx">     case T30_PRI_EOM:
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><span class="cx">         {
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, msg[2] &amp; 0xFE);
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">             s-&gt;timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
</span><span class="cx">         }
</span><del>-        s-&gt;next_rx_step = msg[2] &amp; 0xFE;
</del><ins>+        s-&gt;next_rx_step = fcf;
</ins><span class="cx">         switch (copy_quality(s))
</span><span class="cx">         {
</span><span class="cx">         case T30_COPY_QUALITY_PERFECT:
</span><span class="lines">@@ -3106,8 +3132,8 @@
</span><span class="cx">         break;
</span><span class="cx">     case T30_EOP:
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, msg[2] &amp; 0xFE);
-        s-&gt;next_rx_step = msg[2] &amp; 0xFE;
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
+        s-&gt;next_rx_step = fcf;
</ins><span class="cx">         queue_phase(s, T30_PHASE_D_TX);
</span><span class="cx">         switch (copy_quality(s))
</span><span class="cx">         {
</span><span class="lines">@@ -3137,10 +3163,10 @@
</span><span class="cx">     case T30_PRI_EOP:
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><span class="cx">         {
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, msg[2] &amp; 0xFE);
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">             s-&gt;timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
</span><span class="cx">         }
</span><del>-        s-&gt;next_rx_step = msg[2] &amp; 0xFE;
</del><ins>+        s-&gt;next_rx_step = fcf;
</ins><span class="cx">         switch (copy_quality(s))
</span><span class="cx">         {
</span><span class="cx">         case T30_COPY_QUALITY_PERFECT:
</span><span class="lines">@@ -3175,6 +3201,7 @@
</span><span class="cx">         break;
</span><span class="cx">     default:
</span><span class="cx">         /* We don't know what to do with this. */
</span><ins>+        s-&gt;current_status = T30_ERR_RX_INVALCMD;
</ins><span class="cx">         unexpected_final_frame(s, msg, len);
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="lines">@@ -3183,10 +3210,12 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_f_doc_and_post_doc_ecm(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><ins>+    uint8_t fcf;
</ins><span class="cx">     uint8_t fcf2;
</span><span class="cx">     
</span><span class="cx">     /* This actually handles 2 states - _DOC_ECM and _POST_DOC_ECM - as they are very similar */
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_DIS:
</span><span class="cx">         process_rx_dis_dtc(s, msg, len);
</span><span class="lines">@@ -3267,6 +3296,7 @@
</span><span class="cx">         break;
</span><span class="cx">     default:
</span><span class="cx">         /* We don't know what to do with this. */
</span><ins>+        s-&gt;current_status = T30_ERR_RX_INVALCMD;
</ins><span class="cx">         unexpected_final_frame(s, msg, len);
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="lines">@@ -3275,7 +3305,10 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_f_post_rcp_mcf(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    uint8_t fcf;
+
+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_CRP:
</span><span class="cx">         repeat_last_command(s);
</span><span class="lines">@@ -3296,7 +3329,10 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_f_post_rcp_ppr(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    uint8_t fcf;
+
+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_CRP:
</span><span class="cx">         repeat_last_command(s);
</span><span class="lines">@@ -3314,7 +3350,10 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_f_post_rcp_rnr(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    uint8_t fcf;
+
+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_RR:
</span><span class="cx">         if (s-&gt;receiver_not_ready_count &gt; 0)
</span><span class="lines">@@ -3345,7 +3384,10 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_r(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    uint8_t fcf;
+
+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_DIS:
</span><span class="cx">         process_rx_dis_dtc(s, msg, len);
</span><span class="lines">@@ -3374,7 +3416,10 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_t(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    uint8_t fcf;
+
+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_DIS:
</span><span class="cx">         process_rx_dis_dtc(s, msg, len);
</span><span class="lines">@@ -3400,7 +3445,10 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_i(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    uint8_t fcf;
+
+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_CRP:
</span><span class="cx">         repeat_last_command(s);
</span><span class="lines">@@ -3418,7 +3466,10 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_ii(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    uint8_t fcf;
+
+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_CRP:
</span><span class="cx">         repeat_last_command(s);
</span><span class="lines">@@ -3437,8 +3488,10 @@
</span><span class="cx"> static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><span class="cx">     t4_stats_t stats;
</span><ins>+    uint8_t fcf;
</ins><span class="cx"> 
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_MCF:
</span><span class="cx">         switch (s-&gt;next_tx_step)
</span><span class="lines">@@ -3447,7 +3500,8 @@
</span><span class="cx">         case T30_PRI_MPS:
</span><span class="cx">             tx_end_page(s);
</span><span class="cx">             if (s-&gt;phase_d_handler)
</span><del>-                s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_MCF);
</del><ins>+                s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
+            /* Transmit the next page */
</ins><span class="cx">             if (tx_start_page(s))
</span><span class="cx">             {
</span><span class="cx">                 /* TODO: recover */
</span><span class="lines">@@ -3461,7 +3515,7 @@
</span><span class="cx">         case T30_EOS:
</span><span class="cx">             tx_end_page(s);
</span><span class="cx">             if (s-&gt;phase_d_handler)
</span><del>-                s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_MCF);
</del><ins>+                s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">             t4_tx_release(&amp;(s-&gt;t4));
</span><span class="cx">             s-&gt;operation_in_progress = OPERATION_IN_PROGRESS_NONE;
</span><span class="cx">             if (span_log_test(&amp;s-&gt;logging, SPAN_LOG_FLOW))
</span><span class="lines">@@ -3475,7 +3529,7 @@
</span><span class="cx">         case T30_PRI_EOP:
</span><span class="cx">             tx_end_page(s);
</span><span class="cx">             if (s-&gt;phase_d_handler)
</span><del>-                s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_MCF);
</del><ins>+                s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">             t4_tx_release(&amp;(s-&gt;t4));
</span><span class="cx">             s-&gt;operation_in_progress = OPERATION_IN_PROGRESS_NONE;
</span><span class="cx">             send_dcn(s);
</span><span class="lines">@@ -3488,13 +3542,16 @@
</span><span class="cx">         }
</span><span class="cx">         break;
</span><span class="cx">     case T30_RTP:
</span><ins>+#if 0
+        s-&gt;rtp_events++;
+#endif
</ins><span class="cx">         switch (s-&gt;next_tx_step)
</span><span class="cx">         {
</span><span class="cx">         case T30_MPS:
</span><span class="cx">         case T30_PRI_MPS:
</span><span class="cx">             tx_end_page(s);
</span><span class="cx">             if (s-&gt;phase_d_handler)
</span><del>-                s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_RTP);
</del><ins>+                s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">             if (tx_start_page(s))
</span><span class="cx">             {
</span><span class="cx">                 /* TODO: recover */
</span><span class="lines">@@ -3517,7 +3574,7 @@
</span><span class="cx">         case T30_EOS:
</span><span class="cx">             tx_end_page(s);
</span><span class="cx">             if (s-&gt;phase_d_handler)
</span><del>-                s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_RTP);
</del><ins>+                s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">             t4_tx_release(&amp;(s-&gt;t4));
</span><span class="cx">             /* TODO: should go back to T, and resend */
</span><span class="cx">             return_to_phase_b(s, TRUE);
</span><span class="lines">@@ -3526,22 +3583,35 @@
</span><span class="cx">         case T30_PRI_EOP:
</span><span class="cx">             tx_end_page(s);
</span><span class="cx">             if (s-&gt;phase_d_handler)
</span><del>-                s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_RTP);
</del><ins>+                s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">             t4_tx_release(&amp;(s-&gt;t4));
</span><del>-            s-&gt;current_status = T30_ERR_TX_INVALRSP;
</del><span class="cx">             send_dcn(s);
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         break;
</span><span class="cx">     case T30_RTN:
</span><ins>+#if 0
+        s-&gt;rtn_events++;
+#endif
</ins><span class="cx">         switch (s-&gt;next_tx_step)
</span><span class="cx">         {
</span><span class="cx">         case T30_MPS:
</span><span class="cx">         case T30_PRI_MPS:
</span><span class="cx">             s-&gt;retries = 0;
</span><span class="cx">             if (s-&gt;phase_d_handler)
</span><del>-                s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_RTN);
-            /* Send fresh training, and then repeat the last page */
</del><ins>+                s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
+#if 0
+            if (!s-&gt;retransmit_capable)
+#endif
+            {
+                /* Send the next page, regardless of the problem with the current one. */
+                if (tx_start_page(s))
+                {
+                    /* TODO: recover */
+                    break;
+                }
+            }
+            /* Send fresh training */
</ins><span class="cx">             if (step_fallback_entry(s) &lt; 0)
</span><span class="cx">             {
</span><span class="cx">                 /* We have fallen back as far as we can go. Give up. */
</span><span class="lines">@@ -3558,17 +3628,43 @@
</span><span class="cx">         case T30_EOS:
</span><span class="cx">             s-&gt;retries = 0;
</span><span class="cx">             if (s-&gt;phase_d_handler)
</span><del>-                s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_RTN);
-            s-&gt;current_status = T30_ERR_TX_INVALRSP;
-            return_to_phase_b(s, TRUE);
</del><ins>+                s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
+#if 0
+            if (s-&gt;retransmit_capable)
+            {
+                /* Wait for DIS */
+            }
+            else
+#endif
+            {
+                return_to_phase_b(s, TRUE);
+            }
</ins><span class="cx">             break;
</span><span class="cx">         case T30_EOP:
</span><span class="cx">         case T30_PRI_EOP:
</span><span class="cx">             s-&gt;retries = 0;
</span><span class="cx">             if (s-&gt;phase_d_handler)
</span><del>-                s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_RTN);
-            s-&gt;current_status = T30_ERR_TX_INVALRSP;
-            send_dcn(s);
</del><ins>+                s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
+#if 0
+            if (s-&gt;retransmit_capable)
+            {
+                /* Send fresh training, and then repeat the last page */
+                if (step_fallback_entry(s) &lt; 0)
+                {
+                    /* We have fallen back as far as we can go. Give up. */
+                    s-&gt;current_fallback = 0;
+                    s-&gt;current_status = T30_ERR_CANNOT_TRAIN;
+                    send_dcn(s);
+                    break;
+                }
+                queue_phase(s, T30_PHASE_B_TX);
+                restart_sending_document(s);
+            }
+            else
+#endif
+            {
+                send_dcn(s);
+            }
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         break;
</span><span class="lines">@@ -3576,7 +3672,7 @@
</span><span class="cx">         s-&gt;retries = 0;
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><span class="cx">         {
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_PIP);
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">             s-&gt;timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
</span><span class="cx">         }
</span><span class="cx">         break;
</span><span class="lines">@@ -3584,7 +3680,7 @@
</span><span class="cx">         s-&gt;retries = 0;
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><span class="cx">         {
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_PIN);
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">             s-&gt;timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
</span><span class="cx">         }
</span><span class="cx">         break;
</span><span class="lines">@@ -3613,6 +3709,7 @@
</span><span class="cx">         break;
</span><span class="cx">     default:
</span><span class="cx">         /* We don't know what to do with this. */
</span><ins>+        s-&gt;current_status = T30_ERR_TX_INVALRSP;
</ins><span class="cx">         unexpected_final_frame(s, msg, len);
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="lines">@@ -3621,7 +3718,10 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_iii_q_mcf(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    uint8_t fcf;
+
+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_EOP:
</span><span class="cx">     case T30_EOM:
</span><span class="lines">@@ -3655,7 +3755,10 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_iii_q_rtp(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    uint8_t fcf;
+
+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_EOP:
</span><span class="cx">     case T30_EOM:
</span><span class="lines">@@ -3686,7 +3789,10 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_iii_q_rtn(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    uint8_t fcf;
+
+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_EOP:
</span><span class="cx">     case T30_EOM:
</span><span class="lines">@@ -3721,7 +3827,10 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_iv(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    uint8_t fcf;
+
+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_CRP:
</span><span class="cx">         repeat_last_command(s);
</span><span class="lines">@@ -3740,8 +3849,10 @@
</span><span class="cx"> static void process_state_iv_pps_null(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><span class="cx">     t4_stats_t stats;
</span><ins>+    uint8_t fcf;
</ins><span class="cx"> 
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_MCF:
</span><span class="cx">         s-&gt;retries = 0;
</span><span class="lines">@@ -3765,7 +3876,7 @@
</span><span class="cx">             case T30_PRI_MPS:
</span><span class="cx">                 tx_end_page(s);
</span><span class="cx">                 if (s-&gt;phase_d_handler)
</span><del>-                    s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_MCF);
</del><ins>+                    s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">                 if (tx_start_page(s))
</span><span class="cx">                 {
</span><span class="cx">                     /* TODO: recover */
</span><span class="lines">@@ -3783,7 +3894,7 @@
</span><span class="cx">             case T30_EOS:
</span><span class="cx">                 tx_end_page(s);
</span><span class="cx">                 if (s-&gt;phase_d_handler)
</span><del>-                    s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_MCF);
</del><ins>+                    s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">                 t4_tx_release(&amp;(s-&gt;t4));
</span><span class="cx">                 s-&gt;operation_in_progress = OPERATION_IN_PROGRESS_NONE;
</span><span class="cx">                 if (span_log_test(&amp;s-&gt;logging, SPAN_LOG_FLOW))
</span><span class="lines">@@ -3797,7 +3908,7 @@
</span><span class="cx">             case T30_PRI_EOP:
</span><span class="cx">                 tx_end_page(s);
</span><span class="cx">                 if (s-&gt;phase_d_handler)
</span><del>-                    s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_MCF);
</del><ins>+                    s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">                 t4_tx_release(&amp;(s-&gt;t4));
</span><span class="cx">                 s-&gt;operation_in_progress = OPERATION_IN_PROGRESS_NONE;
</span><span class="cx">                 send_dcn(s);
</span><span class="lines">@@ -3842,8 +3953,10 @@
</span><span class="cx"> static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><span class="cx">     t4_stats_t stats;
</span><ins>+    uint8_t fcf;
</ins><span class="cx"> 
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_MCF:
</span><span class="cx">         s-&gt;retries = 0;
</span><span class="lines">@@ -3867,7 +3980,7 @@
</span><span class="cx">             case T30_PRI_MPS:
</span><span class="cx">                 tx_end_page(s);
</span><span class="cx">                 if (s-&gt;phase_d_handler)
</span><del>-                    s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_MCF);
</del><ins>+                    s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">                 if (tx_start_page(s))
</span><span class="cx">                 {
</span><span class="cx">                     /* TODO: recover */
</span><span class="lines">@@ -3885,7 +3998,7 @@
</span><span class="cx">             case T30_EOS:
</span><span class="cx">                 tx_end_page(s);
</span><span class="cx">                 if (s-&gt;phase_d_handler)
</span><del>-                    s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_MCF);
</del><ins>+                    s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">                 t4_tx_release(&amp;(s-&gt;t4));
</span><span class="cx">                 s-&gt;operation_in_progress = OPERATION_IN_PROGRESS_NONE;
</span><span class="cx">                 if (span_log_test(&amp;s-&gt;logging, SPAN_LOG_FLOW))
</span><span class="lines">@@ -3899,7 +4012,7 @@
</span><span class="cx">             case T30_PRI_EOP:
</span><span class="cx">                 tx_end_page(s);
</span><span class="cx">                 if (s-&gt;phase_d_handler)
</span><del>-                    s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_MCF);
</del><ins>+                    s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">                 t4_tx_release(&amp;(s-&gt;t4));
</span><span class="cx">                 s-&gt;operation_in_progress = OPERATION_IN_PROGRESS_NONE;
</span><span class="cx">                 send_dcn(s);
</span><span class="lines">@@ -3923,7 +4036,7 @@
</span><span class="cx">         s-&gt;retries = 0;
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><span class="cx">         {
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_PIP);
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">             s-&gt;timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
</span><span class="cx">         }
</span><span class="cx">         break;
</span><span class="lines">@@ -3931,7 +4044,7 @@
</span><span class="cx">         s-&gt;retries = 0;
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><span class="cx">         {
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_PIN);
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">             s-&gt;timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
</span><span class="cx">         }
</span><span class="cx">         break;
</span><span class="lines">@@ -3960,8 +4073,10 @@
</span><span class="cx"> static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><span class="cx">     t4_stats_t stats;
</span><ins>+    uint8_t fcf;
</ins><span class="cx"> 
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_MCF:
</span><span class="cx">         s-&gt;retries = 0;
</span><span class="lines">@@ -3985,7 +4100,7 @@
</span><span class="cx">             case T30_PRI_MPS:
</span><span class="cx">                 tx_end_page(s);
</span><span class="cx">                 if (s-&gt;phase_d_handler)
</span><del>-                    s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_MCF);
</del><ins>+                    s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">                 if (tx_start_page(s))
</span><span class="cx">                 {
</span><span class="cx">                     /* TODO: recover */
</span><span class="lines">@@ -4003,7 +4118,7 @@
</span><span class="cx">             case T30_EOS:
</span><span class="cx">                 tx_end_page(s);
</span><span class="cx">                 if (s-&gt;phase_d_handler)
</span><del>-                    s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_MCF);
</del><ins>+                    s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">                 t4_tx_release(&amp;(s-&gt;t4));
</span><span class="cx">                 s-&gt;operation_in_progress = OPERATION_IN_PROGRESS_NONE;
</span><span class="cx">                 if (span_log_test(&amp;s-&gt;logging, SPAN_LOG_FLOW))
</span><span class="lines">@@ -4017,7 +4132,7 @@
</span><span class="cx">             case T30_PRI_EOP:
</span><span class="cx">                 tx_end_page(s);
</span><span class="cx">                 if (s-&gt;phase_d_handler)
</span><del>-                    s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_MCF);
</del><ins>+                    s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">                 t4_tx_release(&amp;(s-&gt;t4));
</span><span class="cx">                 s-&gt;operation_in_progress = OPERATION_IN_PROGRESS_NONE;
</span><span class="cx">                 send_dcn(s);
</span><span class="lines">@@ -4041,7 +4156,7 @@
</span><span class="cx">         s-&gt;retries = 0;
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><span class="cx">         {
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_PIP);
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">             s-&gt;timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
</span><span class="cx">         }
</span><span class="cx">         break;
</span><span class="lines">@@ -4049,7 +4164,7 @@
</span><span class="cx">         s-&gt;retries = 0;
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><span class="cx">         {
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_PIN);
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">             s-&gt;timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
</span><span class="cx">         }
</span><span class="cx">         break;
</span><span class="lines">@@ -4073,7 +4188,10 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_iv_ctc(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    uint8_t fcf;
+
+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_CTR:
</span><span class="cx">         /* Valid response to a CTC received */
</span><span class="lines">@@ -4100,7 +4218,10 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_iv_eor(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    uint8_t fcf;
+
+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_RNR:
</span><span class="cx">         if (s-&gt;timer_t5 == 0)
</span><span class="lines">@@ -4113,7 +4234,7 @@
</span><span class="cx">         s-&gt;retries = 0;
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><span class="cx">         {
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_PIN);
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">             s-&gt;timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
</span><span class="cx">         }
</span><span class="cx">         break;
</span><span class="lines">@@ -4138,7 +4259,10 @@
</span><span class="cx"> 
</span><span class="cx"> static void process_state_iv_eor_rnr(t30_state_t *s, const uint8_t *msg, int len)
</span><span class="cx"> {
</span><del>-    switch (msg[2] &amp; 0xFE)
</del><ins>+    uint8_t fcf;
+
+    fcf = msg[2] &amp; 0xFE;
+    switch (fcf)
</ins><span class="cx">     {
</span><span class="cx">     case T30_RNR:
</span><span class="cx">         if (s-&gt;timer_t5 == 0)
</span><span class="lines">@@ -4151,7 +4275,7 @@
</span><span class="cx">         s-&gt;retries = 0;
</span><span class="cx">         if (s-&gt;phase_d_handler)
</span><span class="cx">         {
</span><del>-            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, T30_PIN);
</del><ins>+            s-&gt;phase_d_handler(s, s-&gt;phase_d_user_data, fcf);
</ins><span class="cx">             s-&gt;timer_t3 = ms_to_samples(DEFAULT_TIMER_T3);
</span><span class="cx">         }
</span><span class="cx">         break;
</span><span class="lines">@@ -4257,7 +4381,7 @@
</span><span class="cx">             }
</span><span class="cx">             else
</span><span class="cx">             {
</span><del>-                unexpected_frame(s, msg, len);
</del><ins>+                unexpected_non_final_frame(s, msg, len);
</ins><span class="cx">             }
</span><span class="cx">             break;
</span><span class="cx">         case (T30_SEP &amp; 0xFE):
</span><span class="lines">@@ -4269,7 +4393,7 @@
</span><span class="cx">             }
</span><span class="cx">             else
</span><span class="cx">             {
</span><del>-                unexpected_frame(s, msg, len);
</del><ins>+                unexpected_non_final_frame(s, msg, len);
</ins><span class="cx">             }
</span><span class="cx">             break;
</span><span class="cx">         case (T30_PSA &amp; 0xFE):
</span><span class="lines">@@ -4280,7 +4404,7 @@
</span><span class="cx">             }
</span><span class="cx">             else
</span><span class="cx">             {
</span><del>-                unexpected_frame(s, msg, len);
</del><ins>+                unexpected_non_final_frame(s, msg, len);
</ins><span class="cx">             }
</span><span class="cx">             break;
</span><span class="cx">         case (T30_CIA &amp; 0xFE):
</span><span class="lines">@@ -4291,7 +4415,7 @@
</span><span class="cx">             }
</span><span class="cx">             else
</span><span class="cx">             {
</span><del>-                unexpected_frame(s, msg, len);
</del><ins>+                unexpected_non_final_frame(s, msg, len);
</ins><span class="cx">             }
</span><span class="cx">             break;
</span><span class="cx">         case (T30_ISP &amp; 0xFE):
</span><span class="lines">@@ -4302,7 +4426,7 @@
</span><span class="cx">             }
</span><span class="cx">             else
</span><span class="cx">             {
</span><del>-                unexpected_frame(s, msg, len);
</del><ins>+                unexpected_non_final_frame(s, msg, len);
</ins><span class="cx">             }
</span><span class="cx">             break;
</span><span class="cx">         case (T30_TSI &amp; 0xFE):
</span><span class="lines">@@ -5956,8 +6080,8 @@
</span><span class="cx">     t-&gt;error_correcting_mode = s-&gt;error_correcting_mode;
</span><span class="cx">     t-&gt;error_correcting_mode_retries = s-&gt;error_correcting_mode_retries;
</span><span class="cx">     t4_get_transfer_statistics(&amp;s-&gt;t4, &amp;stats);
</span><del>-    t-&gt;pages_tx = s-&gt;ecm_tx_page;
-    t-&gt;pages_rx = s-&gt;ecm_rx_page;
</del><ins>+    t-&gt;pages_tx = s-&gt;tx_page_number;
+    t-&gt;pages_rx = s-&gt;rx_page_number;
</ins><span class="cx">     t-&gt;pages_in_file = stats.pages_in_file;
</span><span class="cx">     t-&gt;width = stats.width;
</span><span class="cx">     t-&gt;length = stats.length;
</span><span class="lines">@@ -5968,6 +6092,10 @@
</span><span class="cx">     t-&gt;encoding = stats.encoding;
</span><span class="cx">     t-&gt;image_size = stats.line_image_size;
</span><span class="cx">     t-&gt;current_status = s-&gt;current_status;
</span><ins>+#if 0
+    t-&gt;rtn_events = s-&gt;rtn_events;
+    t-&gt;rtp_events = s-&gt;rtp_events;
+#endif
</ins><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><span class="lines">@@ -6000,9 +6128,13 @@
</span><span class="cx">     t30_build_dis_or_dtc(s);
</span><span class="cx">     memset(&amp;s-&gt;rx_info, 0, sizeof(s-&gt;rx_info));
</span><span class="cx">     release_resources(s);
</span><del>-    /* The ECM page number is only reset at call establishment */
-    s-&gt;ecm_rx_page = 0;
-    s-&gt;ecm_tx_page = 0;
</del><ins>+    /* The page number is only reset at call establishment */
+    s-&gt;rx_page_number = 0;
+    s-&gt;tx_page_number = 0;
+#if 0
+    s-&gt;rtn_events = 0;
+    s-&gt;rtp_events = 0;
+#endif
</ins><span class="cx">     s-&gt;far_end_detected = FALSE;
</span><span class="cx">     s-&gt;timer_t0_t1 = ms_to_samples(DEFAULT_TIMER_T0);
</span><span class="cx">     if (s-&gt;calling_party)
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrct31c"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/t31.c (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/t31.c        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/t31.c        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: t31.c,v 1.151 2009/07/14 13:54:22 steveu Exp $
</del><ins>+ * $Id: t31.c,v 1.152 2009/09/04 14:38:46 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -176,12 +176,15 @@
</span><span class="cx"> 
</span><span class="cx"> static int restart_modem(t31_state_t *s, int new_modem);
</span><span class="cx"> static void hdlc_accept_frame(void *user_data, const uint8_t *msg, int len, int ok);
</span><del>-static void set_rx_handler(t31_state_t *s, span_rx_handler_t *handler, void *user_data);
</del><ins>+static void set_rx_handler(t31_state_t *s, span_rx_handler_t *rx_handler, span_rx_fillin_handler_t *fillin_handler, void *user_data);
</ins><span class="cx"> static void set_tx_handler(t31_state_t *s, span_tx_handler_t *handler, void *user_data);
</span><span class="cx"> static void set_next_tx_handler(t31_state_t *s, span_tx_handler_t *handler, void *user_data);
</span><span class="cx"> static int v17_v21_rx(void *user_data, const int16_t amp[], int len);
</span><ins>+static int v17_v21_rx_fillin(void *user_data, int len);
</ins><span class="cx"> static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len);
</span><ins>+static int v27ter_v21_rx_fillin(void *user_data, int len);
</ins><span class="cx"> static int v29_v21_rx(void *user_data, const int16_t amp[], int len);
</span><ins>+static int v29_v21_rx_fillin(void *user_data, int len);
</ins><span class="cx"> static int silence_rx(void *user_data, const int16_t amp[], int len);
</span><span class="cx"> static int cng_rx(void *user_data, const int16_t amp[], int len);
</span><span class="cx"> static void non_ecm_put_bit(void *user_data, int bit);
</span><span class="lines">@@ -1527,7 +1530,7 @@
</span><span class="cx">     s-&gt;at_state.rx_signal_present = FALSE;
</span><span class="cx">     s-&gt;at_state.rx_trained = FALSE;
</span><span class="cx">     s-&gt;rx_frame_received = FALSE;
</span><del>-    set_rx_handler(s, (span_rx_handler_t *) &amp;span_dummy_rx, NULL);
</del><ins>+    set_rx_handler(s, (span_rx_handler_t *) &amp;span_dummy_rx, (span_rx_fillin_handler_t *) &amp;span_dummy_rx_fillin, NULL);
</ins><span class="cx">     use_hdlc = FALSE;
</span><span class="cx">     switch (s-&gt;modem)
</span><span class="cx">     {
</span><span class="lines">@@ -1546,7 +1549,7 @@
</span><span class="cx">             /* Do V.21/HDLC receive in parallel. The other end may send its
</span><span class="cx">                first message at any time. The CNG tone will continue until
</span><span class="cx">                we get a valid preamble. */
</span><del>-            set_rx_handler(s, (span_rx_handler_t *) &amp;cng_rx, s);
</del><ins>+            set_rx_handler(s, (span_rx_handler_t *) &amp;cng_rx, (span_rx_fillin_handler_t *) &amp;span_dummy_rx_fillin, s);
</ins><span class="cx">             t31_v21_rx(s);
</span><span class="cx">             set_tx_handler(s, (span_tx_handler_t *) &amp;modem_connect_tones_tx, &amp;t-&gt;connect_tx);
</span><span class="cx">             set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
</span><span class="lines">@@ -1559,7 +1562,7 @@
</span><span class="cx">         }
</span><span class="cx">         else
</span><span class="cx">         {
</span><del>-            set_rx_handler(s, (span_rx_handler_t *) &amp;cng_rx, s);
</del><ins>+            set_rx_handler(s, (span_rx_handler_t *) &amp;cng_rx, (span_rx_fillin_handler_t *) &amp;span_dummy_rx_fillin, s);
</ins><span class="cx">             t31_v21_rx(s);
</span><span class="cx">             silence_gen_set(&amp;t-&gt;silence_gen, 0);
</span><span class="cx">             set_tx_handler(s, (span_tx_handler_t *) &amp;silence_gen, &amp;t-&gt;silence_gen);
</span><span class="lines">@@ -1610,7 +1613,7 @@
</span><span class="cx">         }
</span><span class="cx">         else
</span><span class="cx">         {
</span><del>-            set_rx_handler(s, (span_rx_handler_t *) &amp;fsk_rx, &amp;t-&gt;v21_rx);
</del><ins>+            set_rx_handler(s, (span_rx_handler_t *) &amp;fsk_rx, (span_rx_fillin_handler_t *) &amp;fsk_rx_fillin, &amp;t-&gt;v21_rx);
</ins><span class="cx">             t31_v21_rx(s);
</span><span class="cx">         }
</span><span class="cx">         break;
</span><span class="lines">@@ -1652,7 +1655,7 @@
</span><span class="cx">     case FAX_MODEM_V17_RX:
</span><span class="cx">         if (!s-&gt;t38_mode)
</span><span class="cx">         {
</span><del>-            set_rx_handler(s, (span_rx_handler_t *) &amp;v17_v21_rx, s);
</del><ins>+            set_rx_handler(s, (span_rx_handler_t *) &amp;v17_v21_rx, (span_rx_fillin_handler_t *) &amp;v17_v21_rx_fillin, s);
</ins><span class="cx">             v17_rx_restart(&amp;t-&gt;v17_rx, s-&gt;bit_rate, s-&gt;short_train);
</span><span class="cx">             /* Allow for +FCERROR/+FRH:3 */
</span><span class="cx">             t31_v21_rx(s);
</span><span class="lines">@@ -1689,7 +1692,7 @@
</span><span class="cx">     case FAX_MODEM_V27TER_RX:
</span><span class="cx">         if (!s-&gt;t38_mode)
</span><span class="cx">         {
</span><del>-            set_rx_handler(s, (span_rx_handler_t *) &amp;v27ter_v21_rx, s);
</del><ins>+            set_rx_handler(s, (span_rx_handler_t *) &amp;v27ter_v21_rx, (span_rx_fillin_handler_t *) &amp;v27ter_v21_rx_fillin, s);
</ins><span class="cx">             v27ter_rx_restart(&amp;t-&gt;v27ter_rx, s-&gt;bit_rate, FALSE);
</span><span class="cx">             /* Allow for +FCERROR/+FRH:3 */
</span><span class="cx">             t31_v21_rx(s);
</span><span class="lines">@@ -1726,7 +1729,7 @@
</span><span class="cx">     case FAX_MODEM_V29_RX:
</span><span class="cx">         if (!s-&gt;t38_mode)
</span><span class="cx">         {
</span><del>-            set_rx_handler(s, (span_rx_handler_t *) &amp;v29_v21_rx, s);
</del><ins>+            set_rx_handler(s, (span_rx_handler_t *) &amp;v29_v21_rx, (span_rx_fillin_handler_t *) &amp;v29_v21_rx_fillin, s);
</ins><span class="cx">             v29_rx_restart(&amp;t-&gt;v29_rx, s-&gt;bit_rate, FALSE);
</span><span class="cx">             /* Allow for +FCERROR/+FRH:3 */
</span><span class="cx">             t31_v21_rx(s);
</span><span class="lines">@@ -1752,7 +1755,7 @@
</span><span class="cx">     case FAX_MODEM_SILENCE_RX:
</span><span class="cx">         if (!s-&gt;t38_mode)
</span><span class="cx">         {
</span><del>-            set_rx_handler(s, (span_rx_handler_t *) &amp;silence_rx, s);
</del><ins>+            set_rx_handler(s, (span_rx_handler_t *) &amp;silence_rx, (span_rx_fillin_handler_t *) &amp;span_dummy_rx_fillin, s);
</ins><span class="cx">             silence_gen_set(&amp;t-&gt;silence_gen, 0);
</span><span class="cx">             set_tx_handler(s, (span_tx_handler_t *) &amp;silence_gen, &amp;t-&gt;silence_gen);
</span><span class="cx">             set_next_tx_handler(s, (span_tx_handler_t *) NULL, NULL);
</span><span class="lines">@@ -2113,7 +2116,7 @@
</span><span class="cx">             s-&gt;at_state.rx_data_bytes = 0;
</span><span class="cx">             s-&gt;at_state.transmit = FALSE;
</span><span class="cx">             s-&gt;modem = FAX_MODEM_SILENCE_TX;
</span><del>-            set_rx_handler(s, (span_rx_handler_t *) &amp;span_dummy_rx, NULL);
</del><ins>+            set_rx_handler(s, (span_rx_handler_t *) &amp;span_dummy_rx, (span_rx_fillin_handler_t *) &amp;span_dummy_rx_fillin, NULL);
</ins><span class="cx">             t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
</span><span class="cx">             at_put_response_code(&amp;s-&gt;at_state, AT_RESPONSE_CODE_OK);
</span><span class="cx">         }
</span><span class="lines">@@ -2136,9 +2139,13 @@
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><del>-static void set_rx_handler(t31_state_t *s, span_rx_handler_t *handler, void *user_data)
</del><ins>+static void set_rx_handler(t31_state_t *s,
+                           span_rx_handler_t *rx_handler,
+                           span_rx_fillin_handler_t *fillin_handler,
+                           void *user_data)
</ins><span class="cx"> {
</span><del>-    s-&gt;audio.modems.rx_handler = handler;
</del><ins>+    s-&gt;audio.modems.rx_handler = rx_handler;
+    s-&gt;audio.modems.rx_fillin_handler = fillin_handler;
</ins><span class="cx">     s-&gt;audio.modems.rx_user_data = user_data;
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="lines">@@ -2208,7 +2215,7 @@
</span><span class="cx">         /* The fast modem has trained, so we no longer need to run the slow
</span><span class="cx">            one in parallel. */
</span><span class="cx">         span_log(&amp;t-&gt;logging, SPAN_LOG_FLOW, &quot;Switching from V.17 + V.21 to V.17 (%.2fdBm0)\n&quot;, v17_rx_signal_power(&amp;s-&gt;v17_rx));
</span><del>-        set_rx_handler(t, (span_rx_handler_t *) &amp;v17_rx, &amp;s-&gt;v17_rx);
</del><ins>+        set_rx_handler(t, (span_rx_handler_t *) &amp;v17_rx, (span_rx_fillin_handler_t *) &amp;v17_rx_fillin, &amp;s-&gt;v17_rx);
</ins><span class="cx">     }
</span><span class="cx">     else
</span><span class="cx">     {
</span><span class="lines">@@ -2218,13 +2225,26 @@
</span><span class="cx">             /* We have received something, and the fast modem has not trained. We must
</span><span class="cx">                be receiving valid V.21 */
</span><span class="cx">             span_log(&amp;t-&gt;logging, SPAN_LOG_FLOW, &quot;Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n&quot;, fsk_rx_signal_power(&amp;s-&gt;v21_rx));
</span><del>-            set_rx_handler(t, (span_rx_handler_t *) &amp;fsk_rx, &amp;s-&gt;v21_rx);
</del><ins>+            set_rx_handler(t, (span_rx_handler_t *) &amp;fsk_rx, (span_rx_fillin_handler_t *) &amp;fsk_rx_fillin, &amp;s-&gt;v21_rx);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     return len;
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><ins>+static int v17_v21_rx_fillin(void *user_data, int len)
+{
+    t31_state_t *t;
+    fax_modems_state_t *s;
+
+    t = (t31_state_t *) user_data;
+    s = &amp;t-&gt;audio.modems;
+    v17_rx_fillin(&amp;s-&gt;v17_rx, len);
+    fsk_rx_fillin(&amp;s-&gt;v21_rx, len);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
</ins><span class="cx"> static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len)
</span><span class="cx"> {
</span><span class="cx">     t31_state_t *t;
</span><span class="lines">@@ -2238,7 +2258,7 @@
</span><span class="cx">         /* The fast modem has trained, so we no longer need to run the slow
</span><span class="cx">            one in parallel. */
</span><span class="cx">         span_log(&amp;t-&gt;logging, SPAN_LOG_FLOW, &quot;Switching from V.27ter + V.21 to V.27ter (%.2fdBm0)\n&quot;, v27ter_rx_signal_power(&amp;s-&gt;v27ter_rx));
</span><del>-        set_rx_handler(t, (span_rx_handler_t *) &amp;v27ter_rx, &amp;s-&gt;v27ter_rx);
</del><ins>+        set_rx_handler(t, (span_rx_handler_t *) &amp;v27ter_rx, (span_rx_fillin_handler_t *) &amp;v27ter_rx_fillin, &amp;s-&gt;v27ter_rx);
</ins><span class="cx">     }
</span><span class="cx">     else
</span><span class="cx">     {
</span><span class="lines">@@ -2248,13 +2268,26 @@
</span><span class="cx">             /* We have received something, and the fast modem has not trained. We must
</span><span class="cx">                be receiving valid V.21 */
</span><span class="cx">             span_log(&amp;t-&gt;logging, SPAN_LOG_FLOW, &quot;Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n&quot;, fsk_rx_signal_power(&amp;s-&gt;v21_rx));
</span><del>-            set_rx_handler(t, (span_rx_handler_t *) &amp;fsk_rx, &amp;s-&gt;v21_rx);
</del><ins>+            set_rx_handler(t, (span_rx_handler_t *) &amp;fsk_rx, (span_rx_fillin_handler_t *) &amp;fsk_rx_fillin, &amp;s-&gt;v21_rx);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     return len;
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><ins>+static int v27ter_v21_rx_fillin(void *user_data, int len)
+{
+    t31_state_t *t;
+    fax_modems_state_t *s;
+
+    t = (t31_state_t *) user_data;
+    s = &amp;t-&gt;audio.modems;
+    v17_rx_fillin(&amp;s-&gt;v27ter_rx, len);
+    fsk_rx_fillin(&amp;s-&gt;v21_rx, len);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
</ins><span class="cx"> static int v29_v21_rx(void *user_data, const int16_t amp[], int len)
</span><span class="cx"> {
</span><span class="cx">     t31_state_t *t;
</span><span class="lines">@@ -2268,7 +2301,7 @@
</span><span class="cx">         /* The fast modem has trained, so we no longer need to run the slow
</span><span class="cx">            one in parallel. */
</span><span class="cx">         span_log(&amp;s-&gt;logging, SPAN_LOG_FLOW, &quot;Switching from V.29 + V.21 to V.29 (%.2fdBm0)\n&quot;, v29_rx_signal_power(&amp;s-&gt;v29_rx));
</span><del>-        set_rx_handler(t, (span_rx_handler_t *) &amp;v29_rx, &amp;s-&gt;v29_rx);
</del><ins>+        set_rx_handler(t, (span_rx_handler_t *) &amp;v29_rx, (span_rx_fillin_handler_t *) &amp;v29_rx_fillin, &amp;s-&gt;v29_rx);
</ins><span class="cx">     }
</span><span class="cx">     else
</span><span class="cx">     {
</span><span class="lines">@@ -2278,13 +2311,26 @@
</span><span class="cx">             /* We have received something, and the fast modem has not trained. We must
</span><span class="cx">                be receiving valid V.21 */
</span><span class="cx">             span_log(&amp;t-&gt;logging, SPAN_LOG_FLOW, &quot;Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n&quot;, fsk_rx_signal_power(&amp;s-&gt;v21_rx));
</span><del>-            set_rx_handler(t, (span_rx_handler_t *) &amp;fsk_rx, &amp;s-&gt;v21_rx);
</del><ins>+            set_rx_handler(t, (span_rx_handler_t *) &amp;fsk_rx, (span_rx_fillin_handler_t *) &amp;fsk_rx_fillin, &amp;s-&gt;v21_rx);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     return len;
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><ins>+static int v29_v21_rx_fillin(void *user_data, int len)
+{
+    t31_state_t *t;
+    fax_modems_state_t *s;
+
+    t = (t31_state_t *) user_data;
+    s = &amp;t-&gt;audio.modems;
+    v29_rx_fillin(&amp;s-&gt;v29_rx, len);
+    fsk_rx_fillin(&amp;s-&gt;v21_rx, len);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
</ins><span class="cx"> SPAN_DECLARE(int) t31_rx(t31_state_t *s, int16_t amp[], int len)
</span><span class="cx"> {
</span><span class="cx">     int i;
</span></span></pre></div>
<a id="freeswitchtrunklibsspandspsrct38_terminalc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/src/t38_terminal.c (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/src/t38_terminal.c        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/src/t38_terminal.c        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * License along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: t38_terminal.c,v 1.127 2009/07/14 13:54:22 steveu Exp $
</del><ins>+ * $Id: t38_terminal.c,v 1.128 2009/09/04 14:38:46 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -93,9 +93,9 @@
</span><span class="cx"> 
</span><span class="cx"> enum
</span><span class="cx"> {
</span><del>-    T38_CHUNKING_MERGE_FCS_WITH_DATA    = 0x0001,
-    T38_CHUNKING_WHOLE_FRAMES           = 0x0002,
-    T38_CHUNKING_ALLOW_TEP_TIME         = 0x0004
</del><ins>+    T38_CHUNKING_MERGE_FCS_WITH_DATA = 0x0001,
+    T38_CHUNKING_WHOLE_FRAMES = 0x0002,
+    T38_CHUNKING_ALLOW_TEP_TIME = 0x0004
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> enum
</span></span></pre></div>
<a id="freeswitchtrunklibsspandsptestsMakefileam"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/tests/Makefile.am (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/tests/Makefile.am        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/tests/Makefile.am        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -16,7 +16,7 @@
</span><span class="cx"> ## along with this program; if not, write to the Free Software
</span><span class="cx"> ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx"> ##
</span><del>-## $Id: Makefile.am,v 1.116 2009/05/30 15:23:13 steveu Exp $
</del><ins>+## $Id: Makefile.am,v 1.117 2009/09/22 13:11:04 steveu Exp $
</ins><span class="cx"> 
</span><span class="cx"> AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
</span><span class="cx"> AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
</span><span class="lines">@@ -99,6 +99,7 @@
</span><span class="cx">                     sig_tone_tests \
</span><span class="cx">                     super_tone_rx_tests \
</span><span class="cx">                     super_tone_tx_tests \
</span><ins>+                    swept_tone_tests \
</ins><span class="cx">                     t4_tests \
</span><span class="cx">                     t31_tests \
</span><span class="cx">                     t38_core_tests \
</span><span class="lines">@@ -273,6 +274,9 @@
</span><span class="cx"> super_tone_tx_tests_SOURCES = super_tone_tx_tests.c
</span><span class="cx"> super_tone_tx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
</span><span class="cx"> 
</span><ins>+swept_tone_tests_SOURCES = swept_tone_tests.c
+swept_tone_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
+
</ins><span class="cx"> t4_tests_SOURCES = t4_tests.c
</span><span class="cx"> t4_tests_LDADD = $(LIBDIR) -lspandsp
</span><span class="cx"> 
</span></span></pre></div>
<a id="freeswitchtrunklibsspandsptestsfax_decodec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/tests/fax_decode.c (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/tests/fax_decode.c        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/tests/fax_decode.c        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: fax_decode.c,v 1.56 2009/05/30 15:23:13 steveu Exp $
</del><ins>+ * $Id: fax_decode.c,v 1.57 2009/09/15 14:01:53 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \page fax_decode_page FAX decoder
</span><span class="lines">@@ -124,7 +124,7 @@
</span><span class="cx">     type = fr[2] &amp; 0xFE;
</span><span class="cx">     if (type == T30_DIS  ||  type == T30_DTC  ||  type == T30_DCS)
</span><span class="cx">         t30_decode_dis_dtc_dcs(&amp;t30_dummy, fr, frlen);
</span><del>-    if (type == T30_NSF)
</del><ins>+    if (type == T30_NSF  ||  type == T30_NSS  ||  type == T30_NSC)
</ins><span class="cx">     {
</span><span class="cx">         if (t35_decode(&amp;fr[3], frlen - 3, &amp;country, &amp;vendor, &amp;model))
</span><span class="cx">         {
</span></span></pre></div>
<a id="freeswitchtrunklibsspandsptestsline_model_testsc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/tests/line_model_tests.c (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/tests/line_model_tests.c        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/tests/line_model_tests.c        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: line_model_tests.c,v 1.27 2009/05/30 15:23:14 steveu Exp $
</del><ins>+ * $Id: line_model_tests.c,v 1.28 2009/09/23 16:02:59 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \page line_model_tests_page Telephony line model tests
</span><span class="lines">@@ -62,7 +62,7 @@
</span><span class="cx"> #define IN_FILE_NAME1       &quot;line_model_test_in1.wav&quot;
</span><span class="cx"> #define IN_FILE_NAME2       &quot;line_model_test_in2.wav&quot;
</span><span class="cx"> #define OUT_FILE_NAME1      &quot;line_model_one_way_test_out.wav&quot;
</span><del>-#define OUT_FILE_NAME       &quot;line_model_test_out.wav&quot;
</del><ins>+#define OUT_FILE_NAME2      &quot;line_model_two_way_test_out.wav&quot;
</ins><span class="cx"> 
</span><span class="cx"> int channel_codec;
</span><span class="cx"> int rbs_pattern;
</span><span class="lines">@@ -128,11 +128,18 @@
</span><span class="cx">     
</span><span class="cx">     awgn_init_dbm0(&amp;noise1, 1234567, -10.0f);
</span><span class="cx"> 
</span><del>-    if ((inhandle1 = sf_open_telephony_read(IN_FILE_NAME1, 1)) == NULL)
</del><ins>+    if (speech_test)
</ins><span class="cx">     {
</span><del>-        fprintf(stderr, &quot;    Cannot open audio file '%s'\n&quot;, IN_FILE_NAME1);
-        exit(2);
</del><ins>+        if ((inhandle1 = sf_open_telephony_read(IN_FILE_NAME1, 1)) == NULL)
+        {
+            fprintf(stderr, &quot;    Cannot open audio file '%s'\n&quot;, IN_FILE_NAME1);
+            exit(2);
+        }
</ins><span class="cx">     }
</span><ins>+    else
+    {
+        inhandle1 = NULL;
+    }
</ins><span class="cx">     if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME1, 1)) == NULL)
</span><span class="cx">     {
</span><span class="cx">         fprintf(stderr, &quot;    Cannot create audio file '%s'\n&quot;, OUT_FILE_NAME1);
</span><span class="lines">@@ -167,10 +174,13 @@
</span><span class="cx">             exit(2);
</span><span class="cx">         }
</span><span class="cx">     }
</span><del>-    if (sf_close(inhandle1))
</del><ins>+    if (speech_test)
</ins><span class="cx">     {
</span><del>-        fprintf(stderr, &quot;    Cannot close audio file '%s'\n&quot;, IN_FILE_NAME1);
-        exit(2);
</del><ins>+        if (sf_close(inhandle1))
+        {
+            fprintf(stderr, &quot;    Cannot close audio file '%s'\n&quot;, IN_FILE_NAME1);
+            exit(2);
+        }
</ins><span class="cx">     }
</span><span class="cx">     if (sf_close(outhandle))
</span><span class="cx">     {
</span><span class="lines">@@ -208,19 +218,27 @@
</span><span class="cx">     awgn_init_dbm0(&amp;noise1, 1234567, -10.0f);
</span><span class="cx">     awgn_init_dbm0(&amp;noise2, 1234567, -10.0f);
</span><span class="cx"> 
</span><del>-    if ((inhandle1 = sf_open_telephony_read(IN_FILE_NAME1, 1)) == NULL)
</del><ins>+    if (speech_test)
</ins><span class="cx">     {
</span><del>-        fprintf(stderr, &quot;    Cannot open audio file '%s'\n&quot;, IN_FILE_NAME1);
-        exit(2);
</del><ins>+        if ((inhandle1 = sf_open_telephony_read(IN_FILE_NAME1, 1)) == NULL)
+        {
+            fprintf(stderr, &quot;    Cannot open audio file '%s'\n&quot;, IN_FILE_NAME1);
+            exit(2);
+        }
+        if ((inhandle2 = sf_open_telephony_read(IN_FILE_NAME2, 1)) == NULL)
+        {
+            fprintf(stderr, &quot;    Cannot open audio file '%s'\n&quot;, IN_FILE_NAME2);
+            exit(2);
+        }
</ins><span class="cx">     }
</span><del>-    if ((inhandle2 = sf_open_telephony_read(IN_FILE_NAME2, 1)) == NULL)
</del><ins>+    else
</ins><span class="cx">     {
</span><del>-        fprintf(stderr, &quot;    Cannot open audio file '%s'\n&quot;, IN_FILE_NAME2);
-        exit(2);
</del><ins>+        inhandle1 =
+        inhandle2 = NULL;
</ins><span class="cx">     }
</span><del>-    if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 2)) == NULL)
</del><ins>+    if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME2, 2)) == NULL)
</ins><span class="cx">     {
</span><del>-        fprintf(stderr, &quot;    Cannot create audio file '%s'\n&quot;, OUT_FILE_NAME);
</del><ins>+        fprintf(stderr, &quot;    Cannot create audio file '%s'\n&quot;, OUT_FILE_NAME2);
</ins><span class="cx">         exit(2);
</span><span class="cx">     }
</span><span class="cx">     for (i = 0;  i &lt; 10000;  i++)
</span><span class="lines">@@ -261,25 +279,80 @@
</span><span class="cx">             exit(2);
</span><span class="cx">         }
</span><span class="cx">     }
</span><del>-    if (sf_close(inhandle1))
</del><ins>+    if (speech_test)
</ins><span class="cx">     {
</span><del>-        fprintf(stderr, &quot;    Cannot close audio file '%s'\n&quot;, IN_FILE_NAME1);
-        exit(2);
</del><ins>+        if (sf_close(inhandle1))
+        {
+            fprintf(stderr, &quot;    Cannot close audio file '%s'\n&quot;, IN_FILE_NAME1);
+            exit(2);
+        }
+        if (sf_close(inhandle2))
+        {
+            fprintf(stderr, &quot;    Cannot close audio file '%s'\n&quot;, IN_FILE_NAME2);
+            exit(2);
+        }
</ins><span class="cx">     }
</span><del>-    if (sf_close(inhandle2))
-    {
-        fprintf(stderr, &quot;    Cannot close audio file '%s'\n&quot;, IN_FILE_NAME2);
-        exit(2);
-    }
</del><span class="cx">     if (sf_close(outhandle))
</span><span class="cx">     {
</span><del>-        fprintf(stderr, &quot;    Cannot close audio file '%s'\n&quot;, OUT_FILE_NAME);
</del><ins>+        fprintf(stderr, &quot;    Cannot close audio file '%s'\n&quot;, OUT_FILE_NAME2);
</ins><span class="cx">         exit(2);
</span><span class="cx">     }
</span><span class="cx">     both_ways_line_model_release(model);
</span><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><ins>+static void test_line_filter(int line_model_no)
+{
+    float out;
+    double sumin;
+    double sumout;
+    int i;
+    int j;
+    int p;
+    int ptr;
+    int len;
+    swept_tone_state_t *s;
+    float filter[129];
+    int16_t buf[BLOCK_LEN];
+
+    s = swept_tone_init(NULL, 200.0f, 3900.0f, -10.0f, 120*SAMPLE_RATE, 0);
+    for (j = 0;  j &lt; 129;  j++)
+        filter[j] = 0.0f;
+    ptr = 0;
+    for (;;)
+    {
+        if ((len = swept_tone(s, buf, BLOCK_LEN)) &lt;= 0)
+            break;
+        sumin = 0.0;
+        sumout = 0.0;
+        for (i = 0;  i &lt; len;  i++)
+        {
+            /* Add the sample in the filter buffer */
+            p = ptr;
+            filter[p] = buf[i];
+            if (++p == 129)
+                p = 0;
+            ptr = p;
+    
+            /* Apply the filter */
+            out = 0.0f;
+            for (j = 0;  j &lt; 129;  j++)
+            {
+                out += line_models[line_model_no][128 - j]*filter[p];
+                if (++p &gt;= 129)
+                    p = 0;
+            }
+            sumin += buf[i]*buf[i];
+            sumout += out*out;
+        }
+        /*endfor*/
+        printf(&quot;%7.1f %f\n&quot;, swept_tone_current_frequency(s), 10.0*log10(sumout/sumin));
+    }
+    /*endfor*/
+    swept_tone_free(s);
+}
+/*- End of function --------------------------------------------------------*/
+
</ins><span class="cx"> int main(int argc, char *argv[])
</span><span class="cx"> {
</span><span class="cx">     int line_model_no;
</span><span class="lines">@@ -319,6 +392,7 @@
</span><span class="cx">     complexify_tests();
</span><span class="cx">     test_one_way_model(line_model_no, speech_test);
</span><span class="cx">     test_both_ways_model(line_model_no, speech_test);
</span><ins>+    test_line_filter(line_model_no);
</ins><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> /*- End of file ------------------------------------------------------------*/
</span></span></pre></div>
<a id="freeswitchtrunklibsspandsptestsregression_testssh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/tests/regression_tests.sh (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/tests/regression_tests.sh        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/tests/regression_tests.sh        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -17,7 +17,7 @@
</span><span class="cx"> # License along with this program; if not, write to the Free Software
</span><span class="cx"> # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx"> #
</span><del>-# $Id: regression_tests.sh,v 1.58 2009/05/19 14:47:02 steveu Exp $
</del><ins>+# $Id: regression_tests.sh,v 1.59 2009/09/22 13:28:18 steveu Exp $
</ins><span class="cx"> #
</span><span class="cx"> 
</span><span class="cx"> ITUTESTS_TIF=../test-data/itu/fax/itutests.tif
</span><span class="lines">@@ -468,6 +468,16 @@
</span><span class="cx"> #echo super_tone_tx_tests completed OK
</span><span class="cx"> echo super_tone_tx_tests not enabled
</span><span class="cx"> 
</span><ins>+#./swept_tone_tests &gt;$STDOUT_DEST 2&gt;$STDERR_DEST
+#RETVAL=$?
+#if [ $RETVAL != 0 ]
+#then
+#    echo swept_tone_tests failed!
+#    exit $RETVAL
+#fi
+#echo swept_tone_tests completed OK
+echo swept_tone_tests not enabled
+
</ins><span class="cx"> ./t31_tests -r &gt;$STDOUT_DEST 2&gt;$STDERR_DEST
</span><span class="cx"> RETVAL=$?
</span><span class="cx"> if [ $RETVAL != 0 ]
</span></span></pre></div>
<a id="freeswitchtrunklibsspandsptestssig_tone_testsc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/spandsp/tests/sig_tone_tests.c (15083 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/tests/sig_tone_tests.c        2009-10-05 14:01:59 UTC (rev 15083)
+++ freeswitch/trunk/libs/spandsp/tests/sig_tone_tests.c        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">  * along with this program; if not, write to the Free Software
</span><span class="cx">  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
</span><span class="cx">  *
</span><del>- * $Id: sig_tone_tests.c,v 1.25 2009/05/30 15:23:14 steveu Exp $
</del><ins>+ * $Id: sig_tone_tests.c,v 1.27 2009/09/23 16:02:59 steveu Exp $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /*! \file */
</span><span class="lines">@@ -58,112 +58,97 @@
</span><span class="cx"> static int sampleno = 0;
</span><span class="cx"> static int tone_1_present = 0;
</span><span class="cx"> static int tone_2_present = 0;
</span><del>-static int ping = 0;
</del><ins>+static int tx_section = 0;
+static int dial_pulses = 0;
</ins><span class="cx"> 
</span><del>-void map_frequency_response(sig_tone_rx_state_t *s);
-
-static int tx_handler(void *user_data, int what)
</del><ins>+static void tx_handler(void *user_data, int what, int level, int duration)
</ins><span class="cx"> {
</span><del>-    //printf(&quot;What - %d\n&quot;, what);
-    if ((what &amp; SIG_TONE_UPDATE_REQUEST))
</del><ins>+    sig_tone_tx_state_t *s;
+    
+    s = (sig_tone_tx_state_t *) user_data;
+    //printf(&quot;What - %d, duration - %d\n&quot;, what, duration);
+    if ((what &amp; SIG_TONE_TX_UPDATE_REQUEST))
</ins><span class="cx">     {
</span><span class="cx">         printf(&quot;Tx: update request\n&quot;);
</span><del>-        /* The signaling processor wants to know what to do next */
-        if (sampleno &lt; ms_to_samples(100))
</del><ins>+        /* The sig tone transmit side wants to know what to do next */
+        switch (tx_section)
</ins><span class="cx">         {
</span><del>-            /* 100ms off-hook */
-            printf(&quot;100ms off-hook - %d samples\n&quot;, 800 - sampleno);
-            return 0x02 | ((ms_to_samples(100) - sampleno) &lt;&lt; 16);
-        }
-        else if (sampleno &lt; ms_to_samples(600))
-        {
-            /* 500ms idle */
-            printf(&quot;500ms idle - %d samples\n&quot;, ms_to_samples(600) - sampleno);
-            return 0x02 | SIG_TONE_1_PRESENT | ((ms_to_samples(600) - sampleno) &lt;&lt; 16);
-        }
-        else if (sampleno &lt; ms_to_samples(700))
-        {
-            /* 100ms seize */
-            printf(&quot;100ms seize - %d samples\n&quot;, ms_to_samples(700) - sampleno);
-            return 0x02 | ((ms_to_samples(700) - sampleno) &lt;&lt; 16);
-        }
-        else if (sampleno &lt; ms_to_samples(1700))
-        {
-            if (ping)
-            {
-                printf(&quot;33ms break - %d samples\n&quot;, ms_to_samples(33));
-                ping = !ping;
-                return 0x02 | (ms_to_samples(33) &lt;&lt; 16);
-            }
</del><ins>+        case 0:
+            printf(&quot;33ms break - %d samples\n&quot;, ms_to_samples(33));
+            tx_section++;
+            sig_tone_tx_set_mode(s, SIG_TONE_1_PRESENT, ms_to_samples(33));
+            break;
+        case 1:
+            printf(&quot;67ms make - %d samples\n&quot;, ms_to_samples(67));
+            if (++dial_pulses == 9)
+                tx_section++;
</ins><span class="cx">             else
</span><del>-            {
-                printf(&quot;67ms make - %d samples\n&quot;, ms_to_samples(67));
-                ping = !ping;
-                return 0x02 | SIG_TONE_1_PRESENT | (ms_to_samples(67) &lt;&lt; 16);
-            }
-            /*endif*/
</del><ins>+                tx_section--;
+            sig_tone_tx_set_mode(s, 0, ms_to_samples(67));
+            break;
+        case 2:
+            tx_section++;
+            sig_tone_tx_set_mode(s, SIG_TONE_1_PRESENT, ms_to_samples(600));
+            break;
+        case 3:
+            sig_tone_tx_set_mode(s, SIG_TONE_1_PRESENT | SIG_TONE_TX_PASSTHROUGH, 0);
+            break;
</ins><span class="cx">         }
</span><del>-        else
-        {
-            return 0x02 | SIG_TONE_1_PRESENT | ((ms_to_samples(700) - sampleno) &lt;&lt; 16) | SIG_TONE_TX_PASSTHROUGH;
-        }
-        /*endif*/
</del><ins>+        /*endswitch*/
</ins><span class="cx">     }
</span><span class="cx">     /*endif*/
</span><del>-    return 0;
</del><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><del>-static int rx_handler(void *user_data, int what)
</del><ins>+static void rx_handler(void *user_data, int what, int level, int duration)
</ins><span class="cx"> {
</span><del>-    //printf(&quot;What - %d\n&quot;, what);
</del><ins>+    float ms;
+
+    ms = 1000.0f*(float) duration/(float) SAMPLE_RATE;
+    printf(&quot;What - %d, duration - %d\n&quot;, what, duration);
</ins><span class="cx">     if ((what &amp; SIG_TONE_1_CHANGE))
</span><span class="cx">     {
</span><span class="cx">         tone_1_present = what &amp; SIG_TONE_1_PRESENT;
</span><del>-        printf(&quot;Rx: tone 1 is %s after %d samples\n&quot;, (tone_1_present)  ?  &quot;on&quot;  : &quot;off&quot;, (what &gt;&gt; 16) &amp; 0xFFFF);
</del><ins>+        printf(&quot;Rx: tone 1 is %s after %d samples (%fms)\n&quot;, (tone_1_present)  ?  &quot;on&quot;  : &quot;off&quot;, duration, ms);
</ins><span class="cx">     }
</span><span class="cx">     /*endif*/
</span><span class="cx">     if ((what &amp; SIG_TONE_2_CHANGE))
</span><span class="cx">     {
</span><span class="cx">         tone_2_present = what &amp; SIG_TONE_2_PRESENT;
</span><del>-        printf(&quot;Rx: tone 2 is %s after %d samples\n&quot;, (tone_2_present)  ?  &quot;on&quot;  : &quot;off&quot;, (what &gt;&gt; 16) &amp; 0xFFFF);
</del><ins>+        printf(&quot;Rx: tone 2 is %s after %d samples (%fms)\n&quot;, (tone_2_present)  ?  &quot;on&quot;  : &quot;off&quot;, duration, ms);
</ins><span class="cx">     }
</span><span class="cx">     /*endif*/
</span><del>-    return 0;
</del><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><del>-void map_frequency_response(sig_tone_rx_state_t *s)
</del><ins>+static void map_frequency_response(sig_tone_rx_state_t *s)
</ins><span class="cx"> {
</span><span class="cx">     int16_t buf[8192];
</span><del>-    awgn_state_t noise_source;
</del><span class="cx">     int i;
</span><del>-    int f;
-    uint32_t phase_acc;
-    int32_t phase_rate;
-    int32_t scaling;
-    double sum;
</del><ins>+    int len;
+    double sumin;
+    double sumout;
+    swept_tone_state_t *swept;
</ins><span class="cx">     
</span><span class="cx">     /* Things like noise don't highlight the frequency response of the high Q notch
</span><span class="cx">        very well. We use a slowly swept frequency to check it. */
</span><del>-    awgn_init_dbm0(&amp;noise_source, 1234567, -10.0f);
-    for (f = 1;  f &lt; 4000;  f++)
</del><ins>+    swept = swept_tone_init(NULL, 200.0f, 3900.0f, -10.0f, 120*SAMPLE_RATE, 0);
+    for (;;)
</ins><span class="cx">     {
</span><del>-        phase_rate = dds_phase_rate(f);
-        scaling = dds_scaling_dbm0(-10);
-        phase_acc = 0;
-        for (i = 0;  i &lt; 8192;  i++)
-            buf[i] = dds_mod(&amp;phase_acc, phase_rate, scaling, 0);
</del><ins>+        if ((len = swept_tone(swept, buf, SAMPLES_PER_CHUNK)) &lt;= 0)
+            break;
+        sumin = 0.0;
+        for (i = 0;  i &lt; len;  i++)
+            sumin += (double) buf[i]*(double) buf[i];
+        sig_tone_rx(s, buf, len);
+        sumout = 0.0;
+        for (i = 0;  i &lt; len;  i++)
+            sumout += (double) buf[i]*(double) buf[i];
</ins><span class="cx">         /*endfor*/
</span><del>-        sig_tone_rx(s, buf, 8192);
-        sum = 0.0;
-        for (i = 1000;  i &lt; 8192;  i++)
-            sum += (double) buf[i]*(double) buf[i];
-        /*endfor*/
-        sum = sqrt(sum);
-        printf(&quot;%7d %f\n&quot;, f, sum);
</del><ins>+        printf(&quot;%7.1f %f\n&quot;, swept_tone_current_frequency(swept), 10.0*log10(sumout/sumin));
</ins><span class="cx">     }
</span><span class="cx">     /*endfor*/
</span><ins>+    swept_tone_free(swept);
</ins><span class="cx"> }
</span><span class="cx"> /*- End of function --------------------------------------------------------*/
</span><span class="cx"> 
</span><span class="lines">@@ -189,45 +174,56 @@
</span><span class="cx">     }
</span><span class="cx">     /*endif*/
</span><span class="cx"> 
</span><del>-    awgn_init_dbm0(&amp;noise_source, 1234567, -10.0f);
</del><ins>+    awgn_init_dbm0(&amp;noise_source, 1234567, -20.0f);
</ins><span class="cx"> 
</span><span class="cx">     for (type = 1;  type &lt;= 3;  type++)
</span><span class="cx">     {
</span><span class="cx">         sampleno = 0;
</span><span class="cx">         tone_1_present = 0;
</span><span class="cx">         tone_2_present = 0;
</span><del>-        ping = 0;
</del><ins>+        tx_section = 0;
</ins><span class="cx">         munge = NULL;
</span><span class="cx">         switch (type)
</span><span class="cx">         {
</span><span class="cx">         case 1:
</span><span class="cx">             printf(&quot;2280Hz tests.\n&quot;);
</span><span class="cx">             munge = codec_munge_init(MUNGE_CODEC_ALAW, 0);
</span><del>-            sig_tone_tx_init(&amp;tx_state, SIG_TONE_2280HZ, tx_handler, NULL);
-            sig_tone_rx_init(&amp;rx_state, SIG_TONE_2280HZ, rx_handler, NULL);
</del><ins>+            sig_tone_tx_init(&amp;tx_state, SIG_TONE_2280HZ, tx_handler, &amp;tx_state);
+            sig_tone_rx_init(&amp;rx_state, SIG_TONE_2280HZ, rx_handler, &amp;rx_state);
</ins><span class="cx">             rx_state.current_rx_tone |= SIG_TONE_RX_PASSTHROUGH;
</span><span class="cx">             break;
</span><span class="cx">         case 2:
</span><del>-            printf(&quot;26000Hz tests.\n&quot;);
</del><ins>+            printf(&quot;2600Hz tests.\n&quot;);
</ins><span class="cx">             munge = codec_munge_init(MUNGE_CODEC_ULAW, 0);
</span><del>-            sig_tone_tx_init(&amp;tx_state, SIG_TONE_2600HZ, tx_handler, NULL);
-            sig_tone_rx_init(&amp;rx_state, SIG_TONE_2600HZ, rx_handler, NULL);
</del><ins>+            sig_tone_tx_init(&amp;tx_state, SIG_TONE_2600HZ, tx_handler, &amp;tx_state);
+            sig_tone_rx_init(&amp;rx_state, SIG_TONE_2600HZ, rx_handler, &amp;rx_state);
</ins><span class="cx">             rx_state.current_rx_tone |= SIG_TONE_RX_PASSTHROUGH;
</span><span class="cx">             break;
</span><span class="cx">         case 3:
</span><del>-            printf(&quot;2400Hz/26000Hz tests.\n&quot;);
</del><ins>+            printf(&quot;2400Hz/2600Hz tests.\n&quot;);
</ins><span class="cx">             munge = codec_munge_init(MUNGE_CODEC_ULAW, 0);
</span><del>-            sig_tone_tx_init(&amp;tx_state, SIG_TONE_2400HZ_2600HZ, tx_handler, NULL);
-            sig_tone_rx_init(&amp;rx_state, SIG_TONE_2400HZ_2600HZ, rx_handler, NULL);
</del><ins>+            sig_tone_tx_init(&amp;tx_state, SIG_TONE_2400HZ_2600HZ, tx_handler, &amp;tx_state);
+            sig_tone_rx_init(&amp;rx_state, SIG_TONE_2400HZ_2600HZ, rx_handler, &amp;rx_state);
</ins><span class="cx">             rx_state.current_rx_tone |= SIG_TONE_RX_PASSTHROUGH;
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         /*endswitch*/
</span><del>-    
-        //map_frequency_response(&amp;rx_state);
</del><ins>+        /* Set to the default of hook condition */
+        sig_tone_rx_set_mode(&amp;rx_state, SIG_TONE_RX_PASSTHROUGH | SIG_TONE_RX_FILTER_TONE, 0);
+        sig_tone_tx_set_mode(&amp;tx_state, SIG_TONE_1_PRESENT | SIG_TONE_2_PRESENT | SIG_TONE_TX_PASSTHROUGH, 0);
</ins><span class="cx"> 
</span><del>-        for (sampleno = 0;  sampleno &lt; 20000;  sampleno += SAMPLES_PER_CHUNK)
</del><ins>+        map_frequency_response(&amp;rx_state);
+
+        sig_tone_rx_set_mode(&amp;rx_state, SIG_TONE_RX_PASSTHROUGH, 0);
+        for (sampleno = 0;  sampleno &lt; 30000;  sampleno += SAMPLES_PER_CHUNK)
</ins><span class="cx">         {
</span><ins>+            if (sampleno == 8000)
+            {
+                /* 100ms seize */
+                printf(&quot;100ms seize - %d samples\n&quot;, ms_to_samples(100));
+                dial_pulses = 0;
+                sig_tone_tx_set_mode(&amp;tx_state, 0, ms_to_samples(100));
+            }
</ins><span class="cx">             for (i = 0;  i &lt; SAMPLES_PER_CHUNK;  i++)
</span><span class="cx">                 amp[i] = awgn(&amp;noise_source);
</span><span class="cx">             /*endfor*/
</span></span></pre></div>
<a id="freeswitchtrunklibsspandsptestsswept_tone_testsc"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/libs/spandsp/tests/swept_tone_tests.c (0 => 15084)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/spandsp/tests/swept_tone_tests.c                                (rev 0)
+++ freeswitch/trunk/libs/spandsp/tests/swept_tone_tests.c        2009-10-05 14:34:26 UTC (rev 15084)
</span><span class="lines">@@ -0,0 +1,101 @@
</span><ins>+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * swept_tone_tests.c
+ *
+ * Written by Steve Underwood &lt;steveu@coppice.org&gt;
+ *
+ * Copyright (C) 2009 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: swept_tone_tests.c,v 1.2 2009/09/22 13:28:18 steveu Exp $
+ */
+
+/*! \file */
+
+#if defined(HAVE_CONFIG_H)
+#include &quot;config.h&quot;
+#endif
+
+#include &lt;stdlib.h&gt;
+#include &lt;stdio.h&gt;
+#include &lt;fcntl.h&gt;
+#include &lt;memory.h&gt;
+#include &lt;sndfile.h&gt;
+
+#include &quot;spandsp.h&quot;
+#include &quot;spandsp-sim.h&quot;
+
+#define OUTPUT_FILE_NAME        &quot;swept_tone.wav&quot;
+
+#define BLOCK_LEN               160
+
+int main(int argc, char *argv[])
+{
+    int i;
+    int j;
+    int outframes;
+    int len;
+    SNDFILE *outhandle;
+    power_meter_t meter;
+    swept_tone_state_t *s;
+    int16_t buf[BLOCK_LEN];
+
+    power_meter_init(&amp;meter, 10);
+
+    if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL)
+    {
+        fprintf(stderr, &quot;    Cannot create audio file '%s'\n&quot;, OUTPUT_FILE_NAME);
+        exit(2);
+    }
+
+    printf(&quot;Test with swept tone.\n&quot;);
+    s = swept_tone_init(NULL, 200.0f, 3900.0f, -10.0f, 60*SAMPLE_RATE, 1);
+    for (j = 0;  j &lt; 60*SAMPLE_RATE;  j += BLOCK_LEN)
+    {
+        len = swept_tone(s, buf, BLOCK_LEN);
+        for (i = 0;  i &lt; len;  i++)
+            power_meter_update(&amp;meter, buf[i]);
+        outframes = sf_writef_short(outhandle, buf, len);
+        if (outframes != len)
+        {
+            fprintf(stderr, &quot;    Error writing audio file\n&quot;);
+            exit(2);
+        }
+#if 0
+        printf(&quot;Current freq %.1fHz, Level is %fdBOv/%fdBm0\n&quot;,
+               swept_tone_current_frequency(s),
+               power_meter_current_dbov(&amp;meter),
+               power_meter_current_dbm0(&amp;meter));
+#else
+        printf(&quot;%.1f %f\n&quot;,
+               swept_tone_current_frequency(s),
+               power_meter_current_dbm0(&amp;meter));
+#endif
+    }
+
+    if (sf_close(outhandle) != 0)
+    {
+        fprintf(stderr, &quot;    Cannot close audio file '%s'\n&quot;, OUTPUT_FILE_NAME);
+        exit(2);
+    }
+
+    printf(&quot;Tests passed.\n&quot;);
+    return  0;
+}
+/*- End of function --------------------------------------------------------*/
+/*- End of file ------------------------------------------------------------*/
</ins></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>