aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_dial.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-07-14 01:10:24 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-07-14 01:10:24 +0000
commit01e3b60da1029e8ee40f4a4d059f3dbeb1a15cdd (patch)
tree072f3d9a191dcff5e37ab3f1013e8bb3ee40e7ae /apps/app_dial.c
parentd65a066d2174ef8a336e72fe40fe99f2716f3fc4 (diff)
Publish DIALEDTIME and ANSWEREDTIME in case people want to know them
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3425 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_dial.c')
-rwxr-xr-xapps/app_dial.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index 6530402f3..319b9b607 100755
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -433,9 +433,11 @@ static int dial_exec(struct ast_channel *chan, void *data)
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 @@ static int dial_exec(struct ast_channel *chan, void *data)
} 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 @@ static int dial_exec(struct ast_channel *chan, void *data)
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 @@ static int dial_exec(struct ast_channel *chan, void *data)
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;