summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2009-07-09 21:20:23 +0000
committerKevin P. Fleming <kpfleming@digium.com>2009-07-09 21:20:23 +0000
commit67d1957e6061b9af3375777cb3f05c17dd1c059a (patch)
tree84a467f74170c5c87cf7fb70a663e1df1772c522
parent728fbf077e271e418168712e7763a8c7bf304277 (diff)
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: https://origsvn.digium.com/svn/asterisk/trunk@205696 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--apps/app_fax.c21
-rw-r--r--channels/chan_sip.c14
-rw-r--r--include/asterisk/frame.h2
3 files changed, 27 insertions, 10 deletions
diff --git a/apps/app_fax.c b/apps/app_fax.c
index 7c35d84a6..815bb84f2 100644
--- a/apps/app_fax.c
+++ b/apps/app_fax.c
@@ -459,7 +459,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,
};
@@ -476,7 +476,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.ptr, 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");
@@ -497,6 +496,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;
}
}
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 59a4793df..6d6078efd 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1545,7 +1545,7 @@ struct sip_auth {
#define T38FAX_TRANSCODING_MMR (1 << 1) /*!< Default: 0 (unset)*/
#define T38FAX_TRANSCODING_JBIG (1 << 2) /*!< Default: 0 (unset)*/
/* Rate management */
-#define T38FAX_RATE_MANAGEMENT_TRANSFERED_TCF (0 << 3)
+#define T38FAX_RATE_MANAGEMENT_TRANSFERRED_TCF (0 << 3)
#define T38FAX_RATE_MANAGEMENT_LOCAL_TCF (1 << 3) /*!< Unset for transferredTCF (UDPTL), set for localTCF (TPKT) */
/* UDP Error correction */
#define T38FAX_UDP_EC_NONE (0 << 4) /*!< two bits, if unset NO t38UDPEC field in T38 SDP*/
@@ -4913,8 +4913,8 @@ static void fill_t38_parameters(int capabilities, struct ast_control_t38_paramet
parameters->rate = AST_T38_RATE_2400;
}
- if (capabilities & T38FAX_RATE_MANAGEMENT_TRANSFERED_TCF) {
- parameters->rate_management = AST_T38_RATE_MANAGEMENT_TRANSFERED_TCF;
+ if (capabilities & T38FAX_RATE_MANAGEMENT_TRANSFERRED_TCF) {
+ parameters->rate_management = AST_T38_RATE_MANAGEMENT_TRANSFERRED_TCF;
} else if (capabilities & T38FAX_RATE_MANAGEMENT_LOCAL_TCF) {
parameters->rate_management = AST_T38_RATE_MANAGEMENT_LOCAL_TCF;
}
@@ -5009,7 +5009,7 @@ static void set_t38_capabilities(struct sip_pvt *p)
ast_udptl_set_error_correction_scheme(p->udptl, UDPTL_ERROR_CORRECTION_NONE);
p->t38.capability |= T38FAX_UDP_EC_NONE;
}
- p->t38.capability |= T38FAX_RATE_MANAGEMENT_TRANSFERED_TCF;
+ p->t38.capability |= T38FAX_RATE_MANAGEMENT_TRANSFERRED_TCF;
}
}
@@ -6447,8 +6447,8 @@ static void interpret_t38_parameters(struct sip_pvt *p, enum ast_control_t38 req
p->t38.capability = p->t38.jointcapability |= T38FAX_RATE_2400;
}
- if (parameters->rate_management == AST_T38_RATE_MANAGEMENT_TRANSFERED_TCF) {
- p->t38.capability = p->t38.jointcapability |= T38FAX_RATE_MANAGEMENT_TRANSFERED_TCF;
+ if (parameters->rate_management == AST_T38_RATE_MANAGEMENT_TRANSFERRED_TCF) {
+ p->t38.capability = p->t38.jointcapability |= T38FAX_RATE_MANAGEMENT_TRANSFERRED_TCF;
} else if (parameters->rate_management == AST_T38_RATE_MANAGEMENT_LOCAL_TCF) {
p->t38.capability = p->t38.jointcapability |= T38FAX_RATE_MANAGEMENT_LOCAL_TCF;
}
@@ -8600,7 +8600,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
if (!strcasecmp(s, "localTCF"))
peert38capability |= T38FAX_RATE_MANAGEMENT_LOCAL_TCF;
else if (!strcasecmp(s, "transferredTCF"))
- peert38capability |= T38FAX_RATE_MANAGEMENT_TRANSFERED_TCF;
+ peert38capability |= T38FAX_RATE_MANAGEMENT_TRANSFERRED_TCF;
} else if ((sscanf(a, "T38FaxUdpEC:%255s", s) == 1)) {
found = 1;
ast_debug(3, "UDP EC: %s\n", s);
diff --git a/include/asterisk/frame.h b/include/asterisk/frame.h
index c2022d683..e64800754 100644
--- a/include/asterisk/frame.h
+++ b/include/asterisk/frame.h
@@ -345,7 +345,7 @@ enum ast_control_t38_rate {
};
enum ast_control_t38_rate_management {
- AST_T38_RATE_MANAGEMENT_TRANSFERED_TCF = 0,
+ AST_T38_RATE_MANAGEMENT_TRANSFERRED_TCF = 0,
AST_T38_RATE_MANAGEMENT_LOCAL_TCF,
};