[Freeswitch-svn] [commit] r12187 - in freeswitch/trunk/libs/spandsp: spandsp-sim src src/msvc src/spandsp src/spandsp/private tests

FreeSWITCH SVN mikej at freeswitch.org
Fri Feb 20 10:25:22 PST 2009


Author: mikej
Date: Fri Feb 20 12:25:22 2009
New Revision: 12187

Log:
update to snapshot spandsp-20090212

Modified:
   freeswitch/trunk/libs/spandsp/spandsp-sim/make_line_models.c
   freeswitch/trunk/libs/spandsp/src/hdlc.c
   freeswitch/trunk/libs/spandsp/src/logging.c
   freeswitch/trunk/libs/spandsp/src/msvc/spandsp.h
   freeswitch/trunk/libs/spandsp/src/spandsp.h.in
   freeswitch/trunk/libs/spandsp/src/spandsp/async.h
   freeswitch/trunk/libs/spandsp/src/spandsp/hdlc.h
   freeswitch/trunk/libs/spandsp/src/spandsp/logging.h
   freeswitch/trunk/libs/spandsp/src/spandsp/private/hdlc.h
   freeswitch/trunk/libs/spandsp/src/spandsp/private/t31.h
   freeswitch/trunk/libs/spandsp/src/spandsp/version.h
   freeswitch/trunk/libs/spandsp/src/super_tone_tx.c
   freeswitch/trunk/libs/spandsp/src/t31.c
   freeswitch/trunk/libs/spandsp/src/t38_gateway.c
   freeswitch/trunk/libs/spandsp/tests/fax_tester.c
   freeswitch/trunk/libs/spandsp/tests/fsk_tests.c
   freeswitch/trunk/libs/spandsp/tests/logging_tests.c
   freeswitch/trunk/libs/spandsp/tests/make_g168_css.c
   freeswitch/trunk/libs/spandsp/tests/super_tone_tx_tests.c
   freeswitch/trunk/libs/spandsp/tests/v17_tests.c
   freeswitch/trunk/libs/spandsp/tests/v27ter_tests.c
   freeswitch/trunk/libs/spandsp/tests/v29_tests.c

Modified: freeswitch/trunk/libs/spandsp/spandsp-sim/make_line_models.c
==============================================================================
--- freeswitch/trunk/libs/spandsp/spandsp-sim/make_line_models.c	(original)
+++ freeswitch/trunk/libs/spandsp/spandsp-sim/make_line_models.c	Fri Feb 20 12:25:22 2009
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: make_line_models.c,v 1.8 2009/02/03 16:28:39 steveu Exp $
+ * $Id: make_line_models.c,v 1.9 2009/02/10 17:49:20 steveu Exp $
  */
 
 /*! \page make_line_models_page Telephony line model construction
@@ -37,22 +37,23 @@
 #include "config.h"
 #endif
 
+#include <stdlib.h>
+#include <unistd.h>
 #include <inttypes.h>
 #include <string.h>
 #include <stdio.h>
-#include <stdlib.h>
-#if defined(HAVE_TGMATH_H)
-#include <tgmath.h>
-#endif
-#if defined(HAVE_MATH_H)
-#include <math.h>
-#endif
 #include "floating_fudge.h"
 #if defined(HAVE_FFTW3_H)
 #include <fftw3.h>
 #else
 #include <fftw.h>
 #endif
+#if defined(HAVE_TGMATH_H)
+#include <tgmath.h>
+#endif
+#if defined(HAVE_MATH_H)
+#include <math.h>
+#endif
 
 #include "spandsp.h"
 

Modified: freeswitch/trunk/libs/spandsp/src/hdlc.c
==============================================================================
--- freeswitch/trunk/libs/spandsp/src/hdlc.c	(original)
+++ freeswitch/trunk/libs/spandsp/src/hdlc.c	Fri Feb 20 12:25:22 2009
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: hdlc.c,v 1.70 2009/02/10 13:06:46 steveu Exp $
+ * $Id: hdlc.c,v 1.71 2009/02/12 12:38:39 steveu Exp $
  */
 
 /*! \file */
@@ -43,10 +43,19 @@
 #include "spandsp/hdlc.h"
 #include "spandsp/private/hdlc.h"
 
