]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
This should fix the FAX crashes when negotiation falls back to slower modems
authorSteve Underwood <steveu@haswell.coppice.org>
Thu, 5 Dec 2013 13:49:59 +0000 (21:49 +0800)
committerSteve Underwood <steveu@haswell.coppice.org>
Thu, 5 Dec 2013 13:49:59 +0000 (21:49 +0800)
libs/spandsp/src/fax.c
libs/spandsp/src/fax_modems.c
libs/spandsp/src/spandsp/fax_modems.h
libs/spandsp/src/t38_gateway.c

index ddc45a04d8372d46025cbb73bc03d40eacdf2453..196c9ab0d38056fa2853c83b229cb6c86fef58eb 100644 (file)
@@ -256,8 +256,7 @@ static void fax_set_rx_type(void *user_data, int type, int bit_rate, int short_t
         return;
     t->current_rx_type = type;
     t->rx_bit_rate = bit_rate;
-    if (use_hdlc)
-        hdlc_rx_init(&t->hdlc_rx, false, true, HDLC_FRAMING_OK_THRESHOLD, t30_hdlc_accept, &s->t30);
+    hdlc_rx_init(&t->hdlc_rx, false, true, HDLC_FRAMING_OK_THRESHOLD, fax_modems_hdlc_accept, t);
 
     switch (type)
     {
index 14f4db0fe339cde027e921c13a8c8498e12d6ec4..74d71ecc298026958615bccd620e1d91d18909c0 100644 (file)
@@ -151,7 +151,8 @@ SPAN_DECLARE(const char *) fax_modem_to_str(int modem)
 }
 /*- End of function --------------------------------------------------------*/
 
-static void fax_modems_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok)
+//static void fax_modems_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok)
+SPAN_DECLARE(void) fax_modems_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok)
 {
     fax_modems_state_t *s;
 
@@ -427,9 +428,13 @@ SPAN_DECLARE(void) fax_modems_start_fast_modem(fax_modems_state_t *s, int which,
 #if defined(SPANDSP_SUPPORT_V34)
         case FAX_MODEM_V34_RX:
             v34_init(&s->fast_modems.v34, 2400, s->bit_rate, true, false, NULL, NULL, put_bit, put_bit_user_data);
+            //fax_modems_set_tx_handler(s, (span_tx_handler_t) &v34_rx, &s->fast_modems.v34_rx);
+            fax_modems_set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL);
             break;
         case FAX_MODEM_V34_TX:
             v34_init(&s->fast_modems.v34, 2400, s->bit_rate, true, false, get_bit, get_bit_user_data, NULL, NULL);
+            //fax_modems_set_tx_handler(s, (span_tx_handler_t) &v34_tx, &s->fast_modems.v34_tx);
+            fax_modems_set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL);
             break;
 #endif
         }
@@ -476,6 +481,18 @@ SPAN_DECLARE(void) fax_modems_start_fast_modem(fax_modems_state_t *s, int which,
             fax_modems_set_tx_handler(s, (span_tx_handler_t) &v17_tx, &s->fast_modems.v17_tx);
             fax_modems_set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL);
             break;
+#if defined(SPANDSP_SUPPORT_V34)
+        case FAX_MODEM_V34_RX:
+            v34_restart(&s->fast_modems.v34, 2400, s->bit_rate, false);
+            //fax_modems_set_tx_handler(s, (span_tx_handler_t) &v34_rx, &s->fast_modems.v34_rx);
+            fax_modems_set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL);
+            break;
+        case FAX_MODEM_V34_TX:
+            v34_restart(&s->fast_modems.v34, 2400, s->bit_rate, false);
+            //fax_modems_set_tx_handler(s, (span_tx_handler_t) &v34_tx, &s->fast_modems.v34_tx);
+            fax_modems_set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL);
+            break;
+#endif
         }
         /*endswitch*/
     }
index 2ffb7be7c5819ad173ea23c77cc92bc127020072..3a6adf28c1343aecf5444fb454a4976900697cf2 100644 (file)
@@ -59,6 +59,8 @@ extern "C"
 {
 #endif
 
+SPAN_DECLARE(void) fax_modems_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok);
+
 /*! Convert a FAX modem type to a short text description.
     \brief Convert a FAX modem type to a short text description.
     \param modem The modem code.
index d89e21e0c47f3b8851ecc8afed68b0c760175faa..402c7cded2e8c8238246497042f61850b749aabb 100644 (file)
 #include "spandsp/v27ter_rx.h"
 #include "spandsp/v17tx.h"
 #include "spandsp/v17rx.h"
+#if defined(SPANDSP_SUPPORT_V34)
+#include "spandsp/bitstream.h"
+#include "spandsp/v34.h"
+#endif
 #include "spandsp/super_tone_rx.h"
 #include "spandsp/modem_connect_tones.h"
 #include "spandsp/timezone.h"
 #include "spandsp/private/silence_gen.h"
 #include "spandsp/private/power_meter.h"
 #include "spandsp/private/fsk.h"
+#if defined(SPANDSP_SUPPORT_V34)
+#include "spandsp/private/bitstream.h"
+#include "spandsp/private/v34.h"
+#endif
 #include "spandsp/private/v17tx.h"
 #include "spandsp/private/v17rx.h"
 #include "spandsp/private/v27ter_tx.h"