spandsp
0.0.6
Main Page
Related Pages
Classes
Files
File List
File Members
t38_gateway.h
Go to the documentation of this file.
1
/*
2
* SpanDSP - a series of DSP components for telephony
3
*
4
* t38_gateway.h - A T.38, less the packet exchange part
5
*
6
* Written by Steve Underwood <steveu@coppice.org>
7
*
8
* Copyright (C) 2005, 2006, 2007 Steve Underwood
9
*
10
* All rights reserved.
11
*
12
* This program is free software; you can redistribute it and/or modify
13
* it under the terms of the GNU Lesser General Public License version 2.1,
14
* as published by the Free Software Foundation.
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Lesser General Public License for more details.
20
*
21
* You should have received a copy of the GNU Lesser General Public
22
* License along with this program; if not, write to the Free Software
23
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24
*/
25
26
/*! \file */
27
28
#if !defined(_SPANDSP_T38_GATEWAY_H_)
29
#define _SPANDSP_T38_GATEWAY_H_
30
31
/*! \page t38_gateway_page T.38 real time FAX over IP PSTN gateway
32
\section t38_gateway_page_sec_1 What does it do?
33
34
The T.38 gateway facility provides a robust interface between T.38 IP packet streams and
35
and 8k samples/second audio streams. It provides the buffering and flow control features needed
36
to maximum the tolerance of jitter and packet loss on the IP network.
37
38
\section t38_gateway_page_sec_2 How does it work?
39
*/
40
41
/*! The receive buffer length */
42
#define T38_RX_BUF_LEN 2048
43
/*! The number of HDLC transmit buffers */
44
#define T38_TX_HDLC_BUFS 256
45
/*! The maximum length of an HDLC frame buffer. This must be big enough for ECM frames. */
46
#define T38_MAX_HDLC_LEN 260
47
48
typedef
struct
t38_gateway_state_s
t38_gateway_state_t
;
49
50
/*!
51
T.30 real time frame handler.
52
\brief T.30 real time frame handler.
53
\param s The T.30 context.
54
\param user_data An opaque pointer.
55
\param direction TRUE for incoming, FALSE for outgoing.
56
\param msg The HDLC message.
57
\param len The length of the message.
58
*/
59
typedef
void (
t38_gateway_real_time_frame_handler_t
)(
t38_gateway_state_t
*s,
60
void
*user_data,
61
int
direction,
62
const
uint8_t *msg,
63
int
len);
64
65
/*!
66
T.38 gateway results.
67
*/
68
typedef
struct
69
{
70
/*! \brief The current bit rate for image transfer. */
71
int
bit_rate
;
72
/*! \brief TRUE if error correcting mode is used. */
73
int
error_correcting_mode
;
74
/*! \brief The number of pages transferred so far. */
75
int
pages_transferred
;
76
}
t38_stats_t
;
77
78
#if defined(__cplusplus)
79
extern
"C"
80
{
81
#endif
82
83
/*! \brief Initialise a gateway mode T.38 context.
84
\param s The T.38 context.
85
\param tx_packet_handler A callback routine to encapsulate and transmit T.38 packets.
86
\param tx_packet_user_data An opaque pointer passed to the tx_packet_handler routine.
87
\return A pointer to the termination mode T.38 context, or NULL if there was a problem. */
88
SPAN_DECLARE(
t38_gateway_state_t
*)
t38_gateway_init
(
t38_gateway_state_t
*s,
89
t38_tx_packet_handler_t *tx_packet_handler,
90
void
*tx_packet_user_data);
91
92
/*! Release a gateway mode T.38 context.
93
\brief Release a T.38 context.
94
\param s The T.38 context.
95
\return 0 for OK, else -1. */
96
SPAN_DECLARE(
int
)
t38_gateway_release
(
t38_gateway_state_t
*s);
97
98
/*! Free a gateway mode T.38 context.
99
\brief Free a T.38 context.
100
\param s The T.38 context.
101
\return 0 for OK, else -1. */
102
SPAN_DECLARE(
int
)
t38_gateway_free
(
t38_gateway_state_t
*s);
103
104
/*! Process a block of received FAX audio samples.
105
\brief Process a block of received FAX audio samples.
106
\param s The T.38 context.
107
\param amp The audio sample buffer.
108
\param len The number of samples in the buffer.
109
\return The number of samples unprocessed. */
110
SPAN_DECLARE_NONSTD
(
int
) t38_gateway_rx(
t38_gateway_state_t
*s, int16_t amp[],
int
len);
111
112
/*! Apply fake processing when a block of audio samples is missing (e.g due
113
to packet loss).
114
\brief Apply fake received audio processing.
115
\param s The T.38 context.
116
\param len The number of samples to fake.
117
\return The number of samples unprocessed. This should only be non-zero if
118
the software has reached the end of the FAX call.
119
*/
120
SPAN_DECLARE_NONSTD
(
int
) t38_gateway_rx_fillin(
t38_gateway_state_t
*s,
int
len);
121
122
/*! Generate a block of FAX audio samples.
123
\brief Generate a block of FAX audio samples.
124
\param s The T.38 context.
125
\param amp The audio sample buffer.
126
\param max_len The number of samples to be generated.
127
\return The number of samples actually generated.
128
*/
129
SPAN_DECLARE_NONSTD
(
int
) t38_gateway_tx(
t38_gateway_state_t
*s, int16_t amp[],
int
max_len);
130
131
/*! Control whether error correcting mode (ECM) is allowed.
132
\brief Control whether error correcting mode (ECM) is allowed.
133
\param s The T.38 context.
134
\param ecm_allowed TRUE is ECM is to be allowed.
135
*/
136
SPAN_DECLARE(
void
)
t38_gateway_set_ecm_capability
(
t38_gateway_state_t
*s,
int
ecm_allowed);
137
138
/*! Select whether silent audio will be sent when transmit is idle.
139
\brief Select whether silent audio will be sent when transmit is idle.
140
\param s The T.38 context.
141
\param transmit_on_idle TRUE if silent audio should be output when the FAX transmitter is
142
idle. FALSE to transmit zero length audio when the FAX transmitter is idle. The default
143
behaviour is FALSE.
144
*/
145
SPAN_DECLARE(
void
)
t38_gateway_set_transmit_on_idle
(
t38_gateway_state_t
*s,
int
transmit_on_idle);
146
147
/*! Specify which modem types are supported by a T.30 context.
148
\brief Specify supported modems.
149
\param s The T.38 context.
150
\param supported_modems Bit field list of the supported modems.
151
*/
152
SPAN_DECLARE(
void
)
t38_gateway_set_supported_modems
(
t38_gateway_state_t
*s,
int
supported_modems);
153
154
/*! Select whether NSC, NSF, and NSS should be suppressed. It selected, the contents of
155
these messages are forced to zero for all octets beyond the message type. This makes
156
them look like manufacturer specific messages, from a manufacturer which does not exist.
157
\brief Select whether NSC, NSF, and NSS should be suppressed.
158
\param s The T.38 context.
159
\param from_t38 A string of bytes to overwrite the header of any NSC, NSF, and NSS
160
frames passing through the gateway from T.38 the the modem.
161
\param from_t38_len The length of the overwrite string.
162
\param from_modem A string of bytes to overwrite the header of any NSC, NSF, and NSS
163
frames passing through the gateway from the modem to T.38.
164
\param from_modem_len The length of the overwrite string.
165
*/
166
SPAN_DECLARE(
void
)
t38_gateway_set_nsx_suppression
(
t38_gateway_state_t
*s,
167
const
uint8_t *from_t38,
168
int
from_t38_len,
169
const
uint8_t *from_modem,
170
int
from_modem_len);
171
172
/*! Select whether talker echo protection tone will be sent for the image modems.
173
\brief Select whether TEP will be sent for the image modems.
174
\param s The T.38 context.
175
\param use_tep TRUE if TEP should be sent.
176
*/
177
SPAN_DECLARE(
void
)
t38_gateway_set_tep_mode
(
t38_gateway_state_t
*s,
int
use_tep);
178
179
/*! Select whether non-ECM fill bits are to be removed during transmission.
180
\brief Select whether non-ECM fill bits are to be removed during transmission.
181
\param s The T.38 context.
182
\param remove TRUE if fill bits are to be removed.
183
*/
184
SPAN_DECLARE(
void
)
t38_gateway_set_fill_bit_removal
(
t38_gateway_state_t
*s,
int
remove
);
185
186
/*! Get the current transfer statistics for the current T.38 session.
187
\brief Get the current transfer statistics.
188
\param s The T.38 context.
189
\param t A pointer to a buffer for the statistics. */
190
SPAN_DECLARE(
void
)
t38_gateway_get_transfer_statistics
(
t38_gateway_state_t
*s,
t38_stats_t
*t);
191
192
/*! Get a pointer to the T.38 core IFP packet engine associated with a
193
gateway mode T.38 context.
194
\brief Get a pointer to the T.38 core IFP packet engine associated
195
with a T.38 context.
196
\param s The T.38 context.
197
\return A pointer to the T.38 core context, or NULL.
198
*/
199
SPAN_DECLARE(
t38_core_state_t
*)
t38_gateway_get_t38_core_state
(
t38_gateway_state_t
*s);
200
201
/*! Get a pointer to the logging context associated with a T.38 context.
202
\brief Get a pointer to the logging context associated with a T.38 context.
203
\param s The T.38 context.
204
\return A pointer to the logging context, or NULL.
205
*/
206
SPAN_DECLARE(
logging_state_t
*)
t38_gateway_get_logging_state
(
t38_gateway_state_t
*s);
207
208
/*! Set a callback function for T.30 frame exchange monitoring. This is called from the heart
209
of the signal processing, so don't take too long in the handler routine.
210
\brief Set a callback function for T.30 frame exchange monitoring.
211
\param s The T.30 context.
212
\param handler The callback function.
213
\param user_data An opaque pointer passed to the callback function. */
214
SPAN_DECLARE(
void
)
t38_gateway_set_real_time_frame_handler
(
t38_gateway_state_t
*s,
215
t38_gateway_real_time_frame_handler_t
*handler,
216
void
*user_data);
217
218
#if defined(__cplusplus)
219
}
220
#endif
221
222
#endif
223
/*- End of file ------------------------------------------------------------*/
src
spandsp
t38_gateway.h
Generated on Thu Mar 20 2014 13:57:29 for spandsp by
1.8.1.2