[asterisk-commits] branch 1.2 - r7234 /branches/1.2/apps/app_dial.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Nov 30 11:39:37 CST 2005


Author: russell
Date: Wed Nov 30 11:39:36 2005
New Revision: 7234

URL: http://svn.digium.com/view/asterisk?rev=7234&view=rev
Log:
fix DIALEDTIME when call has not been answered (issue #5862)

Modified:
    branches/1.2/apps/app_dial.c

Modified: branches/1.2/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_dial.c?rev=7234&r1=7233&r2=7234&view=diff
==============================================================================
--- branches/1.2/apps/app_dial.c (original)
+++ branches/1.2/apps/app_dial.c Wed Nov 30 11:39:36 2005
@@ -75,7 +75,7 @@
 "continue if no requested channels can be called, or if the timeout expires.\n\n"
 "  This application sets the following channel variables upon completion:\n"
 "    DIALEDTIME   - This is the time from dialing a channel until when it\n"
-"                   answers.\n" 
+"                   is disconnected.\n" 
 "    ANSWEREDTIME - This is the amount of time for actual call.\n"
 "    DIALSTATUS   - This is the status of the call:\n"
 "                   CHANUNAVAIL | CONGESTION | NOANSWER | BUSY | ANSWER | CANCEL\n" 
@@ -735,6 +735,7 @@
 	char numsubst[AST_MAX_EXTENSION];
 	char restofit[AST_MAX_EXTENSION];
 	char cidname[AST_MAX_EXTENSION];
+	char toast[80];
 	char *newnum;
 	char *l;
 	int privdb_val=0;
@@ -1513,8 +1514,6 @@
 		}
 		
 		if (!res) {
-			char toast[80];
-
 			memset(&config,0,sizeof(struct ast_bridge_config));
 			if (play_to_caller)
 				ast_set_flag(&(config.features_caller), AST_FEATURE_PLAY_WARNING);
@@ -1558,13 +1557,15 @@
 			}
 			res = ast_bridge_call(chan,peer,&config);
 			time(&end_time);
-			snprintf(toast, sizeof(toast), "%ld", (long)(end_time - start_time));
-			pbx_builtin_setvar_helper(chan, "DIALEDTIME", toast);
 			snprintf(toast, sizeof(toast), "%ld", (long)(end_time - answer_time));
 			pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", toast);
 			
-		} else 
+		} else {
+			time(&end_time);
 			res = -1;
+		}
+		snprintf(toast, sizeof(toast), "%ld", (long)(end_time - start_time));
+		pbx_builtin_setvar_helper(chan, "DIALEDTIME", toast);
 		
 		if (res != AST_PBX_NO_HANGUP_PEER) {
 			if (!chan->_softhangup)



More information about the asterisk-commits mailing list