mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-05-03 14:56:17 +00:00
Tweaks to formatting and minor steps towards T.38 support in T.31
This commit is contained in:
parent
5bba01f5c3
commit
10152cd336
@ -32,6 +32,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mod_spandsp.h"
|
#include "mod_spandsp.h"
|
||||||
|
#include "udptl.h"
|
||||||
#include "mod_spandsp_modem.h"
|
#include "mod_spandsp_modem.h"
|
||||||
|
|
||||||
#if defined(MODEM_SUPPORT)
|
#if defined(MODEM_SUPPORT)
|
||||||
@ -39,6 +40,12 @@
|
|||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define LOCAL_FAX_MAX_DATAGRAM 400
|
||||||
|
#define MAX_FEC_ENTRIES 4
|
||||||
|
#define MAX_FEC_SPAN 4
|
||||||
|
#define DEFAULT_FEC_ENTRIES 3
|
||||||
|
#define DEFAULT_FEC_SPAN 3
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
int NEXT_ID;
|
int NEXT_ID;
|
||||||
int REF_COUNT;
|
int REF_COUNT;
|
||||||
@ -70,6 +77,10 @@ static struct modem_state MODEM_STATE[] = {
|
|||||||
|
|
||||||
static modem_t *acquire_modem(int index);
|
static modem_t *acquire_modem(int index);
|
||||||
|
|
||||||
|
static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int t31_at_tx_handler(at_state_t *s, void *user_data, const uint8_t *buf, size_t len)
|
static int t31_at_tx_handler(at_state_t *s, void *user_data, const uint8_t *buf, size_t len)
|
||||||
{
|
{
|
||||||
@ -337,12 +348,13 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl
|
|||||||
modem->threadAbort = CreateEvent(NULL, TRUE, FALSE, NULL);
|
modem->threadAbort = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!(modem->t31_state = t31_init(NULL, t31_at_tx_handler, modem, t31_call_control_handler, modem, NULL, NULL))) {
|
if (!(modem->t31_state = t31_init(NULL, t31_at_tx_handler, modem, t31_call_control_handler, modem, t38_tx_packet_handler, modem))) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot initialize the T.31 modem\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot initialize the T.31 modem\n");
|
||||||
modem_close(modem);
|
modem_close(modem);
|
||||||
status = SWITCH_STATUS_FALSE;
|
status = SWITCH_STATUS_FALSE;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
modem->t38_core = t31_get_t38_core_state(modem->t31_state);
|
||||||
|
|
||||||
if (spandsp_globals.modem_verbose) {
|
if (spandsp_globals.modem_verbose) {
|
||||||
logging = t31_get_logging_state(modem->t31_state);
|
logging = t31_get_logging_state(modem->t31_state);
|
||||||
@ -360,6 +372,10 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl
|
|||||||
logging = v27ter_rx_get_logging_state(&modem->t31_state->audio.modems.fast_modems.v27ter_rx);
|
logging = v27ter_rx_get_logging_state(&modem->t31_state->audio.modems.fast_modems.v27ter_rx);
|
||||||
span_log_set_message_handler(logging, spanfax_log_message, NULL);
|
span_log_set_message_handler(logging, spanfax_log_message, NULL);
|
||||||
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
||||||
|
|
||||||
|
logging = t38_core_get_logging_state(modem->t38_core);
|
||||||
|
span_log_set_message_handler(logging, spanfax_log_message, NULL);
|
||||||
|
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
modem->control_handler = control_handler;
|
modem->control_handler = control_handler;
|
||||||
@ -391,6 +407,7 @@ struct private_object {
|
|||||||
switch_codec_t read_codec;
|
switch_codec_t read_codec;
|
||||||
switch_codec_t write_codec;
|
switch_codec_t write_codec;
|
||||||
switch_frame_t read_frame;
|
switch_frame_t read_frame;
|
||||||
|
udptl_state_t udptl_state;
|
||||||
unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
|
unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
|
||||||
switch_timer_t timer;
|
switch_timer_t timer;
|
||||||
modem_t *modem;
|
modem_t *modem;
|
||||||
|
@ -120,6 +120,7 @@ typedef enum {
|
|||||||
|
|
||||||
struct modem {
|
struct modem {
|
||||||
t31_state_t *t31_state;
|
t31_state_t *t31_state;
|
||||||
|
t38_core_state_t *t38_core;
|
||||||
char digits[512];
|
char digits[512];
|
||||||
modem_flags flags;
|
modem_flags flags;
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
Loading…
x
Reference in New Issue
Block a user