[Asterisk-cvs] asterisk/apps app_dial.c,1.84,1.85
markster at lists.digium.com
markster at lists.digium.com
Tue Jul 13 21:24:40 CDT 2004
Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv20159/apps
Modified Files:
app_dial.c
Log Message:
Publish DIALEDTIME and ANSWEREDTIME in case people want to know them
Index: app_dial.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_dial.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- app_dial.c 12 Jul 2004 14:46:10 -0000 1.84
+++ app_dial.c 14 Jul 2004 01:10:24 -0000 1.85
@@ -433,9 +433,11 @@
char sdtmfdata[256] = "";
char *stack,*var;
char status[256];
+ char toast[80];
int play_to_caller=0,play_to_callee=0;
int playargs=0, sentringing=0, moh=0;
int digit = 0;
+ time_t start_time, answer_time, end_time;
if (!data) {
ast_log(LOG_WARNING, "Dial requires an argument (technology1/number1&technology2/number2...|optional timeout|options)\n");
@@ -828,6 +830,7 @@
} else
strcpy(status, "CHANUNAVAIL");
+ time(&start_time);
peer = wait_for_answer(chan, outgoing, &to, &allowredir_in, &allowredir_out, &allowdisconnect, &sentringing, status);
if (!peer) {
@@ -841,6 +844,7 @@
goto out;
}
if (peer) {
+ time(&answer_time);
#ifdef OSP_SUPPORT
/* Once call is answered, ditch the OSP Handle */
pbx_builtin_setvar_helper(chan, "OSPHANDLE", "");
@@ -921,6 +925,12 @@
return -1;
}
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
res = -1;
More information about the svn-commits
mailing list