-static void rx_special_condition(hdlc_rx_state_t *s, int condition)
+static void report_status_change(hdlc_rx_state_t *s, int status)
+{
+    if (s->status_handler)
+        s->status_handler(s->status_user_data, status);
+    else if (s->frame_handler)
+        s->frame_handler(s->frame_user_data, NULL, status, TRUE);
+}
+/*- End of function --------------------------------------------------------*/
+
+static void rx_special_condition(hdlc_rx_state_t *s, int status)
 {
     /* Special conditions */
-    switch (condition)
+    switch (status)
     {
     case SIG_STATUS_CARRIER_UP:
     case SIG_STATUS_TRAINING_SUCCEEDED:
@@ -61,7 +70,7 @@
     case SIG_STATUS_TRAINING_FAILED:
     case SIG_STATUS_CARRIER_DOWN:
     case SIG_STATUS_END_OF_DATA:
-        s->frame_handler(s->user_data, NULL, condition, TRUE);
+        report_status_change(s, status);
         break;
     default:
         //printf("Eh!\n");
@@ -82,7 +91,7 @@
         if (--s->octet_count <= 0)
         {
             s->octet_count = s->octet_count_report_interval;
-            s->frame_handler(s->user_data, NULL, SIG_STATUS_OCTET_REPORT, TRUE);
+            report_status_change(s, SIG_STATUS_OCTET_REPORT);
         }
     }
     else
@@ -105,7 +114,7 @@
         if (--s->octet_count <= 0)
         {
             s->octet_count = s->octet_count_report_interval;
-            s->frame_handler(s->user_data, NULL, SIG_STATUS_OCTET_REPORT, TRUE);
+            report_status_change(s, SIG_STATUS_OCTET_REPORT);
         }
     }
 }
@@ -117,7 +126,7 @@
     {
         /* Hit HDLC abort */
         s->rx_aborts++;
-        s->frame_handler(s->user_data, NULL, SIG_STATUS_ABORT, TRUE);
+        report_status_change(s, SIG_STATUS_ABORT);
         /* If we have not yet seen enough flags, restart the count. If we
            are beyond that point, just back off one step, so we need to see
            another flag before proceeding to collect frame octets. */
@@ -147,7 +156,7 @@
                         s->rx_frames++;
                         s->rx_bytes += s->len - s->crc_bytes;
                         s->len -= s->crc_bytes;
-                        s->frame_handler(s->user_data, s->buffer, s->len, TRUE);
+                        s->frame_handler(s->frame_user_data, s->buffer, s->len, TRUE);
                     }
                     else
                     {
@@ -155,7 +164,7 @@
                         if (s->report_bad_frames)
                         {
                             s->len -= s->crc_bytes;
-                            s->frame_handler(s->user_data, s->buffer, s->len, FALSE);
+                            s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE);
                         }
                     }
                 }
@@ -170,7 +179,7 @@
                             s->len -= s->crc_bytes;
                         else
                             s->len = 0;
-                        s->frame_handler(s->user_data, s->buffer, s->len, FALSE);
+                        s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE);
                     }
                     s->rx_length_errors++;
                 }
@@ -194,7 +203,7 @@
             }
             if (++s->flags_seen >= s->framing_ok_threshold  &&  !s->framing_ok_announced)
             {
-                s->frame_handler(s->user_data, NULL, SIG_STATUS_FRAMING_OK, TRUE);
+                report_status_change(s, SIG_STATUS_FRAMING_OK);
                 s->framing_ok_announced = TRUE;
             }
         }
@@ -309,7 +318,7 @@
     }
     memset(s, 0, sizeof(*s));
     s->frame_handler = handler;
-    s->user_data = user_data;
+    s->frame_user_data = user_data;
     s->crc_bytes = (crc32)  ?  4  :  2;
     s->report_bad_frames = report_bad_frames;
     s->framing_ok_threshold = (framing_ok_threshold < 1)  ?  1  :  framing_ok_threshold;
