[asterisk-commits] dvossel: branch dvossel/hd_confbridge r312566 - in /team/dvossel/hd_confbridg...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 4 10:25:05 CDT 2011


Author: dvossel
Date: Mon Apr  4 10:24:59 2011
New Revision: 312566

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=312566
Log:
fixes automerge failure

Modified:
    team/dvossel/hd_confbridge/   (props changed)
    team/dvossel/hd_confbridge/CHANGES
    team/dvossel/hd_confbridge/channels/chan_dahdi.c
    team/dvossel/hd_confbridge/channels/chan_misdn.c
    team/dvossel/hd_confbridge/include/asterisk/dsp.h
    team/dvossel/hd_confbridge/main/ccss.c
    team/dvossel/hd_confbridge/main/dsp.c

Propchange: team/dvossel/hd_confbridge/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Propchange: team/dvossel/hd_confbridge/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Apr  4 10:24:59 2011
@@ -1,1 +1,1 @@
-/trunk:1-312293
+/trunk:1-312565

Modified: team/dvossel/hd_confbridge/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/CHANGES?view=diff&rev=312566&r1=312565&r2=312566
==============================================================================
--- team/dvossel/hd_confbridge/CHANGES (original)
+++ team/dvossel/hd_confbridge/CHANGES Mon Apr  4 10:24:59 2011
@@ -28,29 +28,34 @@
 --------------------------
  * The HTTP Server can bind to IPv6 addresses.
 
+chan_dahdi
+--------------------------
+ * Busy tone patterns featuring 2 silence and 2 tone lengths can now be used
+   with busydetect.  usage example: busypattern=200,200,200,600
+
+CLI Changes
+--------------------------
+ * New 'gtalk show settings' command showing the current settings loaded from
+   gtalk.conf.
+ * The 'logger reload' command now supports an optional argument, specifying an
+   alternate configuration file to use.
+
+CDR
+--------------------------
+ * The filter option in cdr_adaptive_odbc now supports negating the argument,
+   thus allowing records which do NOT match the specified filter.
+
+CODECS
+--------------------------
+ * Ability to define custom SILK formats in codecs.conf.
+ * Addition of speex32 audio format with translation.
+
 ConfBridge
 --------------------------
  * New highly optimized and customizable ConfBridge application capable of
    mixing audio at sample rates ranging from 8khz-96khz.
  * CONFBRIDGE dialplan function capable of creating dynamic ConfBridge user
    and bridge profiles on a channel.
-
-CLI Changes
---------------------------
- * New 'gtalk show settings' command showing the current settings loaded from
-   gtalk.conf.
- * The 'logger reload' command now supports an optional argument, specifying an
-   alternate configuration file to use.
-
-CDR
---------------------------
- * The filter option in cdr_adaptive_odbc now supports negating the argument,
-   thus allowing records which do NOT match the specified filter.
-
-CODECS
---------------------------
- * Ability to define custom SILK formats in codecs.conf.
- * Addition of speex32 audio format with translation.
 
 Dialplan Variables
 ------------------

Modified: team/dvossel/hd_confbridge/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/channels/chan_dahdi.c?view=diff&rev=312566&r1=312565&r2=312566
==============================================================================
--- team/dvossel/hd_confbridge/channels/chan_dahdi.c (original)
+++ team/dvossel/hd_confbridge/channels/chan_dahdi.c Mon Apr  4 10:24:59 2011
@@ -1115,15 +1115,10 @@
 	 */
 	int busycount;
 	/*!
-	 * \brief Length of "busy" tone on time.
-	 * \note Set from the "busypattern" value read in from chan_dahdi.conf
+	 * \brief Busy cadence pattern description.
+	 * \note Set from the "busypattern" value read from chan_dahdi.conf
 	 */
