[asterisk-commits] mnicholson: trunk r227897 - in /trunk: CHANGES apps/app_dial.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Nov 4 15:39:40 CST 2009


Author: mnicholson
Date: Wed Nov  4 15:39:33 2009
New Revision: 227897

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=227897
Log:
Added the 'a' option to app dial and modified app_dial to set the answertime when the called channel answers.

This change causes answertime to be correct even if the called channel hangs up during an announcement triggered by the A() option.

(closes issue #15936)
Reported by: falves11
Patches:
      dial-macro-billsec-fix1.diff uploaded by mnicholson (license 96)
      dial-caller-answer1.diff uploaded by mnicholson (license 96)
Tested by: falves11, mnicholson

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

Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=227897&r1=227896&r2=227897
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Wed Nov  4 15:39:33 2009
@@ -77,6 +77,10 @@
    regardless if the call has been answered or not.
  * Added functionality to the app_dial F() option to continue with execution
    at the current location when no parameters are provided.
+ * Added the 'a' option to app_dial to answer the calling channel before any
+   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.
  * 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: trunk/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_dial.c?view=diff&rev=227897&r1=227896&r2=227897
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Wed Nov  4 15:39:33 2009
@@ -93,6 +93,15 @@
 						<para>The file to play to the called party</para>
 					</argument>
 					<para>Play an announcement to the called party, where <replaceable>x</replaceable> is the prompt to be played</para>
+				</option>
+				<option name="a">
+					<para>Immediately answer the calling channel when the called channel answers in
+					all cases. Normally, the calling channel is answered when the called channel
+					answers, but when options such as A() and M() are used, the calling channel is
+					not answered until all actions on the called channel (such as playing an
+					announcement) are completed.  This option can be used to answer the calling
+					channel before doing anything on the called channel. You will rarely need to use
+					this option, the default behavior is adequate in most cases.</para>
 				</option>
 				<option name="C">
 					<para>Reset the call detail record (CDR) for this call.</para>
@@ -508,6 +517,7 @@
 	OPT_CALLEE_GOSUB =      (1 << 28),
 	OPT_CALLEE_MIXMONITOR = (1 << 29),
 	OPT_CALLER_MIXMONITOR = (1 << 30),
+	OPT_CALLER_ANSWER =	(1 << 31),
 };
 
 #define DIAL_STILLGOING      (1 << 31)
@@ -537,6 +547,7 @@
 
 AST_APP_OPTIONS(dial_exec_options, BEGIN_OPTIONS
 	AST_APP_OPTION_ARG('A', OPT_ANNOUNCE, OPT_ARG_ANNOUNCE),
+	AST_APP_OPTION('a', OPT_CALLER_ANSWER),
 	AST_APP_OPTION('C', OPT_RESETCDR),
 	AST_APP_OPTION('c', OPT_CANCEL_ELSEWHERE),
 	AST_APP_OPTION('d', OPT_DTMF_EXIT),
@@ -1987,6 +1998,9 @@
 	} else {
 		const char *number;
 
+		if (ast_test_flag64(&opts, OPT_CALLER_ANSWER))
+			ast_answer(chan);
+
 		strcpy(pa.status, "ANSWER");
 		pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
 		/* Ah ha!  Someone answered within the desired timeframe.  Of course after this
@@ -1994,9 +2008,11 @@
 		   conversation.  */
 		hanguptree(outgoing, peer, 1);
 		outgoing = NULL;
-		/* If appropriate, log that we have a destination channel */
-		if (chan->cdr)
+		/* If appropriate, log that we have a destination channel and set the answer time */
+		if (chan->cdr) {
 			ast_cdr_setdestchan(chan->cdr, peer->name);
+			ast_cdr_setanswer(chan->cdr, peer->cdr->answer);
+		}
 		if (peer->name)
 			pbx_builtin_setvar_helper(chan, "DIALEDPEERNAME", peer->name);
 		




More information about the asterisk-commits mailing list