[asterisk-commits] irroot: branch irroot/t38gateway-1.8 r333335 - /team/irroot/t38gateway-1.8/res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Aug 26 04:38:18 CDT 2011
Author: irroot
Date: Fri Aug 26 04:38:13 2011
New Revision: 333335
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=333335
Log:
Fixup gwtimeout code and add back CED detection with V.21
Modified:
team/irroot/t38gateway-1.8/res/res_fax.c
Modified: team/irroot/t38gateway-1.8/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/t38gateway-1.8/res/res_fax.c?view=diff&rev=333335&r1=333334&r2=333335
==============================================================================
--- team/irroot/t38gateway-1.8/res/res_fax.c (original)
+++ team/irroot/t38gateway-1.8/res/res_fax.c Fri Aug 26 04:38:13 2011
@@ -2505,13 +2505,13 @@
gateway->framehook = -1;
ast_dsp_set_features(gateway->chan_dsp, DSP_FEATURE_FAX_DETECT);
- ast_dsp_set_faxmode(gateway->chan_dsp, DSP_FAXMODE_DETECT_V21);
+ ast_dsp_set_faxmode(gateway->chan_dsp, DSP_FAXMODE_DETECT_V21 | DSP_FAXMODE_DETECT_CED);
ast_dsp_set_features(gateway->peer_dsp, DSP_FEATURE_FAX_DETECT);
- ast_dsp_set_faxmode(gateway->peer_dsp, DSP_FAXMODE_DETECT_V21);
+ ast_dsp_set_faxmode(gateway->peer_dsp, DSP_FAXMODE_DETECT_V21 | DSP_FAXMODE_DETECT_CED);
details->caps = AST_FAX_TECH_GATEWAY;
- if (details->gateway_timeout && !(gateway->s = fax_session_reserve(details, &gateway->token))) {
+ if (!(gateway->s = fax_session_reserve(details, &gateway->token))) {
details->caps |= ~AST_FAX_TECH_GATEWAY;
ast_log(LOG_ERROR, "Can't reserve a FAX session, gateway attempt failed.\n");
ao2_ref(gateway, -1);
@@ -2595,7 +2595,6 @@
gateway->t38_state = T38_STATE_NEGOTIATING;
gateway->timeout_start = ast_tvnow();
- details->gateway_timeout = FAX_GATEWAY_TIMEOUT;
ast_debug(1, "requesting T.38 for gateway session for %s\n", chan->name);
return fp;
@@ -2615,13 +2614,13 @@
return f;
}
- if (!(dfr = ast_dsp_process(active, active_dsp, dfr))) {
+ if ((dfr->frametype != AST_FRAME_DTMF) && !(dfr = ast_dsp_process(active, active_dsp, dfr))) {
return f;
}
- if (dfr->frametype == AST_FRAME_DTMF && dfr->subclass.integer == 'g') {
- gateway->detected_v21 = 1;
+ if (dfr->frametype == AST_FRAME_DTMF && ((dfr->subclass.integer == 'e') || (dfr->subclass.integer == 'g'))) {
if (ast_channel_get_t38_state(other) == T38_STATE_UNKNOWN) {
+ gateway->detected_v21 = 1;
ast_debug(1, "detected v21 preamble from %s\n", active->name);
return fax_gateway_request_t38(gateway, chan, f);
} else {
@@ -2688,7 +2687,6 @@
t38_parameters_ast_to_fax(&details->their_t38_parameters, control_params);
gateway->t38_state = T38_STATE_UNKNOWN;
gateway->timeout_start = ast_tvnow();
- details->gateway_timeout = FAX_GATEWAY_TIMEOUT;
ao2_ref(details, -1);
return f;
} else if (state == T38_STATE_UNAVAILABLE || state == T38_STATE_REJECTED) {
@@ -2726,7 +2724,6 @@
t38_parameters_ast_to_fax(&details->their_t38_parameters, control_params);
gateway->t38_state = T38_STATE_UNKNOWN;
gateway->timeout_start = ast_tvnow();
- details->gateway_timeout = FAX_GATEWAY_TIMEOUT;
ast_debug(1, "%s is attempting to negotiate T.38 after we already sent a negotiation request based on v21 preamble detection\n", active->name);
ao2_ref(details, -1);
@@ -2970,9 +2967,7 @@
return f;
}
- if (details->gateway_timeout) {
- gateway->timeout_start = ast_tvnow();
- }
+ gateway->timeout_start = ast_tvnow();
/* we are bridged, change r/w formats to SLIN for v21 preamble
* detection and T.30 */
@@ -2992,14 +2987,14 @@
gateway->bridged = 1;
}
- if (gateway->bridged && !ast_tvzero(gateway->timeout_start)) {
+ if (details->gateway_timeout && gateway->bridged && !ast_tvzero(gateway->timeout_start)) {
if (ast_tvdiff_ms(ast_tvnow(), gateway->timeout_start) > details->gateway_timeout) {
- ast_debug(1, "no fax activity between %s and %s after %d ms, disabling gateway\n", chan->name, peer->name, FAX_GATEWAY_TIMEOUT);
+ ast_debug(1, "no fax activity between %s and %s after %d ms, disabling gateway\n", chan->name, peer->name, details->gateway_timeout);
ast_framehook_detach(chan, gateway->framehook);
details->gateway_id = -1;
ast_string_field_set(details, result, "FAILED");
- ast_string_field_build(details, resultstr, "no fax activity after %d ms", FAX_GATEWAY_TIMEOUT);
+ ast_string_field_build(details, resultstr, "no fax activity after %d ms", details->gateway_timeout);
ast_string_field_set(details, error, "TIMEOUT");
set_channel_variables(chan, details);
ao2_ref(details, -1);
More information about the asterisk-commits
mailing list