-	int busy_tonelength;
-	/*!
-	 * \brief Length of "busy" tone off time.
-	 * \note Set from the "busypattern" value read in from chan_dahdi.conf
-	 */
-	int busy_quietlength;
+	struct ast_dsp_busy_pattern busy_cadence;
 	/*!
 	 * \brief Bitmapped call progress detection flags. CALLPROGRESS_xxx values.
 	 * \note Bits set from the "callprogress" and "faxdetect" values read in from chan_dahdi.conf
@@ -9542,7 +9537,7 @@
 					ast_dsp_set_call_progress_zone(i->dsp, progzone);
 				if (i->busydetect && CANBUSYDETECT(i)) {
 					ast_dsp_set_busy_count(i->dsp, i->busycount);
-					ast_dsp_set_busy_pattern(i->dsp, i->busy_tonelength, i->busy_quietlength);
+					ast_dsp_set_busy_pattern(i->dsp, &i->busy_cadence);
 				}
 			}
 		}
@@ -12615,8 +12610,7 @@
 		}
 		tmp->busydetect = conf->chan.busydetect;
 		tmp->busycount = conf->chan.busycount;
-		tmp->busy_tonelength = conf->chan.busy_tonelength;
-		tmp->busy_quietlength = conf->chan.busy_quietlength;
+		tmp->busy_cadence = conf->chan.busy_cadence;
 		tmp->callprogress = conf->chan.callprogress;
 		tmp->waitfordialtone = conf->chan.waitfordialtone;
 		tmp->cancallforward = conf->chan.cancallforward;
@@ -15120,7 +15114,7 @@
 				ast_cli(a->fd, "    Busy Detector Debug: Enabled\n");
 #endif
 				ast_cli(a->fd, "    Busy Count: %d\n", tmp->busycount);
-				ast_cli(a->fd, "    Busy Pattern: %d,%d\n", tmp->busy_tonelength, tmp->busy_quietlength);
+				ast_cli(a->fd, "    Busy Pattern: %d,%d,%d,%d\n", tmp->busy_cadence.pattern[0], tmp->busy_cadence.pattern[1], (tmp->busy_cadence.length == 4) ? tmp->busy_cadence.pattern[2] : 0, (tmp->busy_cadence.length == 4) ? tmp->busy_cadence.pattern[3] : 0);
 			}
 			ast_cli(a->fd, "TDD: %s\n", tmp->tdd ? "yes" : "no");
 			ast_cli(a->fd, "Relax DTMF: %s\n", tmp->dtmfrelax ? "yes" : "no");
@@ -16663,6 +16657,41 @@
 #define PROC_DAHDI_OPT_NOCHAN  (1 << 0)
 /*! process_dahdi() - No warnings on non-existing cofiguration keywords */
 #define PROC_DAHDI_OPT_NOWARN  (1 << 1)
+
+static void parse_busy_pattern(struct ast_variable *v, struct ast_dsp_busy_pattern *busy_cadence)
+{
+	int count_pattern = 0;
+	int norval = 0;
+	char *temp = NULL;
+
+	for (; ;) {
+		/* Scans the string for the next value in the pattern. If none, it checks to see if any have been entered so far. */
+		if(!sscanf(v->value, "%30d", &norval) && count_pattern == 0) { 
+			ast_log(LOG_ERROR, "busypattern= expects either busypattern=tonelength,quietlength or busypattern=t1length, q1length, t2length, q2length at line %d.\n", v->lineno);
+			break;
+		}
+
+		busy_cadence->pattern[count_pattern] = norval; 
+		
+		count_pattern++;
+		if (count_pattern == 4) {
+			break;
+		}
+
+		temp = strchr(v->value, ',');
+		if (temp == NULL) {
+			break;
+		}
+		v->value = temp + 1;
+	}
+	busy_cadence->length = count_pattern;
+
+	if (count_pattern % 2 != 0) { 
+		/* The pattern length must be divisible by two */
+		ast_log(LOG_ERROR, "busypattern= expects either busypattern=tonelength,quietlength or busypattern=t1length, q1length, t2length, q2length at line %d.\n", v->lineno);
+	}
+	
+}
 
 static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct ast_variable *v, int reload, int options)
 {
@@ -16789,9 +16818,7 @@
 		} else if (!strcasecmp(v->name, "busycount")) {
 			confp->chan.busycount = atoi(v->value);
 		} else if (!strcasecmp(v->name, "busypattern")) {
-			if (sscanf(v->value, "%30d,%30d", &confp->chan.busy_tonelength, &confp->chan.busy_quietlength) != 2) {
-				ast_log(LOG_ERROR, "busypattern= expects busypattern=tonelength,quietlength at line %d.\n", v->lineno);
-			}
+			parse_busy_pattern(v, &confp->chan.busy_cadence);
 		} else if (!strcasecmp(v->name, "callprogress")) {
 			confp->chan.callprogress &= ~CALLPROGRESS_PROGRESS;
 			if (ast_true(v->value))

Modified: team/dvossel/hd_confbridge/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/channels/chan_misdn.c?view=diff&rev=312566&r1=312565&r2=312566
==============================================================================
--- team/dvossel/hd_confbridge/channels/chan_misdn.c (original)
+++ team/dvossel/hd_confbridge/channels/chan_misdn.c Mon Apr  4 10:24:59 2011
@@ -681,7 +681,7 @@
 static enum event_response_e
 cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data);
 
