Skip to content
Snippets Groups Projects
Commit f78179c3 authored by Mark Spencer's avatar Mark Spencer
Browse files

Publish DIALEDTIME and ANSWEREDTIME in case people want to know them

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3425 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent e42c1190
No related branches found
No related tags found
No related merge requests found
...@@ -433,9 +433,11 @@ static int dial_exec(struct ast_channel *chan, void *data) ...@@ -433,9 +433,11 @@ static int dial_exec(struct ast_channel *chan, void *data)
char sdtmfdata[256] = ""; char sdtmfdata[256] = "";
char *stack,*var; char *stack,*var;
char status[256]; char status[256];
char toast[80];
int play_to_caller=0,play_to_callee=0; int play_to_caller=0,play_to_callee=0;
int playargs=0, sentringing=0, moh=0; int playargs=0, sentringing=0, moh=0;
int digit = 0; int digit = 0;
time_t start_time, answer_time, end_time;
if (!data) { if (!data) {
ast_log(LOG_WARNING, "Dial requires an argument (technology1/number1&technology2/number2...|optional timeout|options)\n"); 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) ...@@ -828,6 +830,7 @@ static int dial_exec(struct ast_channel *chan, void *data)
} else } else
strcpy(status, "CHANUNAVAIL"); strcpy(status, "CHANUNAVAIL");
time(&start_time);
peer = wait_for_answer(chan, outgoing, &to, &allowredir_in, &allowredir_out, &allowdisconnect, &sentringing, status); peer = wait_for_answer(chan, outgoing, &to, &allowredir_in, &allowredir_out, &allowdisconnect, &sentringing, status);
if (!peer) { if (!peer) {
...@@ -841,6 +844,7 @@ static int dial_exec(struct ast_channel *chan, void *data) ...@@ -841,6 +844,7 @@ static int dial_exec(struct ast_channel *chan, void *data)
goto out; goto out;
} }
if (peer) { if (peer) {
time(&answer_time);
#ifdef OSP_SUPPORT #ifdef OSP_SUPPORT
/* Once call is answered, ditch the OSP Handle */ /* Once call is answered, ditch the OSP Handle */
pbx_builtin_setvar_helper(chan, "OSPHANDLE", ""); pbx_builtin_setvar_helper(chan, "OSPHANDLE", "");
...@@ -921,6 +925,12 @@ static int dial_exec(struct ast_channel *chan, void *data) ...@@ -921,6 +925,12 @@ static int dial_exec(struct ast_channel *chan, void *data)
return -1; return -1;
} }
res = ast_bridge_call(chan,peer,&config); 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
res = -1; res = -1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment