[asterisk-commits] dvossel: trunk r182596 - in /trunk: CHANGES apps/app_dial.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 17 12:17:56 CDT 2009


Author: dvossel
Date: Tue Mar 17 12:17:51 2009
New Revision: 182596

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=182596
Log:
Option to send DTMF when receiving PROGRESS status

The D() option in app_dial is only able to send DTMF after the call has been answered.  A progress option has been added to D() to allow DTMF to be sent upon receiving PROGRESS.  This allows DTMF to be sent before the call is answered.

(closes issue #12123)
Reported by: VoipForces
Patches:
	app_dial.c_patch_trunk_valid uploaded by VoipForces (license 419)
	dtmf_progress.patch uploaded by dvossel (license 671)
Tested by: VoipForces, dvossel


Modified:
    trunk/CHANGES
    trunk/apps/app_dial.c

Modified: trunk/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/trunk/CHANGES?view=diff&rev=182596&r1=182595&r2=182596
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Tue Mar 17 12:17:51 2009
@@ -128,6 +128,9 @@
  * Added ConfBridge dialplan application which does conference bridges without
    DAHDI. For information on its use, please see the output of
    "core show application ConfBridge" from the CLI.
+ * Added progress option to the app_dial D() option.  When progress DTMF is
+   present, those values are sent immediatly upon receiving a PROGRESS message
+   regardless if the call has been answered or not.
 
 Miscellaneous
 -------------

Modified: trunk/apps/app_dial.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/apps/app_dial.c?view=diff&rev=182596&r1=182595&r2=182596
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Tue Mar 17 12:17:51 2009
@@ -109,11 +109,13 @@
 				<option name="D" argsep=":">
 					<argument name="called" />
 					<argument name="calling" />
+					<argument name="progress" />
 					<para>Send the specified DTMF strings <emphasis>after</emphasis> the called
 					party has answered, but before the call gets bridged. The 
 					<replaceable>called</replaceable> DTMF string is sent to the called party, and the 
 					<replaceable>calling</replaceable> DTMF string is sent to the calling party. Both arguments 
-					can be used alone.</para>
+					can be used alone.  If <replaceable>progress</replaceable> is specified, its DTMF is sent
+					immediately after receiving a PROGRESS message.</para>
 				</option>
 				<option name="e">
 					<para>Execute the <literal>h</literal> extension for peer after the call ends</para>
@@ -796,7 +798,7 @@
 static struct ast_channel *wait_for_answer(struct ast_channel *in,
 	struct chanlist *outgoing, int *to, struct ast_flags64 *peerflags,
 	struct privacy_args *pa,
-	const struct cause_args *num_in, int *result)
+	const struct cause_args *num_in, int *result, char *dtmf_progress)
 {
 	struct cause_args num = *num_in;
 	int prestart = num.busy + num.congestion + num.nochan;
@@ -952,6 +954,10 @@
 						ast_channel_early_bridge(in, c);
 					if (!ast_test_flag64(outgoing, OPT_RINGBACK))
 						ast_indicate(in, AST_CONTROL_PROGRESS);
+						if(!ast_strlen_zero(dtmf_progress)) {
+							ast_verb(3, "Sending DTMF '%s' to the called party as result of receiving a PROGRESS message.\n", dtmf_progress);
+							ast_dtmf_stream(c, in, dtmf_progress, 250, 0);
+						}
 					break;
 				case AST_CONTROL_VIDUPDATE:
 					ast_verb(3, "%s requested a video update, passing it to %s\n", c->name, in->name);
@@ -1502,7 +1508,7 @@
 
 	struct ast_bridge_config config = { { 0, } };
 	struct timeval calldurationlimit = { 0, };
-	char *dtmfcalled = NULL, *dtmfcalling = NULL;
+	char *dtmfcalled = NULL, *dtmfcalling = NULL, *dtmf_progress=NULL;
 	struct privacy_args pa = {
 		.sentringing = 0,
 		.privdb_val = 0,
@@ -1553,12 +1559,11 @@
 		goto done;
 	}
 
-
 	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);
 	}
-	
+
 	if (ast_test_flag64(&opts, OPT_DURATION_STOP) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_STOP])) {
 		calldurationlimit.tv_sec = atoi(opt_args[OPT_ARG_DURATION_STOP]);
 		if (!calldurationlimit.tv_sec) {
@@ -1570,8 +1575,9 @@
 	}
 
 	if (ast_test_flag64(&opts, OPT_SENDDTMF) && !ast_strlen_zero(opt_args[OPT_ARG_SENDDTMF])) {
-		dtmfcalling = opt_args[OPT_ARG_SENDDTMF];
-		dtmfcalled = strsep(&dtmfcalling, ":");
+		dtmf_progress = opt_args[OPT_ARG_SENDDTMF];
+		dtmfcalled = strsep(&dtmf_progress, ":");
+		dtmfcalling = strsep(&dtmf_progress, ":");
 	}
 
 	if (ast_test_flag64(&opts, OPT_DURATION_LIMIT) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_LIMIT])) {
@@ -1838,7 +1844,7 @@
 		}
 	}
 
-	peer = wait_for_answer(chan, outgoing, &to, peerflags, &pa, &num, &result);
+	peer = wait_for_answer(chan, outgoing, &to, peerflags, &pa, &num, &result, dtmf_progress);
 
 	/* The ast_channel_datastore_remove() function could fail here if the
 	 * datastore was moved to another channel during a masquerade. If this is




More information about the asterisk-commits mailing list