[asterisk-commits] mmichelson: branch group/CCSS r235813 - in /team/group/CCSS: ./ apps/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 21 09:04:21 CST 2009


Author: mmichelson
Date: Mon Dec 21 09:04:19 2009
New Revision: 235813

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=235813
Log:
R the C and R the A


Modified:
    team/group/CCSS/   (props changed)
    team/group/CCSS/CHANGES
    team/group/CCSS/apps/app_dial.c
    team/group/CCSS/main/dsp.c

Propchange: team/group/CCSS/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/group/CCSS/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Dec 21 09:04:19 2009
@@ -1,1 +1,1 @@
-/trunk:1-235674
+/trunk:1-235811

Modified: team/group/CCSS/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/CHANGES?view=diff&rev=235813&r1=235812&r2=235813
==============================================================================
--- team/group/CCSS/CHANGES (original)
+++ team/group/CCSS/CHANGES Mon Dec 21 09:04:19 2009
@@ -82,6 +82,8 @@
    announcements or macros are executed.
  * Modified app_dial to set answertime when the called channel answers even if
    the called channel hangs up during playback of an announcement.
+ * Modified app_dial 'r' option to support an additional parameter to play an
+   indication tone from indications.conf
  * Added c() option to app_chanspy. This option allows custom DTMF to be set
    to cycle through the next available channel.  By default this is still '*'.
  * Added x() option to app_chanspy.  This option allows DTMF to be set to

Modified: team/group/CCSS/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/apps/app_dial.c?view=diff&rev=235813&r1=235812&r2=235813
==============================================================================
--- team/group/CCSS/apps/app_dial.c (original)
+++ team/group/CCSS/apps/app_dial.c Mon Dec 21 09:04:19 2009
@@ -63,6 +63,7 @@
 #include "asterisk/dsp.h"
 #include "asterisk/cel.h"
 #include "asterisk/ccss.h"
+#include "asterisk/indications.h"
 
 /*** DOCUMENTATION
 	<application name="Dial" language="en_US">
@@ -320,8 +321,11 @@
 					it is provided. The current extension is used if a database family/key is not specified.</para>
 				</option>
 				<option name="r">
-					<para>Indicate ringing to the calling party, even if the called party isn't actually ringing. Pass no audio to the calling
+					<para>Default: Indicate ringing to the calling party, even if the called party isn't actually ringing. Pass no audio to the calling
 					party until the called channel has answered.</para>
+					<argument name="tone" required="false">
+						<para>Indicate progress to calling party. Send audio 'tone' from indications.conf</para>
+					</argument>
 				</option>
 				<option name="S">
 					<argument name="x" required="true" />
@@ -536,6 +540,7 @@
 	OPT_ARG_DURATION_LIMIT,
 	OPT_ARG_MUSICBACK,
 	OPT_ARG_CALLEE_MACRO,
+	OPT_ARG_RINGBACK,
 	OPT_ARG_CALLEE_GOSUB,
 	OPT_ARG_CALLEE_GO_ON,
 	OPT_ARG_PRIVACY,
@@ -573,7 +578,7 @@
 	AST_APP_OPTION_ARG('O', OPT_OPERMODE, OPT_ARG_OPERMODE),
 	AST_APP_OPTION('p', OPT_SCREENING),
 	AST_APP_OPTION_ARG('P', OPT_PRIVACY, OPT_ARG_PRIVACY),
-	AST_APP_OPTION('r', OPT_RINGBACK),
+	AST_APP_OPTION_ARG('r', OPT_RINGBACK, OPT_ARG_RINGBACK),
 	AST_APP_OPTION_ARG('S', OPT_DURATION_STOP, OPT_ARG_DURATION_STOP),
 	AST_APP_OPTION('t', OPT_CALLEE_TRANSFER),
 	AST_APP_OPTION('T', OPT_CALLER_TRANSFER),
@@ -897,6 +902,7 @@
 
 static struct ast_channel *wait_for_answer(struct ast_channel *in,
 	struct chanlist *outgoing, int *to, struct ast_flags64 *peerflags,
+	char *opt_args[],
 	struct privacy_args *pa,
 	const struct cause_args *num_in, int *result, char *dtmf_progress,
 	const int ignore_cc)
@@ -918,11 +924,12 @@
 	ast_party_connected_line_init(&connected_caller);
 	if (single) {
 		/* Turn off hold music, etc */
-		if (!ast_test_flag64(outgoing, OPT_MUSICBACK | OPT_RINGBACK))
+		if (!ast_test_flag64(outgoing, OPT_MUSICBACK | OPT_RINGBACK)) {
 			ast_deactivate_generator(in);
-
-		/* If we are calling a single channel, make them compatible for in-band tone purpose */
-		ast_channel_make_compatible(outgoing->chan, in);
+			/* If we are calling a single channel, and not providing ringback or music, */
+			/* then, make them compatible for in-band tone purpose */
+			ast_channel_make_compatible(outgoing->chan, in);
+		}
 
 		if (!ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE) && !ast_test_flag64(outgoing, DIAL_NOCONNECTEDLINE)) {
 			ast_channel_lock(outgoing->chan);
@@ -1126,7 +1133,7 @@
 					/* Setup early media if appropriate */
 					if (single && CAN_EARLY_BRIDGE(peerflags, in, c))
 						ast_channel_early_bridge(in, c);
-					if (!(pa->sentringing) && !ast_test_flag64(outgoing, OPT_MUSICBACK)) {
+					if (!(pa->sentringing) && !ast_test_flag64(outgoing, OPT_MUSICBACK) && ast_strlen_zero(opt_args[OPT_ARG_RINGBACK])) {
 						ast_indicate(in, AST_CONTROL_RINGING);
 						pa->sentringing++;
 					}
@@ -1641,6 +1648,36 @@
 	bconfig->end_bridge_callback_data = originator;
 }
 
+static int dial_handle_playtones(struct ast_channel *chan, const char *data)
+{
+	struct ast_tone_zone_sound *ts = NULL;
+	int res;
+	const char *str = data;
+
+	if (ast_strlen_zero(str)) {
+		ast_debug(1,"Nothing to play\n");
+		return -1;
+	}
+
+	ts = ast_get_indication_tone(chan->zone, str);
+
+	if (ts && ts->data[0]) {
+		res = ast_playtones_start(chan, 0, ts->data, 0);
+	} else {
+		res = -1;
+	}
+
+	if (ts) {
+		ts = ast_tone_zone_sound_unref(ts);
+	}
+
+	if (res) {
+		ast_log(LOG_WARNING, "Unable to start playtone \'%s\'\n", str);
+	}
+
+	return res;
+}
+
 static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast_flags64 *peerflags, int *continue_exec)
 {
 	int res = -1; /* default: error */
@@ -1721,6 +1758,10 @@
 		}
 	}
 