-static void send_cause2ast(struct ast_channel *ast, struct misdn_bchannel*bc, struct chan_list *ch);
+static int send_cause2ast(struct ast_channel *ast, struct misdn_bchannel *bc, struct chan_list *ch);
 
 static void cl_queue_chan(struct chan_list *chan);
 
@@ -8364,8 +8364,7 @@
 		cb_log(2, port, " --> hangup\n");
 		ch->need_hangup = 0;
 		ch->need_queue_hangup = 0;
-		if (ch->ast) {
-			send_cause2ast(ch->ast, bc, ch);
+		if (ch->ast && send_cause2ast(ch->ast, bc, ch)) {
 			ast_hangup(ch->ast);
 		}
 		return;
@@ -8373,13 +8372,15 @@
 
 	if (!ch->need_queue_hangup) {
 		cb_log(2, port, " --> No need to queue hangup\n");
+		return;
 	}
 
 	ch->need_queue_hangup = 0;
 	if (ch->ast) {
-		send_cause2ast(ch->ast, bc, ch);
-		ast_queue_hangup_with_cause(ch->ast, bc->cause);
-		cb_log(2, port, " --> queue_hangup\n");
+		if (send_cause2ast(ch->ast, bc, ch)) {
+			ast_queue_hangup_with_cause(ch->ast, bc->cause);
+			cb_log(2, port, " --> queue_hangup\n");
+		}
 	} else {
 		cb_log(1, port, "Cannot hangup chan, no ast\n");
 	}
@@ -8653,26 +8654,31 @@
 	}
 }
 
-
-
-static void send_cause2ast(struct ast_channel *ast, struct misdn_bchannel *bc, struct chan_list *ch) {
+/*!
+ * \retval -1 if can hangup after calling.
+ * \retval 0 if cannot hangup after calling.
+ */
+static int send_cause2ast(struct ast_channel *ast, struct misdn_bchannel *bc, struct chan_list *ch)
+{
+	int can_hangup;
+
 	if (!ast) {
 		chan_misdn_log(1, 0, "send_cause2ast: No Ast\n");
-		return;
+		return 0;
 	}
 	if (!bc) {
 		chan_misdn_log(1, 0, "send_cause2ast: No BC\n");
-		return;
+		return 0;
 	}
 	if (!ch) {
 		chan_misdn_log(1, 0, "send_cause2ast: No Ch\n");
-		return;
+		return 0;
 	}
 
 	ast->hangupcause = bc->cause;
 
+	can_hangup = -1;
 	switch (bc->cause) {
-
 	case AST_CAUSE_UNALLOCATED:
 	case AST_CAUSE_NO_ROUTE_TRANSIT_NET:
 	case AST_CAUSE_NO_ROUTE_DESTINATION:
@@ -8699,15 +8705,16 @@
 			chan_misdn_log(1, bc ? bc->port : 0, "Queued busy already\n");
 			break;
 		}
+		ch->need_busy = 0;
 
 		chan_misdn_log(1, bc ? bc->port : 0, " --> * SEND: Queue Busy pid:%d\n", bc ? bc->pid : -1);
-
 		ast_queue_control(ast, AST_CONTROL_BUSY);
 
-		ch->need_busy = 0;
-
-		break;
-	}
+		/* The BUSY is likely to cause a hangup or the user needs to hear it. */
+		can_hangup = 0;
+		break;
+	}
+	return can_hangup;
 }
 
 

Modified: team/dvossel/hd_confbridge/include/asterisk/dsp.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/include/asterisk/dsp.h?view=diff&rev=312566&r1=312565&r2=312566
==============================================================================
--- team/dvossel/hd_confbridge/include/asterisk/dsp.h (original)
+++ team/dvossel/hd_confbridge/include/asterisk/dsp.h Mon Apr  4 10:24:59 2011
@@ -59,6 +59,13 @@
 
 struct ast_dsp;
 
