[svn-commits] irroot: branch irroot/distrotech-customers-1.8 r339202 - /team/irroot/distrot...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Oct 4 01:59:37 CDT 2011


Author: irroot
Date: Tue Oct  4 01:59:33 2011
New Revision: 339202

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

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

Modified: team/irroot/distrotech-customers-1.8/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/res/res_fax.c?view=diff&rev=339202&r1=339201&r2=339202
==============================================================================
--- team/irroot/distrotech-customers-1.8/res/res_fax.c (original)
+++ team/irroot/distrotech-customers-1.8/res/res_fax.c Tue Oct  4 01:59:33 2011
@@ -277,8 +277,6 @@
 	unsigned int 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;
 };
@@ -3182,7 +3180,6 @@
 	}
 
 	faxdetect->noiselim = noiselim;
-	faxdetect->result = 0;
 
 	if (timeout) {
 		faxdetect->timeout_start = ast_tvnow();
@@ -3198,7 +3195,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;
 }
@@ -3228,6 +3225,7 @@
 	struct ast_control_t38_parameters *control_params;
 	struct ast_channel *peer;
 	int dspnoise;
+	int result = 0;
 
 	details = faxdetect->details;
 
@@ -3300,11 +3298,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))) {
@@ -3312,18 +3310,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);
@@ -3331,7 +3329,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);
@@ -3341,7 +3339,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);
@@ -3388,7 +3386,6 @@
 	ast_channel_unlock(chan);
 
 	if (details->faxdetect_id < 0) {
-		ao2_ref(details, -1);
 		ao2_ref(faxdetect, -1);
 		return NULL;
 	}




More information about the svn-commits mailing list