+	if (!ast_test_flag64(&opts, OPT_RINGBACK)) {
+		opt_args[OPT_ARG_RINGBACK] = NULL;
+	}
+
 	if (ast_test_flag64(&opts, OPT_OPERMODE)) {
 		opermode = ast_strlen_zero(opt_args[OPT_ARG_OPERMODE]) ? 1 : atoi(opt_args[OPT_ARG_OPERMODE]);
 		ast_verb(3, "Setting operator services mode to %d.\n", opermode);
@@ -2036,12 +2077,21 @@
 			}
 			ast_indicate(chan, AST_CONTROL_PROGRESS);
 		} else if (ast_test_flag64(outgoing, OPT_RINGBACK)) {
-			ast_indicate(chan, AST_CONTROL_RINGING);
-			sentringing++;
-		}
-	}
-
-	peer = wait_for_answer(chan, outgoing, &to, peerflags, &pa, &num, &result, dtmf_progress, ignore_cc);
+			if (!ast_strlen_zero(opt_args[OPT_ARG_RINGBACK])) {
+				if (dial_handle_playtones(chan, opt_args[OPT_ARG_RINGBACK])){
+					ast_indicate(chan, AST_CONTROL_RINGING);
+					sentringing++;
+				} else {
+					ast_indicate(chan, AST_CONTROL_PROGRESS);
+				}
+			} else {
+				ast_indicate(chan, AST_CONTROL_RINGING);
+				sentringing++;
+			}
+		}
+	}
+
+	peer = wait_for_answer(chan, outgoing, &to, peerflags, opt_args, &pa, &num, &result, dtmf_progress, ignore_cc);
 
 	/* The ast_channel_datastore_remove() function could fail here if the
 	 * datastore was moved to another channel during a masquerade. If this is

Modified: team/group/CCSS/main/dsp.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/dsp.c?view=diff&rev=235813&r1=235812&r2=235813
==============================================================================
--- team/group/CCSS/main/dsp.c (original)
+++ team/group/CCSS/main/dsp.c Mon Dec 21 09:04:19 2009
@@ -1376,8 +1376,8 @@
 		}
 	}
 
-	if ((dsp->features & DSP_FEATURE_DIGIT_DETECT)) {
-		if ((dsp->digitmode & DSP_DIGITMODE_MF))
+	if (dsp->features & (DSP_FEATURE_DIGIT_DETECT | DSP_FEATURE_BUSY_DETECT)) {
+		if (dsp->digitmode & DSP_DIGITMODE_MF)
 			digit = mf_detect(dsp, &dsp->digit_state, shortdata, len, (dsp->digitmode & DSP_DIGITMODE_NOQUELCH) == 0, (dsp->digitmode & DSP_DIGITMODE_RELAXDTMF));
 		else
 			digit = dtmf_detect(dsp, &dsp->digit_state, shortdata, len, (dsp->digitmode & DSP_DIGITMODE_NOQUELCH) == 0, (dsp->digitmode & DSP_DIGITMODE_RELAXDTMF));
@@ -1389,15 +1389,18 @@
 			if (!dsp->dtmf_began) {
 				/* We have not reported DTMF_BEGIN for anything yet */
 
-				event = AST_FRAME_DTMF_BEGIN;
-				event_digit = dsp->digit_state.digits[0];
+				if (dsp->features & DSP_FEATURE_DIGIT_DETECT) {
+					event = AST_FRAME_DTMF_BEGIN;
+					event_digit = dsp->digit_state.digits[0];
+				}
 				dsp->dtmf_began = 1;
 
 			} else if (dsp->digit_state.current_digits > 1 || digit != dsp->digit_state.digits[0]) {
 				/* Digit changed. This means digit we have reported with DTMF_BEGIN ended */
-	
-				event = AST_FRAME_DTMF_END;
-				event_digit = dsp->digit_state.digits[0];
+				if (dsp->features & DSP_FEATURE_DIGIT_DETECT) {
+					event = AST_FRAME_DTMF_END;
+					event_digit = dsp->digit_state.digits[0];
+				}
 				memmove(dsp->digit_state.digits, dsp->digit_state.digits + 1, dsp->digit_state.current_digits);
 				dsp->digit_state.current_digits--;
 				dsp->dtmf_began = 0;
@@ -1406,6 +1409,7 @@
 					/* Reset Busy Detector as we have some confirmed activity */ 
 					memset(dsp->historicsilence, 0, sizeof(dsp->historicsilence));
 					memset(dsp->historicnoise, 0, sizeof(dsp->historicnoise));
+					ast_debug(1, "DTMF Detected - Reset busydetector\n");
 				}
 			}
 




More information about the asterisk-commits mailing list