+struct ast_dsp_busy_pattern {
+	/*! Number of elements. */
+	int length;
+	/*! Pattern elements in on/off time durations. */
+	int pattern[4];
+};
+
 enum threshold {
 	/* Array offsets */
 	THRESHOLD_SILENCE = 0,
@@ -86,7 +93,7 @@
 void ast_dsp_set_busy_count(struct ast_dsp *dsp, int cadences);
 
 /*! \brief Set expected lengths of the busy tone */
-void ast_dsp_set_busy_pattern(struct ast_dsp *dsp, int tonelength, int quietlength);
+void ast_dsp_set_busy_pattern(struct ast_dsp *dsp, const struct ast_dsp_busy_pattern *cadence);
 
 /*! \brief Scans for progress indication in audio */
 int ast_dsp_call_progress(struct ast_dsp *dsp, struct ast_frame *inf);

Modified: team/dvossel/hd_confbridge/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/main/ccss.c?view=diff&rev=312566&r1=312565&r2=312566
==============================================================================
--- team/dvossel/hd_confbridge/main/ccss.c (original)
+++ team/dvossel/hd_confbridge/main/ccss.c Mon Apr  4 10:24:59 2011
@@ -48,6 +48,21 @@
 		<description>
 			<para>Request call completion service for a previously failed
 			call attempt.</para>
+			<para>This application sets the following channel variables:</para>
+			<variablelist>
+				<variable name="CC_REQUEST_RESULT">
+					<para>This is the returned status of the request.</para>
+					<value name="SUCCESS" />
+					<value name="FAIL" />
+				</variable>
+				<variable name="CC_REQUEST_REASON">
+					<para>This is the reason the request failed.</para>
+					<value name="NO_CORE_INSTANCE" />
+					<value name="NOT_GENERIC" />
+					<value name="TOO_MANY_REQUESTS" />
+					<value name="UNSPECIFIED" />
+				</variable>
+			</variablelist>
 		</description>
 	</application>
 	<application name="CallCompletionCancel" language="en_US">
@@ -57,6 +72,20 @@
 		<syntax />
 		<description>
 			<para>Cancel a Call Completion Request.</para>
+			<para>This application sets the following channel variables:</para>
+			<variablelist>
+				<variable name="CC_CANCEL_RESULT">
+					<para>This is the returned status of the cancel.</para>
+					<value name="SUCCESS" />
+					<value name="FAIL" />
+				</variable>
+				<variable name="CC_CANCEL_REASON">
+					<para>This is the reason the cancel failed.</para>
+					<value name="NO_CORE_INSTANCE" />
+					<value name="NOT_GENERIC" />
+					<value name="UNSPECIFIED" />
+				</variable>
+			</variablelist>
 		</description>
 	</application>
  ***/
@@ -3934,7 +3963,9 @@
 	match_flags = MATCH_NO_REQUEST;
 	if (!(core_instance = ao2_t_callback_data(cc_core_instances, 0, match_agent, device_name, &match_flags, "Find core instance for CallCompletionRequest"))) {
 		ast_log_dynamic_level(cc_logger_level, "Couldn't find a core instance for caller %s\n", device_name);
-		return -1;
+		pbx_builtin_setvar_helper(chan, "CC_REQUEST_RESULT", "FAIL");
+		pbx_builtin_setvar_helper(chan, "CC_REQUEST_REASON", "NO_CORE_INSTANCE");
+		return 0;
 	}
 
 	ast_log_dynamic_level(cc_logger_level, "Core %d: Found core_instance for caller %s\n",
@@ -3944,6 +3975,7 @@
 		ast_log_dynamic_level(cc_logger_level, "Core %d: CallCompletionRequest is only for generic agent types.\n",
 				core_instance->core_id);
 		pbx_builtin_setvar_helper(chan, "CC_REQUEST_RESULT", "FAIL");
+		pbx_builtin_setvar_helper(chan, "CC_REQUEST_REASON", "NOT_GENERIC");
 		cc_unref(core_instance, "Unref core_instance since CallCompletionRequest was called with native agent");
 		return 0;
 	}
@@ -3953,14 +3985,19 @@
 				core_instance->core_id);
 		ast_cc_failed(core_instance->core_id, "Too many CC requests\n");
 		pbx_builtin_setvar_helper(chan, "CC_REQUEST_RESULT", "FAIL");
