From 3289e7b4303a715db17f57b7813fe5046d9d6c57 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Thu, 9 Jul 2009 21:26:00 +0000 Subject: Merged revisions 205696 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ........ r205696 | kpfleming | 2009-07-09 16:20:23 -0500 (Thu, 09 Jul 2009) | 16 lines Repair ability of SendFAX/ReceiveFAX to respond to T.38 switchover. Recent changes in T.38 negotiation in Asterisk caused these applications to not respond when the other endpoint initiated a switchover to T.38; this resulted in the T.38 switchover failing, and the FAX attempt to be made using an audio connection, instead of T.38 (which would usually cause the FAX to fail completely). This patch corrects this problem, and the applications will now correctly respond to the T.38 switchover request. In addition, the response will include the appopriate T.38 session parameters based on what the other end offered and what our end is capable of. (closes issue #14849) Reported by: afosorio ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@205697 f38db490-d61c-443f-a65b-d21fe96a405b --- apps/app_fax.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'apps') diff --git a/apps/app_fax.c b/apps/app_fax.c index 0fe861bb3..8b4f7403b 100644 --- a/apps/app_fax.c +++ b/apps/app_fax.c @@ -414,7 +414,7 @@ static int transmit_audio(fax_session *s) .version = 0, .max_datagram = 400, .rate = AST_T38_RATE_9600, - .rate_management = AST_T38_RATE_MANAGEMENT_TRANSFERED_TCF, + .rate_management = AST_T38_RATE_MANAGEMENT_TRANSFERRED_TCF, .fill_bit_removal = 1, .transcoding_mmr = 1, }; @@ -431,7 +431,6 @@ static int transmit_audio(fax_session *s) that a frame in old format was already queued before we set chanel format to slinear so it will still be received by ast_read */ if (inf->frametype == AST_FRAME_VOICE && inf->subclass == AST_FORMAT_SLINEAR) { - if (fax_rx(&fax, inf->data, inf->samples) < 0) { /* I know fax_rx never returns errors. The check here is for good style only */ ast_log(LOG_WARNING, "fax_rx returned error\n"); @@ -452,6 +451,24 @@ static int transmit_audio(fax_session *s) ast_debug(1, "T38 negotiated, finishing audio loop\n"); res = 1; break; + } else if (parameters->request_response == AST_T38_REQUEST_NEGOTIATE) { + 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; + ast_indicate_data(s->chan, AST_CONTROL_T38_PARAMETERS, parameters, sizeof(*parameters)); + /* T38 switchover completed */ + s->t38parameters = *parameters; + ast_debug(1, "T38 negotiated, finishing audio loop\n"); + res = 1; + break; } } -- cgit v1.2.3