[asterisk-commits] irroot: branch irroot/distrotech-customers-trunk r329388 - in /team/irroot/di...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jul 24 05:09:14 CDT 2011


Author: irroot
Date: Sun Jul 24 05:09:10 2011
New Revision: 329388

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=329388
Log:
Noise detect in waitfax
do not squelch v21 it has no squelch
fix props on file

Modified:
    team/irroot/distrotech-customers-trunk/main/dsp.c
    team/irroot/distrotech-customers-trunk/res/res_fax.c
    team/irroot/distrotech-customers-trunk/sounds/Makefile   (props changed)

Modified: team/irroot/distrotech-customers-trunk/main/dsp.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-trunk/main/dsp.c?view=diff&rev=329388&r1=329387&r2=329388
==============================================================================
--- team/irroot/distrotech-customers-trunk/main/dsp.c (original)
+++ team/irroot/distrotech-customers-trunk/main/dsp.c Sun Jul 24 05:09:10 2011
@@ -530,7 +530,6 @@
 	if (s->faxmode & DSP_FAXMODE_DETECT_SQUELCH) {
 		s->cng_tone_state.squelch = 1;
 		s->ced_tone_state.squelch = 1;
-		s->v21_state.squelch = 1;
 	}
 
 }

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=329388&r1=329387&r2=329388
==============================================================================
--- team/irroot/distrotech-customers-trunk/res/res_fax.c (original)
+++ team/irroot/distrotech-customers-trunk/res/res_fax.c Sun Jul 24 05:09:10 2011
@@ -238,6 +238,9 @@
 				or a directly specified list of frequencies and durations.</para>
 				<para>If not specified silence is generated.</para>
 			</parameter>
+			<parameter name="noise" required="false">
+				<para>Number of ms noise detected before proceeding with the dialplan.</para>
+			</parameter>
 		</syntax>
 		<description>
 			<para>This application sets FAXOPT(status) To SUCCESS | FAILURE | ERROR</para>
@@ -3056,10 +3059,11 @@
  * \param chan channel to run fax detect on
  * \param timeout maximum time to wait for fax detection
  * \return 0 if nothing was detected 1 on CNG detected 2 if T38 negotiation is started -1 on error*/
-static int do_waitfax_exec(struct ast_channel *chan, int timeout)
+static int do_waitfax_exec(struct ast_channel *chan, int timeout, int noiselim)
 {
 	int timeleft = timeout;
 	int res = 0;
+	int dspnoise = 0;
 	struct ast_dsp *dsp = NULL;
 	struct ast_frame *f;
 	enum ast_t38_state t38state = T38_STATE_UNKNOWN;
@@ -3081,7 +3085,8 @@
 
 	if ((dsp = ast_dsp_new())) {
 		ast_dsp_set_features(dsp, DSP_FEATURE_FAX_DETECT);
-		ast_dsp_set_faxmode(dsp, DSP_FAXMODE_DETECT_CNG);
+		ast_dsp_set_faxmode(dsp, DSP_FAXMODE_DETECT_CNG | DSP_FAXMODE_DETECT_SQUELCH);
+		ast_dsp_set_threshold(dsp, ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE));
 	} else {
 		return -1;
 	}
@@ -3098,8 +3103,11 @@
 			f = ast_dsp_process(chan, dsp, f);
 			if ((f->frametype ==  AST_FRAME_DTMF) && (f->subclass.integer == 'f')) {
 				res = 1;
-				ast_dsp_free(dsp);
-				dsp = NULL;
+			} else if ((f->frametype == AST_FRAME_VOICE) && (noiselim > 0)) {
+				ast_dsp_noise(dsp, f, &dspnoise);
+				if (dspnoise > noiselim) {
+					break;
+				}
 			}
 		}
 
@@ -3149,7 +3157,8 @@
 static int waitfax_exec(struct ast_channel *chan, const char *data)
 {
 	int res = 0;
-	int timeout = 0;
+	unsigned int timeout;
+	unsigned int noiselim;
 	int ptres = -1;
 	char *parse;
 	struct ast_fax_session_details *details;
@@ -3159,6 +3168,7 @@
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(timeout);
 		AST_APP_ARG(tone);
+		AST_APP_ARG(noise);
 	);
 
 	if (!(details = find_or_create_details(chan))) {
@@ -3169,8 +3179,10 @@
 	parse = ast_strdupa(data);
 	AST_STANDARD_APP_ARGS(args, parse);
 
-	if (args.timeout) {
-		timeout = atoi(args.timeout) * 1000;
+	if (!ast_strlen_zero(args.timeout) && sscanf(args.timeout, "%u", &timeout) == 1) {
+		timeout = timeout * 1000;
+	} else {
+		timeout = 0;
 	}
 
 	if (timeout <= 0) {
@@ -3179,6 +3191,10 @@
 		ast_log(LOG_ERROR, "Application WaitFAX requires a valid timeout\n");
 		ao2_ref(details, -1);
 		return 0;
+	}
+
+	if (ast_strlen_zero(args.noise) || sscanf(args.noise, "%u", &noiselim) != 1) {
+		noiselim = 0;
 	}
 
 	if (chan->_state != AST_STATE_UP) {
@@ -3200,7 +3216,7 @@
 		silgen = ast_channel_start_silence_generator(chan);
 	}
 
-	res = do_waitfax_exec(chan, timeout);
+	res = do_waitfax_exec(chan, timeout, noiselim);
 
 	/* stop silgen or tones if present */
 	if (silgen) {

Propchange: team/irroot/distrotech-customers-trunk/sounds/Makefile
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Jul 24 05:09:10 2011
@@ -1,1 +1,2 @@
 /be/branches/C.3/sounds/Makefile:256426
+/trunk/sounds/Makefile:270974




More information about the asterisk-commits mailing list