+		pbx_builtin_setvar_helper(chan, "CC_REQUEST_REASON", "TOO_MANY_REQUESTS");
 		cc_unref(core_instance, "Unref core_instance since too many CC requests");
 		return 0;
 	}
 
 	res = ast_cc_agent_accept_request(core_instance->core_id, "CallCompletionRequest called by caller %s for core_id %d", device_name, core_instance->core_id);
 	pbx_builtin_setvar_helper(chan, "CC_REQUEST_RESULT", res ? "FAIL" : "SUCCESS");
+	if (res) {
+		pbx_builtin_setvar_helper(chan, "CC_REQUEST_REASON", "UNSPECIFIED");
+	}
+
 	cc_unref(core_instance, "Done with CallCompletionRequest");
-	return res;
+	return 0;
 }
 
 static const char *cccancel_app = "CallCompletionCancel";
@@ -3976,19 +4013,27 @@
 
 	match_flags = MATCH_REQUEST;
 	if (!(core_instance = ao2_t_callback_data(cc_core_instances, 0, match_agent, device_name, &match_flags, "Find core instance for CallCompletionCancel"))) {
-		ast_log(LOG_WARNING, "Cannot find CC transaction to cancel for caller %s\n", device_name);
-		return -1;
+		ast_log_dynamic_level(cc_logger_level, "Cannot find CC transaction to cancel for caller %s\n", device_name);
+		pbx_builtin_setvar_helper(chan, "CC_CANCEL_RESULT", "FAIL");
+		pbx_builtin_setvar_helper(chan, "CC_CANCEL_REASON", "NO_CORE_INSTANCE");
+		return 0;
 	}
 
 	if (strcmp(core_instance->agent->callbacks->type, "generic")) {
 		ast_log(LOG_WARNING, "CallCompletionCancel may only be used for calles with a generic agent\n");
 		cc_unref(core_instance, "Unref core instance found during CallCompletionCancel");
-		return -1;
+		pbx_builtin_setvar_helper(chan, "CC_CANCEL_RESULT", "FAIL");
+		pbx_builtin_setvar_helper(chan, "CC_CANCEL_REASON", "NOT_GENERIC");
+		return 0;
 	}
 	res = ast_cc_failed(core_instance->core_id, "Call completion request Cancelled for core ID %d by caller %s",
 			core_instance->core_id, device_name);
 	cc_unref(core_instance, "Unref core instance found during CallCompletionCancel");
