[asterisk-commits] irroot: branch irroot/distrotech-customers-trunk r339204 - /team/irroot/distr...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 4 02:01:34 CDT 2011


Author: irroot
Date: Tue Oct  4 02:01:31 2011
New Revision: 339204

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=339204
Log:
Remove the result from the faxdetect struct fixup some issues on RB1116

Modified:
    team/irroot/distrotech-customers-trunk/res/res_fax.c

Modified: team/irroot/distrotech-customers-trunk/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-trunk/res/res_fax.c?view=diff&rev=339204&r1=339203&r2=339204
==============================================================================
--- team/irroot/distrotech-customers-trunk/res/res_fax.c (original)
+++ team/irroot/distrotech-customers-trunk/res/res_fax.c Tue Oct  4 02:01:31 2011
@@ -283,8 +283,6 @@
 	struct ast_format orig_format;
 	/*! \brief Noise limit to end faxdetect */
 	int noiselim;
-	/*! \brief result of the framehook e[CED]/f[CNG]/n[Noise]/t[T38] */
-	int result;
 	/*! \brief fax session details */
 	struct ast_fax_session_details *details;
 };
@@ -3171,7 +3169,6 @@
 	}
 
 	faxdetect->noiselim = noiselim;
-	faxdetect->result = 0;
 
 	if (timeout) {
 		faxdetect->timeout_start = ast_tvnow();
@@ -3187,7 +3184,7 @@
 	}
 
 	ast_dsp_set_features(faxdetect->dsp, DSP_FEATURE_FAX_DETECT);
-	ast_dsp_set_faxmode(faxdetect->dsp, dsp_detect_flag || DSP_FAXMODE_DETECT_SQUELCH);
+	ast_dsp_set_faxmode(faxdetect->dsp, dsp_detect_flag | DSP_FAXMODE_DETECT_SQUELCH);
 	ast_dsp_set_threshold(faxdetect->dsp, ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE));
 	return faxdetect;
 }
@@ -3217,6 +3214,7 @@
 	struct ast_control_t38_parameters *control_params;
 	struct ast_channel *peer;
 	int dspnoise;
+	int result = 0;
 
 	details = faxdetect->details;
 
@@ -3293,11 +3291,11 @@
 	if (f->frametype == AST_FRAME_VOICE) {
 		f = ast_dsp_process(chan, faxdetect->dsp, f);
 		if (f->frametype == AST_FRAME_DTMF) {
-			faxdetect->result = f->subclass.integer;
+			result = f->subclass.integer;
 		} else if ((f->frametype == AST_FRAME_VOICE) && (faxdetect->noiselim > 0)) {
 			ast_dsp_noise(faxdetect->dsp, f, &dspnoise);
 			if (dspnoise > faxdetect->noiselim) {
-				faxdetect->result = 'n';
+				result = 'n';
 			}
 		}
 	} else if ((f->frametype == AST_FRAME_CONTROL) && (f->datalen == sizeof(struct ast_control_t38_parameters))) {
@@ -3305,18 +3303,18 @@
 		switch (control_params->request_response) {
 		case AST_T38_NEGOTIATED:
 		case AST_T38_REQUEST_NEGOTIATE:
-			faxdetect->result = 't';
+			result = 't';
 			break;
 		default:
 			break;
 		}
 	} else if (f->frametype == AST_FRAME_DTMF) {
-		faxdetect->result = f->subclass.integer;
-	}
-
-	if (faxdetect->result) {
+		result = f->subclass.integer;
+	}
+
+	if (result) {
 		const char *target_context = S_OR(chan->macrocontext, chan->context);
-		switch (faxdetect->result) {
+		switch (result) {
 		case 'f':
 		case 't':
 			ast_channel_unlock(chan);
@@ -3324,7 +3322,7 @@
 			    S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
 				ast_channel_lock(chan);
 				ast_verbose(VERBOSE_PREFIX_2 "Redirecting '%s' to fax extension due to %s detection\n",
-					chan->name, (faxdetect->result == 'f') ? "CNG" : "T38");
+					chan->name, (result == 'f') ? "CNG" : "T38");
 				pbx_builtin_setvar_helper(chan, "FAXEXTEN", chan->exten);
 				if (ast_async_goto(chan, target_context, "fax", 1)) {
 					ast_log(LOG_NOTICE, "Failed to async goto '%s' into fax of '%s'\n", chan->name, target_context);
@@ -3334,7 +3332,7 @@
 			} else {
 				ast_channel_lock(chan);
 				ast_log(LOG_NOTICE, "FAX %s detected but no fax extension\n",
-					(faxdetect->result == 'f') ? "CNG" : "T38");
+					(result == 'f') ? "CNG" : "T38");
 			}
 		}
 		ast_framehook_detach(chan, details->faxdetect_id);
@@ -3381,7 +3379,6 @@
 	ast_channel_unlock(chan);
 
 	if (details->faxdetect_id < 0) {
-		ao2_ref(details, -1);
 		ao2_ref(faxdetect, -1);
 		return NULL;
 	}




More information about the asterisk-commits mailing list