mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-17 14:58:34 +00:00
More cleanups of fax modem stuff
This commit is contained in:
1 parent
b515a1f8f9
commit
11cc977391
4 files changed
+62
-138
No files matched your search
+24
-39
@@ -1764,7 +1764,7 @@ static int restart_modem(t31_state_t *s, int new_modem)
|
||||
case FAX_MODEM_V17_RX:
|
||||
if (!s->t38_mode)
|
||||
{
|
||||
fax_modems_set_rx_handler(t, (span_rx_handler_t) &v17_v21_rx, s, (span_rx_fillin_handler_t) &fax_modems_v17_v21_rx_fillin, &s->audio.modems);
|
||||
fax_modems_set_rx_handler(t, (span_rx_handler_t) &v17_v21_rx, t, (span_rx_fillin_handler_t) &fax_modems_v17_v21_rx_fillin, t);
|
||||
v17_rx_restart(&t->fast_modems.v17_rx, s->bit_rate, s->short_train);
|
||||
/* Allow for +FCERROR/+FRH:3 */
|
||||
t31_v21_rx(s);
|
||||
@@ -1801,7 +1801,7 @@ static int restart_modem(t31_state_t *s, int new_modem)
|
||||
case FAX_MODEM_V27TER_RX:
|
||||
if (!s->t38_mode)
|
||||
{
|
||||
fax_modems_set_rx_handler(t, (span_rx_handler_t) &v27ter_v21_rx, s, (span_rx_fillin_handler_t) &fax_modems_v27ter_v21_rx_fillin, &s->audio.modems);
|
||||
fax_modems_set_rx_handler(t, (span_rx_handler_t) &v27ter_v21_rx, t, (span_rx_fillin_handler_t) &fax_modems_v27ter_v21_rx_fillin, t);
|
||||
v27ter_rx_restart(&t->fast_modems.v27ter_rx, s->bit_rate, FALSE);
|
||||
/* Allow for +FCERROR/+FRH:3 */
|
||||
t31_v21_rx(s);
|
||||
@@ -1838,7 +1838,7 @@ static int restart_modem(t31_state_t *s, int new_modem)
|
||||
case FAX_MODEM_V29_RX:
|
||||
if (!s->t38_mode)
|
||||
{
|
||||
fax_modems_set_rx_handler(t, (span_rx_handler_t) &v29_v21_rx, s, (span_rx_fillin_handler_t) &fax_modems_v29_v21_rx_fillin, &s->audio.modems);
|
||||
fax_modems_set_rx_handler(t, (span_rx_handler_t) &v29_v21_rx, t, (span_rx_fillin_handler_t) &fax_modems_v29_v21_rx_fillin, t);
|
||||
v29_rx_restart(&t->fast_modems.v29_rx, s->bit_rate, FALSE);
|
||||
/* Allow for +FCERROR/+FRH:3 */
|
||||
t31_v21_rx(s);
|
||||
@@ -2298,12 +2298,11 @@ static int cng_rx(void *user_data, const int16_t amp[], int len)
|
||||
|
||||
static int v17_v21_rx(void *user_data, const int16_t amp[], int len)
|
||||
{
|
||||
t31_state_t *t;
|
||||
fax_modems_state_t *s;
|
||||
|
||||
t = (t31_state_t *) user_data;
|
||||
s = &t->audio.modems;
|
||||
s = (fax_modems_state_t *) user_data;
|
||||
v17_rx(&s->fast_modems.v17_rx, amp, len);
|
||||
fsk_rx(&s->v21_rx, amp, len);
|
||||
if (s->rx_trained)
|
||||
{
|
||||
/* The fast modem has trained, so we no longer need to run the slow
|
||||
@@ -2311,16 +2310,12 @@ static int v17_v21_rx(void *user_data, const int16_t amp[], int len)
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.17 (%.2fdBm0)\n", v17_rx_signal_power(&s->fast_modems.v17_rx));
|
||||
fax_modems_set_rx_handler(s, (span_rx_handler_t) &v17_rx, &s->fast_modems.v17_rx, (span_rx_fillin_handler_t) &v17_rx_fillin, &s->fast_modems.v17_rx);
|
||||
}
|
||||
else
|
||||
else if (s->rx_frame_received)
|
||||
{
|
||||
fsk_rx(&s->v21_rx, amp, len);
|
||||
if (t->rx_frame_received)
|
||||
{
|
||||
/* We have received something, and the fast modem has not trained. We must
|
||||
be receiving valid V.21 */
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
|
||||
fax_modems_set_rx_handler(s, (span_rx_handler_t) &fsk_rx, &s->v21_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &s->v21_rx);
|
||||
}
|
||||
/* We have received something, and the fast modem has not trained. We must
|
||||
be receiving valid V.21 */
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.17 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
|
||||
fax_modems_set_rx_handler(s, (span_rx_handler_t) &fsk_rx, &s->v21_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &s->v21_rx);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
@@ -2328,12 +2323,11 @@ static int v17_v21_rx(void *user_data, const int16_t amp[], int len)
|
||||
|
||||
static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len)
|
||||
{
|
||||
t31_state_t *t;
|
||||
fax_modems_state_t *s;
|
||||
|
||||
t = (t31_state_t *) user_data;
|
||||
s = &t->audio.modems;
|
||||
s = (fax_modems_state_t *) user_data;
|
||||
v27ter_rx(&s->fast_modems.v27ter_rx, amp, len);
|
||||
fsk_rx(&s->v21_rx, amp, len);
|
||||
if (s->rx_trained)
|
||||
{
|
||||
/* The fast modem has trained, so we no longer need to run the slow
|
||||
@@ -2341,16 +2335,12 @@ static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len)
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.27ter (%.2fdBm0)\n", v27ter_rx_signal_power(&s->fast_modems.v27ter_rx));
|
||||
fax_modems_set_rx_handler(s, (span_rx_handler_t) &v27ter_rx, &s->fast_modems.v27ter_rx, (span_rx_fillin_handler_t) &v27ter_rx_fillin, &s->fast_modems.v27ter_rx);
|
||||
}
|
||||
else
|
||||
else if (s->rx_frame_received)
|
||||
{
|
||||
fsk_rx(&s->v21_rx, amp, len);
|
||||
if (t->rx_frame_received)
|
||||
{
|
||||
/* We have received something, and the fast modem has not trained. We must
|
||||
be receiving valid V.21 */
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
|
||||
fax_modems_set_rx_handler(s, (span_rx_handler_t) &fsk_rx, &s->v21_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &s->v21_rx);
|
||||
}
|
||||
/* We have received something, and the fast modem has not trained. We must
|
||||
be receiving valid V.21 */
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.27ter + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
|
||||
fax_modems_set_rx_handler(s, (span_rx_handler_t) &fsk_rx, &s->v21_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &s->v21_rx);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
@@ -2358,12 +2348,11 @@ static int v27ter_v21_rx(void *user_data, const int16_t amp[], int len)
|
||||
|
||||
static int v29_v21_rx(void *user_data, const int16_t amp[], int len)
|
||||
{
|
||||
t31_state_t *t;
|
||||
fax_modems_state_t *s;
|
||||
|
||||
t = (t31_state_t *) user_data;
|
||||
s = &t->audio.modems;
|
||||
s = (fax_modems_state_t *) user_data;
|
||||
v29_rx(&s->fast_modems.v29_rx, amp, len);
|
||||
fsk_rx(&s->v21_rx, amp, len);
|
||||
if (s->rx_trained)
|
||||
{
|
||||
/* The fast modem has trained, so we no longer need to run the slow
|
||||
@@ -2371,16 +2360,12 @@ static int v29_v21_rx(void *user_data, const int16_t amp[], int len)
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.29 (%.2fdBm0)\n", v29_rx_signal_power(&s->fast_modems.v29_rx));
|
||||
fax_modems_set_rx_handler(s, (span_rx_handler_t) &v29_rx, &s->fast_modems.v29_rx, (span_rx_fillin_handler_t) &v29_rx_fillin, &s->fast_modems.v29_rx);
|
||||
}
|
||||
else
|
||||
else if (s->rx_frame_received)
|
||||
{
|
||||
fsk_rx(&s->v21_rx, amp, len);
|
||||
if (t->rx_frame_received)
|
||||
{
|
||||
/* We have received something, and the fast modem has not trained. We must
|
||||
be receiving valid V.21 */
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
|
||||
fax_modems_set_rx_handler(s, (span_rx_handler_t) &fsk_rx, &s->v21_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &s->v21_rx);
|
||||
}
|
||||
/* We have received something, and the fast modem has not trained. We must
|
||||
be receiving valid V.21 */
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Switching from V.29 + V.21 to V.21 (%.2fdBm0)\n", fsk_rx_signal_power(&s->v21_rx));
|
||||
fax_modems_set_rx_handler(s, (span_rx_handler_t) &fsk_rx, &s->v21_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &s->v21_rx);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user