summaryrefslogtreecommitdiff
path: root/apps/app_fax.c
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2009-07-23 21:57:24 +0000
committerKevin P. Fleming <kpfleming@digium.com>2009-07-23 21:57:24 +0000
commit0a6e06c7ff1622a69d0d9ac040b3f2d660ca78ab (patch)
tree313c9cc69ea9355ffda83d57f668f3d4e7c829ba /apps/app_fax.c
parent88f1d1476628c40a72a64a0ead06c389e198d682 (diff)
Rework of T.38 negotiation and UDPTL API to address interoperability problems
Over the past couple of months, a number of issues with Asterisk negotiating (and successfully completing) T.38 sessions with various endpoints have been found. This patch attempts to address many of them, primarily focused around ensuring that the endpoints' MaxDatagram size is honored, and in addition by ensuring that T.38 session parameter negotiation is performed correctly according to the ITU T.38 Recommendation. The major changes here are: 1) T.38 applications in Asterisk (app_fax) only generate/receive IFP packets, they do not ever work with UDPTL packets. As a result of this, they cannot be allowed to generate packets that would overflow the other endpoints' MaxDatagram size after the UDPTL stack adds any error correction information. With this patch, the application is told the maximum *IFP* size it can generate, based on a calculation using the far end MaxDatagram size and the active error correction mode on the T.38 session. The same is true for sending *our* MaxDatagram size to the remote endpoint; it is computed from the value that the application says it can accept (for a single IFP packet) combined with the active error correction mode. 2) All treatment of T.38 session parameters as 'capabilities' in chan_sip has been removed; these parameters are not at all like audio/video stream capabilities. There are strict rules to follow for computing an answer to a T.38 offer, and chan_sip now follows those rules, using the desired parameters from the application (or channel) that wants to accept the T.38 negotiation. 3) chan_sip now stores and forwards ast_control_t38_parameters structures for tracking 'our' and 'their' T.38 session parameters; this greatly simplifies negotiation, especially for pass-through calls. 4) Since T.38 negotiation without specifying parameters or receiving the final negotiated parameters is not very worthwhile, the AST_CONTROL_T38 control frame has been removed. A note has been added to UPGRADE.txt about this removal, since any out-of-tree applications that use it will no longer function properly until they are upgraded to use AST_CONTROL_T38_PARAMETERS. Review: https://reviewboard.asterisk.org/r/310/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@208464 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_fax.c')
-rw-r--r--apps/app_fax.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/apps/app_fax.c b/apps/app_fax.c
index 6c132c162..c2156f0df 100644
--- a/apps/app_fax.c
+++ b/apps/app_fax.c
@@ -471,11 +471,12 @@ static int transmit_audio(fax_session *s)
if (fr && fr->frametype == AST_FRAME_DTMF && fr->subclass == 'f') {
struct ast_control_t38_parameters parameters = { .request_response = AST_T38_REQUEST_NEGOTIATE,
.version = 0,
- .max_datagram = 400,
+ .max_ifp = 800,
.rate = AST_T38_RATE_9600,
.rate_management = AST_T38_RATE_MANAGEMENT_TRANSFERRED_TCF,
.fill_bit_removal = 1,
.transcoding_mmr = 1,
+ .transcoding_jbig = 1,
};
ast_debug(1, "Fax tone detected. Requesting T38\n");
ast_indicate_data(s->chan, AST_CONTROL_T38_PARAMETERS, &parameters, sizeof(parameters));
@@ -509,20 +510,18 @@ static int transmit_audio(fax_session *s)
res = 1;
break;
} else if (parameters->request_response == AST_T38_REQUEST_NEGOTIATE) {
+ struct ast_control_t38_parameters our_parameters = { .request_response = AST_T38_NEGOTIATED,
+ .version = 0,
+ .max_ifp = 800,
+ .rate = AST_T38_RATE_9600,
+ .rate_management = AST_T38_RATE_MANAGEMENT_TRANSFERRED_TCF,
+ .fill_bit_removal = 1,
+ .transcoding_mmr = 1,
+ .transcoding_jbig = 1,
+ };
ast_debug(1, "T38 request received, accepting\n");
- if (parameters->version > 0) {
- /* Only T.38 Version 0 is supported at this time */
- parameters->version = 0;
- }
- if (parameters->max_datagram > 400) {
- /* Limit incoming datagram size to our default */
- /* TODO: this need to come from the udptl stack, not be hardcoded */
- parameters->max_datagram = 400;
- }
- /* we only support bit rates up to 9.6kbps */
- parameters->rate = AST_T38_RATE_9600;
/* Complete T38 switchover */
- ast_indicate_data(s->chan, AST_CONTROL_T38_PARAMETERS, parameters, sizeof(*parameters));
+ ast_indicate_data(s->chan, AST_CONTROL_T38_PARAMETERS, &our_parameters, sizeof(our_parameters));
/* Do not break audio loop, wait until channel driver finally acks switchover
with AST_T38_NEGOTIATED */
}
@@ -593,7 +592,7 @@ static int transmit_t38(fax_session *s)
return -1;
}
- t38_set_max_datagram_size(t38state, s->t38parameters.max_datagram);
+ t38_set_max_datagram_size(t38state, s->t38parameters.max_ifp);
if (s->t38parameters.fill_bit_removal) {
t38_set_fill_bit_removal(t38state, TRUE);