From 3569ef7e76c4b520be378bdac0b61f3cedf49a3b Mon Sep 17 00:00:00 2001 From: Patrice Fournier Date: Sun, 16 Dec 2018 18:23:21 -0500 Subject: [PATCH] Ignore superfluous T38_FIELD_HDLC_SIG_END sent by some implementations Ignore T38_FIELD_HDLC_SIG_END when received following a T38_FIELD_HDLC_FCS_OK_SIG_END or T38_FIELD_HDLC_FCS_BAD_SIG_END --- src/t31.c | 6 ++++-- src/t38_gateway.c | 6 ++++-- src/t38_terminal.c | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/t31.c b/src/t31.c index eb311fce..fb71c690 100644 --- a/src/t31.c +++ b/src/t31.c @@ -643,8 +643,10 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, /*endif*/ /* Some T.38 implementations send multiple T38_FIELD_HDLC_SIG_END messages, in IFP packets with incrementing sequence numbers, which are actually repeats. They get through to this point because - of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ - if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + of the incrementing sequence numbers. Some others send T38_FIELD_HDLC_SIG_END following a + T38_FIELD_HDLC_FCS_OK_SIG_END or T38_FIELD_HDLC_FCS_BAD_SIG_END. We need to filter them here + in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || (t->current_rx_field_type != field_type && t->current_rx_field_type != T38_FIELD_HDLC_FCS_OK_SIG_END && t->current_rx_field_type != T38_FIELD_HDLC_FCS_BAD_SIG_END)) { /* WORKAROUND: At least some Mediatrix boxes have a bug, where they can send this message at the end of non-ECM data. We need to tolerate this. We use the generic receive complete diff --git a/src/t38_gateway.c b/src/t38_gateway.c index 2ec3cac1..e2ebb89d 100644 --- a/src/t38_gateway.c +++ b/src/t38_gateway.c @@ -1308,8 +1308,10 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, /*endif*/ /* Some T.38 implementations send multiple T38_FIELD_HDLC_SIG_END messages, in IFP packets with incrementing sequence numbers, which are actually repeats. They get through to this point because - of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ - if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + of the incrementing sequence numbers. Some others send T38_FIELD_HDLC_SIG_END following a + T38_FIELD_HDLC_FCS_OK_SIG_END or T38_FIELD_HDLC_FCS_BAD_SIG_END. We need to filter them here + in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || (t->current_rx_field_type != field_type && t->current_rx_field_type != T38_FIELD_HDLC_FCS_OK_SIG_END && t->current_rx_field_type != T38_FIELD_HDLC_FCS_BAD_SIG_END)) { if (hdlc_buf->contents != (data_type | FLAG_DATA)) { diff --git a/src/t38_terminal.c b/src/t38_terminal.c index 1a1f8a8b..122ae731 100644 --- a/src/t38_terminal.c +++ b/src/t38_terminal.c @@ -534,8 +534,10 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, /*endif*/ /* Some T.38 implementations send multiple T38_FIELD_HDLC_SIG_END messages, in IFP packets with incrementing sequence numbers, which are actually repeats. They get through to this point because - of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ - if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type) + of the incrementing sequence numbers. Some others send T38_FIELD_HDLC_SIG_END following a + T38_FIELD_HDLC_FCS_OK_SIG_END or T38_FIELD_HDLC_FCS_BAD_SIG_END. We need to filter them here + in a context sensitive manner. */ + if (t->current_rx_data_type != data_type || (t->current_rx_field_type != field_type && t->current_rx_field_type != T38_FIELD_HDLC_FCS_OK_SIG_END && t->current_rx_field_type != T38_FIELD_HDLC_FCS_BAD_SIG_END)) { /* WORKAROUND: At least some Mediatrix boxes have a bug, where they can send this message at the end of non-ECM data. We need to tolerate this. We use the generic receive complete