-	return res;
+	pbx_builtin_setvar_helper(chan, "CC_CANCEL_RESULT", res ? "FAIL" : "SUCCESS");
+	if (res) {
+		pbx_builtin_setvar_helper(chan, "CC_CANCEL_REASON", "UNSPECIFIED");
+	}
+	return 0;
 }
 
 struct count_monitors_cb_data {

Modified: team/dvossel/hd_confbridge/main/dsp.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/main/dsp.c?view=diff&rev=312566&r1=312565&r2=312566
==============================================================================
--- team/dvossel/hd_confbridge/main/dsp.c (original)
+++ team/dvossel/hd_confbridge/main/dsp.c Mon Apr  4 10:24:59 2011
@@ -370,8 +370,7 @@
 	int ringtimeout;
 	int busymaybe;
 	int busycount;
-	int busy_tonelength;
-	int busy_quietlength;
+	struct ast_dsp_busy_pattern busy_cadence;
 	int historicnoise[DSP_HISTORY];
 	int historicsilence[DSP_HISTORY];
 	goertzel_state_t freqs[7];
@@ -1176,9 +1175,14 @@
 	int avgsilence = 0, hitsilence = 0;
 #endif
 	int avgtone = 0, hittone = 0;
-	if (!dsp->busymaybe) {
-		return res;
-	}
+
+	/* if we have a 4 length pattern, the way busymaybe is set doesn't help us. */
+	if (dsp->busy_cadence.length != 4) {
+		if (!dsp->busymaybe) {
+			return res;
+		}
+	}
+
 	for (x = DSP_HISTORY - dsp->busycount; x < DSP_HISTORY; x++) {
 #ifndef BUSYDETECT_TONEONLY
 		avgsilence += dsp->historicsilence[x];
@@ -1232,23 +1236,60 @@
 		res = 1;
 #endif
 	}
+
+	/* If we have a 4-length pattern, we can go ahead and just check it in a different way. */
+	if (dsp->busy_cadence.length == 4) {
+		int x;
+		int errors = 0;
+		int errors_max = ((4 * dsp->busycount) / 100.0) * BUSY_PAT_PERCENT;
+
+		for (x = DSP_HISTORY - (dsp->busycount); x < DSP_HISTORY; x += 2) {
+			int temp_error;
+			temp_error = abs(dsp->historicnoise[x] - dsp->busy_cadence.pattern[0]);
+			if ((temp_error * 100) / dsp->busy_cadence.pattern[0] > BUSY_PERCENT) {
+				errors++;
+			}
+
+			temp_error = abs(dsp->historicnoise[x + 1] - dsp->busy_cadence.pattern[2]);
+			if ((temp_error * 100) / dsp->busy_cadence.pattern[2] > BUSY_PERCENT) {
+				errors++;
+			}
+
+			temp_error = abs(dsp->historicsilence[x] - dsp->busy_cadence.pattern[1]);
+			if ((temp_error * 100) / dsp->busy_cadence.pattern[1] > BUSY_PERCENT) {
+				errors++;
+			}
+
+			temp_error = abs(dsp->historicsilence[x + 1] - dsp->busy_cadence.pattern[3]);
+			if ((temp_error * 100) / dsp->busy_cadence.pattern[3] > BUSY_PERCENT) {
+				errors++;
+			}
+		}
+
+		ast_debug(5, "errors = %d  max = %d\n", errors, errors_max);
+
+		if (errors <= errors_max) {
+			return 1;
+		}
+	}
+
 	/* If we know the expected busy tone length, check we are in the range */
-	if (res && (dsp->busy_tonelength > 0)) {
-		if (abs(avgtone - dsp->busy_tonelength) > (dsp->busy_tonelength*BUSY_PAT_PERCENT/100)) {
+	if (res && (dsp->busy_cadence.pattern[0] > 0)) {
+		if (abs(avgtone - dsp->busy_cadence.pattern[0]) > (dsp->busy_cadence.pattern[0]*BUSY_PAT_PERCENT/100)) {
 #ifdef BUSYDETECT_DEBUG
 			ast_debug(5, "busy detector: avgtone of %d not close enough to desired %d\n",
-				avgtone, dsp->busy_tonelength);
+				avgtone, dsp->busy_cadence.pattern[0]);
 #endif
 			res = 0;
 		}
 	}
 #ifndef BUSYDETECT_TONEONLY
 	/* If we know the expected busy tone silent-period length, check we are in the range */
-	if (res && (dsp->busy_quietlength > 0)) {
-		if (abs(avgsilence - dsp->busy_quietlength) > (dsp->busy_quietlength*BUSY_PAT_PERCENT/100)) {
+	if (res && (dsp->busy_cadence.pattern[1] > 0)) {
+		if (abs(avgsilence - dsp->busy_cadence.pattern[1]) > (dsp->busy_cadence.pattern[1] * BUSY_PAT_PERCENT / 100)) {
 #ifdef BUSYDETECT_DEBUG
 		ast_debug(5, "busy detector: avgsilence of %d not close enough to desired %d\n",
-			avgsilence, dsp->busy_quietlength);
+			avgsilence, dsp->busy_cadence.pattern[1]);
 #endif
 			res = 0;
 		}
@@ -1579,11 +1620,10 @@
 	dsp->busycount = cadences;
 }
 
-void ast_dsp_set_busy_pattern(struct ast_dsp *dsp, int tonelength, int quietlength)
-{
-	dsp->busy_tonelength = tonelength;
-	dsp->busy_quietlength = quietlength;
-	ast_debug(1, "dsp busy pattern set to %d,%d\n", tonelength, quietlength);
+void ast_dsp_set_busy_pattern(struct ast_dsp *dsp, const struct ast_dsp_busy_pattern *cadence)
+{
+	dsp->busy_cadence = *cadence;
+	ast_debug(1, "dsp busy pattern set to %d,%d,%d,%d\n", cadence->pattern[0], cadence->pattern[1], (cadence->length == 4) ? cadence->pattern[2] : 0, (cadence->length == 4) ? cadence->pattern[3] : 0);
 }
 
 void ast_dsp_digitreset(struct ast_dsp *dsp)




More information about the asterisk-commits mailing list