@@ -318,6 +327,20 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+SPAN_DECLARE(void) hdlc_rx_set_frame_handler(hdlc_rx_state_t *s, hdlc_frame_handler_t handler, void *user_data)
+{
+    s->frame_handler = handler;
+    s->frame_user_data = user_data;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) hdlc_rx_set_status_handler(hdlc_rx_state_t *s, modem_rx_status_func_t handler, void *user_data)
+{
+    s->status_handler = handler;
+    s->status_user_data = user_data;
+}
+/*- End of function --------------------------------------------------------*/
+
 SPAN_DECLARE(int) hdlc_rx_release(hdlc_rx_state_t *s)
 {
     return 0;

Modified: freeswitch/trunk/libs/spandsp/src/logging.c
==============================================================================
--- freeswitch/trunk/libs/spandsp/src/logging.c	(original)
+++ freeswitch/trunk/libs/spandsp/src/logging.c	Fri Feb 20 12:25:22 2009
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: logging.c,v 1.31 2009/02/10 13:06:46 steveu Exp $
+ * $Id: logging.c,v 1.32 2009/02/10 17:44:18 steveu Exp $
  */
 
 /*! \file */
@@ -241,7 +241,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-SPAN_DECLARE(int) span_log_init(logging_state_t *s, int level, const char *tag)
+SPAN_DECLARE(logging_state_t *) span_log_init(logging_state_t *s, int level, const char *tag)
 {
     if (s == NULL)
     {
@@ -256,7 +256,7 @@
     s->samples_per_second = SAMPLE_RATE;
     s->elapsed_samples = 0;
 
-    return  0;
+    return s;
 }
 /*- End of function --------------------------------------------------------*/
 

Modified: freeswitch/trunk/libs/spandsp/src/msvc/spandsp.h
==============================================================================
--- freeswitch/trunk/libs/spandsp/src/msvc/spandsp.h	(original)
+++ freeswitch/trunk/libs/spandsp/src/msvc/spandsp.h	Fri Feb 20 12:25:22 2009
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: spandsp.h.in,v 1.16 2009/02/03 16:28:40 steveu Exp $
+ * $Id: spandsp.h.in,v 1.17 2009/02/12 12:38:39 steveu Exp $
  */
 
 /*! \file */
@@ -69,8 +69,8 @@
 #include <spandsp/echo.h>
 #include <spandsp/modem_echo.h>
 #include <spandsp/crc.h>
-#include <spandsp/hdlc.h>
 #include <spandsp/async.h>
+#include <spandsp/hdlc.h>
 #include <spandsp/noise.h>
 #include <spandsp/saturated.h>
 #include <spandsp/time_scale.h>

Modified: freeswitch/trunk/libs/spandsp/src/spandsp.h.in
==============================================================================
--- freeswitch/trunk/libs/spandsp/src/spandsp.h.in	(original)
+++ freeswitch/trunk/libs/spandsp/src/spandsp.h.in	Fri Feb 20 12:25:22 2009
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: spandsp.h.in,v 1.16 2009/02/03 16:28:40 steveu Exp $
+ * $Id: spandsp.h.in,v 1.17 2009/02/12 12:38:39 steveu Exp $
  */
 
 /*! \file */
@@ -69,8 +69,8 @@
 #include <spandsp/echo.h>
 #include <spandsp/modem_echo.h>
 #include <spandsp/crc.h>
-#include <spandsp/hdlc.h>
 #include <spandsp/async.h>
+#include <spandsp/hdlc.h>
 #include <spandsp/noise.h>
 #include <spandsp/saturated.h>
 #include <spandsp/time_scale.h>

Modified: freeswitch/trunk/libs/spandsp/src/spandsp/async.h
==============================================================================
--- freeswitch/trunk/libs/spandsp/src/spandsp/async.h	(original)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/async.h	Fri Feb 20 12:25:22 2009
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: async.h,v 1.23 2009/02/10 13:06:47 steveu Exp $
+ * $Id: async.h,v 1.24 2009/02/12 12:38:39 steveu Exp $
  */
 
 /*! \file */
@@ -100,10 +100,10 @@
 typedef int (*get_bit_func_t)(void *user_data);
 
 /*! Completion callback function for tx data pumps */
-typedef int (*modem_tx_status_func_t)(void *user_data, int status);
+typedef void (*modem_tx_status_func_t)(void *user_data, int status);
 
 /*! Completion callback function for rx data pumps */
-typedef int (*modem_rx_status_func_t)(void *user_data, int status);
+typedef void (*modem_rx_status_func_t)(void *user_data, int status);
 
 enum
 {

Modified: freeswitch/trunk/libs/spandsp/src/spandsp/hdlc.h
==============================================================================
--- freeswitch/trunk/libs/spandsp/src/spandsp/hdlc.h	(original)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/hdlc.h	Fri Feb 20 12:25:22 2009
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: hdlc.h,v 1.43 2009/02/10 13:06:47 steveu Exp $
+ * $Id: hdlc.h,v 1.44 2009/02/12 12:38:39 steveu Exp $
  */
 
 /*! \file */
@@ -101,8 +101,32 @@
                                              hdlc_frame_handler_t handler,
                                              void *user_data);
 
+/*! Change the put_bit function associated with an HDLC receiver context.
+    \brief Change the put_bit function associated with an HDLC receiver context.
+    \param s A pointer to an HDLC receiver context.
+    \param handler The function to be called when a good HDLC frame is received.
+    \param user_data An opaque parameter for the callback routine.
+*/
+SPAN_DECLARE(void) hdlc_rx_set_frame_handler(hdlc_rx_state_t *s, hdlc_frame_handler_t handler, void *user_data);
+
+/*! Change the status report function associated with an HDLC receiver context.
+    \brief Change the status report function associated with an HDLC receiver context.
+    \param s A pointer to an HDLC receiver context.
+    \param handler The callback routine used to report status changes.
+    \param user_data An opaque parameter for the callback routine.
+*/
+SPAN_DECLARE(void) hdlc_rx_set_status_handler(hdlc_rx_state_t *s, modem_rx_status_func_t handler, void *user_data);
+
+/*! Release an HDLC receiver context.
+    \brief Release an HDLC receiver context.
+    \param s A pointer to an HDLC receiver context.
+    \return 0 for OK */
 SPAN_DECLARE(int) hdlc_rx_release(hdlc_rx_state_t *s);
 
+/*! Free an HDLC receiver context.
+    \brief Free an HDLC receiver context.
+    \param s A pointer to an HDLC receiver context.
+    \return 0 for OK */
 SPAN_DECLARE(int) hdlc_rx_free(hdlc_rx_state_t *s);
 
 /*! \brief Set the maximum frame length for an HDLC receiver context.

Modified: freeswitch/trunk/libs/spandsp/src/spandsp/logging.h
==============================================================================
--- freeswitch/trunk/libs/spandsp/src/spandsp/logging.h	(original)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/logging.h	Fri Feb 20 12:25:22 2009
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: logging.h,v 1.19 2009/02/10 13:06:47 steveu Exp $
+ * $Id: logging.h,v 1.20 2009/02/10 17:44:18 steveu Exp $
  */
 
 /*! \file */
@@ -127,7 +127,7 @@
 
 SPAN_DECLARE(void) span_set_error_handler(error_handler_func_t func);
 
-SPAN_DECLARE(int) span_log_init(logging_state_t *s, int level, const char *tag);
+SPAN_DECLARE(logging_state_t *) span_log_init(logging_state_t *s, int level, const char *tag);
 
 SPAN_DECLARE(int) span_log_release(logging_state_t *s);
 

Modified: freeswitch/trunk/libs/spandsp/src/spandsp/private/hdlc.h
==============================================================================
--- freeswitch/trunk/libs/spandsp/src/spandsp/private/hdlc.h	(original)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/private/hdlc.h	Fri Feb 20 12:25:22 2009
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: hdlc.h,v 1.2 2009/01/31 08:48:11 steveu Exp $
+ * $Id: hdlc.h,v 1.3 2009/02/12 12:38:39 steveu Exp $
  */
 
 #if !defined(_SPANDSP_PRIVATE_HDLC_H_)
@@ -39,8 +39,12 @@
     size_t max_frame_len;
     /*! \brief The callback routine called to process each good received frame. */
     hdlc_frame_handler_t frame_handler;
-    /*! \brief An opaque parameter passed to the callback routine. */
-    void *user_data;
+    /*! \brief An opaque parameter passed to the frame callback routine. */
+    void *frame_user_data;
+    /*! \brief The callback routine called to report status changes. */
+    modem_rx_status_func_t status_handler;
+    /*! \brief An opaque parameter passed to the status callback routine. */
+    void *status_user_data;
     /*! \brief TRUE if bad frames are to be reported. */
     int report_bad_frames;
     /*! \brief The number of consecutive flags which must be seen before framing is

Modified: freeswitch/trunk/libs/spandsp/src/spandsp/private/t31.h
==============================================================================
--- freeswitch/trunk/libs/spandsp/src/spandsp/private/t31.h	(original)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/private/t31.h	Fri Feb 20 12:25:22 2009
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t31.h,v 1.6 2009/01/16 15:13:16 steveu Exp $
+ * $Id: t31.h,v 1.7 2009/02/12 12:38:39 steveu Exp $
  */
 
 #if !defined(_SPANDSP_PRIVATE_T31_H_)
@@ -103,6 +103,10 @@
         int extra_bits;
     } hdlc_tx;
 
+    /*! \brief TRUE if we are using ECM mode. This is used to select HDLC faking, necessary
+               with clunky class 1 modems. */
+    int ecm_mode;
+
     /*! \brief Counter for trailing non-ECM bytes, used to flush out the far end's modem. */
     int non_ecm_trailer_bytes;
 

Modified: freeswitch/trunk/libs/spandsp/src/spandsp/version.h
==============================================================================
--- freeswitch/trunk/libs/spandsp/src/spandsp/version.h	(original)
+++ freeswitch/trunk/libs/spandsp/src/spandsp/version.h	Fri Feb 20 12:25:22 2009
@@ -30,8 +30,8 @@
 
 /* The date and time of the version are in UTC form. */
 
-#define SPANDSP_RELEASE_DATE    20090210
-#define SPANDSP_RELEASE_TIME    172413
+#define SPANDSP_RELEASE_DATE    20090212
+#define SPANDSP_RELEASE_TIME    142337
 
 #endif
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/trunk/libs/spandsp/src/super_tone_tx.c
==============================================================================
--- freeswitch/trunk/libs/spandsp/src/super_tone_tx.c	(original)
+++ freeswitch/trunk/libs/spandsp/src/super_tone_tx.c	Fri Feb 20 12:25:22 2009
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: super_tone_tx.c,v 1.29 2009/02/10 13:06:46 steveu Exp $
+ * $Id: super_tone_tx.c,v 1.30 2009/02/10 17:44:18 steveu Exp $
  */
 
 /*! \file */
@@ -120,7 +120,7 @@
     {
         /* Follow nesting... */
         if (s->nest)
-            super_tone_tx_free(s->nest);
+            super_tone_tx_free_tone(s->nest);
         t = s;
         s = s->next;
         free(t);

Modified: freeswitch/trunk/libs/spandsp/src/t31.c
==============================================================================
--- freeswitch/trunk/libs/spandsp/src/t31.c	(original)
+++ freeswitch/trunk/libs/spandsp/src/t31.c	Fri Feb 20 12:25:22 2009
@@ -25,7 +25,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t31.c,v 1.140 2009/02/10 13:06:46 steveu Exp $
+ * $Id: t31.c,v 1.142 2009/02/12 14:14:58 steveu Exp $
  */
 
 /*! \file */
@@ -82,6 +82,7 @@
 #include "spandsp/at_interpreter.h"
 #include "spandsp/fax_modems.h"
 #include "spandsp/t31.h"
+#include "spandsp/t30_fcf.h"
 
 #include "spandsp/private/logging.h"
 #include "spandsp/private/t38_core.h"
@@ -115,9 +116,24 @@
 
 typedef const char *(*at_cmd_service_t)(t31_state_t *s, const char *cmd);
 
-#define ETX 0x03
-#define DLE 0x10
-#define SUB 0x1A
+enum
+{
+    ETX = 0x03,
+    DLE = 0x10,
+    SUB = 0x1A
+};
+
+enum
+{
+    DISBIT1 = 0x01,
+    DISBIT2 = 0x02,
+    DISBIT3 = 0x04,
+    DISBIT4 = 0x08,
+    DISBIT5 = 0x10,
+    DISBIT6 = 0x20,
+    DISBIT7 = 0x40,
+    DISBIT8 = 0x80
+};
 
 /* BEWARE: right now this must match up with a list in the AT interpreter code. */
 enum
@@ -159,12 +175,17 @@
     T38_TIMED_STEP_HDLC_MODEM_3 = 0x22,
     T38_TIMED_STEP_HDLC_MODEM_4 = 0x23,
     T38_TIMED_STEP_HDLC_MODEM_5 = 0x24,
-    T38_TIMED_STEP_CED = 0x30,
-    T38_TIMED_STEP_CED_2 = 0x31,
-    T38_TIMED_STEP_CED_3 = 0x32,
-    T38_TIMED_STEP_CNG = 0x40,
-    T38_TIMED_STEP_CNG_2 = 0x41,
-    T38_TIMED_STEP_PAUSE = 0x50
+    T38_TIMED_STEP_FAKE_HDLC_MODEM = 0x30,
+    T38_TIMED_STEP_FAKE_HDLC_MODEM_2 = 0x31,
+    T38_TIMED_STEP_FAKE_HDLC_MODEM_3 = 0x32,
+    T38_TIMED_STEP_FAKE_HDLC_MODEM_4 = 0x33,
+    T38_TIMED_STEP_FAKE_HDLC_MODEM_5 = 0x34,
+    T38_TIMED_STEP_CED = 0x40,
+    T38_TIMED_STEP_CED_2 = 0x41,
+    T38_TIMED_STEP_CED_3 = 0x42,
+    T38_TIMED_STEP_CNG = 0x50,
+    T38_TIMED_STEP_CNG_2 = 0x51,
+    T38_TIMED_STEP_PAUSE = 0x60
 };
 
 static int restart_modem(t31_state_t *s, int new_modem);
@@ -186,6 +207,30 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+#if 0
+static void monitor_control_messages(t31_state_t *s, const uint8_t *buf, int len)
+{
+    /* Monitor the control messages, at the point where we have the whole message, so we can
+       see what is happening to things like training success/failure. */
+    span_log(&s->logging, SPAN_LOG_FLOW, "Monitoring %s\n", t30_frametype(buf[2]));
+    if (len < 3)
+        return;
+    /*endif*/
+    switch (buf[2])
+    {
+    case T30_DCS:
+    case T30_DCS | 1:
+        /* We need to know if ECM is about to be used, so we can fake HDLC stuff. */
+        s->t38_fe.ecm_mode = (len >= 7)  &&  (buf[6] & DISBIT3);
+        break;
+    default:
+        break;
+    }
+    /*endswitch*/
+}
+/*- End of function --------------------------------------------------------*/
+#endif
+
 static void front_end_status(t31_state_t *s, int status)
 {
     span_log(&s->logging, SPAN_LOG_FLOW, "Front end status %d\n", status);
@@ -980,6 +1025,9 @@
     case T38_TIMED_STEP_HDLC_MODEM:
         delay = stream_hdlc(s);
         break;
+    //case T38_TIMED_STEP_FAKE_HDLC_MODEM:
+    //    delay = stream_fake_hdlc(s);
+    //    break;
     case T38_TIMED_STEP_CED:
         delay = stream_ced(s);
         break;
@@ -2244,7 +2292,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static void t31_fax_modems_init(fax_modems_state_t *s, int use_tep, void *user_data)
+static fax_modems_state_t *t31_fax_modems_init(fax_modems_state_t *s, int use_tep, void *user_data)
 {
     s->use_tep = use_tep;
 
@@ -2273,6 +2321,7 @@
     s->rx_user_data = NULL;
     s->tx_handler = (span_tx_handler_t *) &silence_gen;
     s->tx_user_data = &s->silence_gen;
+    return s;
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -2458,7 +2507,6 @@
                  2,
                  NULL,
                  NULL);
-
     return 0;
 }
 /*- End of function --------------------------------------------------------*/

Modified: freeswitch/trunk/libs/spandsp/src/t38_gateway.c
==============================================================================
--- freeswitch/trunk/libs/spandsp/src/t38_gateway.c	(original)
+++ freeswitch/trunk/libs/spandsp/src/t38_gateway.c	Fri Feb 20 12:25:22 2009
@@ -23,7 +23,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_gateway.c,v 1.154 2009/02/10 13:06:46 steveu Exp $
+ * $Id: t38_gateway.c,v 1.155 2009/02/12 12:38:39 steveu Exp $
  */
 
 /*! \file */
@@ -747,7 +747,10 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static void monitor_control_messages(t38_gateway_state_t *s, int from_modem, uint8_t *buf, int len)
+static void monitor_control_messages(t38_gateway_state_t *s,
+                                     int from_modem,
+                                     const uint8_t *buf,
+                                     int len)
 {
     static const struct
     {
@@ -1704,7 +1707,7 @@
 {
     t38_gateway_state_t *s;
 
-    s = (t38_gateway_state_t *) t->user_data;
+    s = (t38_gateway_state_t *) t->frame_user_data;
     span_log(&s->logging, SPAN_LOG_FLOW, "HDLC signal status is %s (%d)\n", signal_status_to_str(status), status);
     switch (status)
     {
@@ -1761,7 +1764,7 @@
     t38_gateway_state_t *s;
     t38_gateway_to_t38_state_t *u;
     
-    s = (t38_gateway_state_t *) t->user_data;
+    s = (t38_gateway_state_t *) t->frame_user_data;
     u = &s->core.to_t38;
     if ((t->raw_bit_stream & 0x80))
     {
@@ -1916,7 +1919,7 @@
         return;
     }
     /*endif*/
-    s = (t38_gateway_state_t *) t->user_data;
+    s = (t38_gateway_state_t *) t->frame_user_data;
     u = &s->core.to_t38;
     t->buffer[t->len] = (uint8_t) t->byte_in_progress;
     /* Calculate the CRC progressively, before we start altering the frame */

Modified: freeswitch/trunk/libs/spandsp/tests/fax_tester.c
==============================================================================
--- freeswitch/trunk/libs/spandsp/tests/fax_tester.c	(original)
+++ freeswitch/trunk/libs/spandsp/tests/fax_tester.c	Fri Feb 20 12:25:22 2009
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: fax_tester.c,v 1.21 2009/01/28 03:41:27 steveu Exp $
+ * $Id: fax_tester.c,v 1.22 2009/02/12 12:38:39 steveu Exp $
  */
 
 /*! \file */
@@ -146,7 +146,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static int modem_tx_status(void *user_data, int status)
+static void modem_tx_status(void *user_data, int status)
 {
     faxtester_state_t *s;
 
@@ -158,7 +158,6 @@
         front_end_step_complete(s);
         break;
     }
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 

Modified: freeswitch/trunk/libs/spandsp/tests/fsk_tests.c
==============================================================================
--- freeswitch/trunk/libs/spandsp/tests/fsk_tests.c	(original)
+++ freeswitch/trunk/libs/spandsp/tests/fsk_tests.c	Fri Feb 20 12:25:22 2009
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: fsk_tests.c,v 1.53 2008/11/30 10:17:31 steveu Exp $
+ * $Id: fsk_tests.c,v 1.55 2009/02/12 14:21:16 steveu Exp $
  */
 
 /*! \page fsk_tests_page FSK modem tests
@@ -69,17 +69,15 @@
 int rx_bits = 0;
 int cutoff_test_carrier = FALSE;
 
-static int rx_status(void *user_data, int status)
+static void rx_status(void *user_data, int status)
 {
     printf("FSK rx status is %s (%d)\n", signal_status_to_str(status), status);
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
-static int tx_status(void *user_data, int status)
+static void tx_status(void *user_data, int status)
 {
     printf("FSK tx status is %s (%d)\n", signal_status_to_str(status), status);
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -95,7 +93,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static int cutoff_test_rx_status(void *user_data, int status)
+static void cutoff_test_rx_status(void *user_data, int status)
 {
     printf("FSK rx status is %s (%d)\n", signal_status_to_str(status), status);
     switch (status)
@@ -107,7 +105,6 @@
         cutoff_test_carrier = FALSE;
         break;
     }
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 

Modified: freeswitch/trunk/libs/spandsp/tests/logging_tests.c
==============================================================================
--- freeswitch/trunk/libs/spandsp/tests/logging_tests.c	(original)
+++ freeswitch/trunk/libs/spandsp/tests/logging_tests.c	Fri Feb 20 12:25:22 2009
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: logging_tests.c,v 1.15 2008/11/30 13:44:35 steveu Exp $
+ * $Id: logging_tests.c,v 1.16 2009/02/12 12:38:39 steveu Exp $
  */
 
 /*! \page logging_tests_page Logging tests
@@ -132,7 +132,7 @@
     struct timespec delay;
 
     /* Set up a logger */
-    if (span_log_init(&log, 123, "TAG"))
+    if (span_log_init(&log, 123, "TAG") == NULL)
     {
         fprintf(stderr, "Failed to initialise log.\n");
         exit(2);

Modified: freeswitch/trunk/libs/spandsp/tests/make_g168_css.c
==============================================================================
--- freeswitch/trunk/libs/spandsp/tests/make_g168_css.c	(original)
+++ freeswitch/trunk/libs/spandsp/tests/make_g168_css.c	Fri Feb 20 12:25:22 2009
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: make_g168_css.c,v 1.16 2008/11/30 12:38:27 steveu Exp $
+ * $Id: make_g168_css.c,v 1.17 2009/02/10 17:49:20 steveu Exp $
  */
 
 /*! \page makecss_page CSS construction for G.168 testing
@@ -49,9 +49,6 @@
 #else
 #include <fftw.h>
 #endif
-#if defined(HAVE_MATH_H)
-#define GEN_CONST
-#endif
 
 //#if defined(WITH_SPANDSP_INTERNALS)
 #define SPANDSP_EXPOSE_INTERNAL_STRUCTURES

Modified: freeswitch/trunk/libs/spandsp/tests/super_tone_tx_tests.c
==============================================================================
--- freeswitch/trunk/libs/spandsp/tests/super_tone_tx_tests.c	(original)
+++ freeswitch/trunk/libs/spandsp/tests/super_tone_tx_tests.c	Fri Feb 20 12:25:22 2009
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: super_tone_tx_tests.c,v 1.24 2008/11/30 10:17:31 steveu Exp $
+ * $Id: super_tone_tx_tests.c,v 1.25 2009/02/10 17:44:18 steveu Exp $
  */
 
 /*! \file */
@@ -202,7 +202,7 @@
             super_tone_tx_init(&tone, tone_tree);
 //printf("Len %p %p %d %d\n", (void *) tone.levels[0], (void *) tone_tree, tone_tree->length, tone_tree->tone);
             play_tones(&tone, 99999999);
-            super_tone_tx_free(tone_tree);
+            super_tone_tx_free_tone(tone_tree);
         }
         /*endif*/
         cur = cur->next;

Modified: freeswitch/trunk/libs/spandsp/tests/v17_tests.c
==============================================================================
--- freeswitch/trunk/libs/spandsp/tests/v17_tests.c	(original)
+++ freeswitch/trunk/libs/spandsp/tests/v17_tests.c	Fri Feb 20 12:25:22 2009
@@ -23,7 +23,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v17_tests.c,v 1.98 2009/01/12 17:20:59 steveu Exp $
+ * $Id: v17_tests.c,v 1.100 2009/02/12 14:21:16 steveu Exp $
  */
 
 /*! \page v17_tests_page V.17 modem tests
@@ -114,7 +114,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static int v17_rx_status(void *user_data, int status)
+static void v17_rx_status(void *user_data, int status)
 {
     v17_rx_state_t *rx;
     int i;
@@ -132,7 +132,6 @@
             printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i]));
         break;
     }
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -154,10 +153,9 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static int v17_tx_status(void *user_data, int status)
+static void v17_tx_status(void *user_data, int status)
 {
     printf("V.17 tx status is %s (%d)\n", signal_status_to_str(status), status);
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 

Modified: freeswitch/trunk/libs/spandsp/tests/v27ter_tests.c
==============================================================================
--- freeswitch/trunk/libs/spandsp/tests/v27ter_tests.c	(original)
+++ freeswitch/trunk/libs/spandsp/tests/v27ter_tests.c	Fri Feb 20 12:25:22 2009
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v27ter_tests.c,v 1.99 2009/01/12 17:20:59 steveu Exp $
+ * $Id: v27ter_tests.c,v 1.101 2009/02/12 14:21:16 steveu Exp $
  */
 
 /*! \page v27ter_tests_page V.27ter modem tests
@@ -110,10 +110,9 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static int v27ter_rx_status(void *user_data, int status)
+static void v27ter_rx_status(void *user_data, int status)
 {
     printf("V.27ter rx status is %s (%d)\n", signal_status_to_str(status), status);
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -131,10 +130,9 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static int v27ter_tx_status(void *user_data, int status)
+static void v27ter_tx_status(void *user_data, int status)
 {
     printf("V.27ter tx status is %s (%d)\n", signal_status_to_str(status), status);
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 

Modified: freeswitch/trunk/libs/spandsp/tests/v29_tests.c
==============================================================================
--- freeswitch/trunk/libs/spandsp/tests/v29_tests.c	(original)
+++ freeswitch/trunk/libs/spandsp/tests/v29_tests.c	Fri Feb 20 12:25:22 2009
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v29_tests.c,v 1.113 2009/01/12 17:20:59 steveu Exp $
+ * $Id: v29_tests.c,v 1.115 2009/02/12 14:21:16 steveu Exp $
  */
 
 /*! \page v29_tests_page V.29 modem tests
@@ -109,7 +109,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static int v29_rx_status(void *user_data, int status)
+static void v29_rx_status(void *user_data, int status)
 {
     v29_rx_state_t *rx;
     int i;
@@ -139,7 +139,6 @@
 #endif
         break;
     }
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -161,10 +160,9 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static int v29_tx_status(void *user_data, int status)
+static void v29_tx_status(void *user_data, int status)
 {
     printf("V.29 tx status is %s (%d)\n", signal_status_to_str(status), status);
-    return 0;
 }
 /*- End of function --------------------------------------------------------*/
 



More information about the Freeswitch-svn mailing list