summaryrefslogtreecommitdiff
path: root/apps/app_osplookup.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/app_osplookup.c')
-rw-r--r--apps/app_osplookup.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c
index b37a2ae63..5ab497f5e 100644
--- a/apps/app_osplookup.c
+++ b/apps/app_osplookup.c
@@ -2814,7 +2814,7 @@ static int ospfinished_exec(
int inhandle = OSP_INVALID_HANDLE;
int outhandle = OSP_INVALID_HANDLE;
int recorded = 0;
- time_t start, connect, end;
+ time_t start = 0, connect = 0, end = 0;
unsigned int release;
char buffer[OSP_SIZE_INTSTR];
char inqos[OSP_SIZE_QOSSTR] = { 0 };
@@ -2866,19 +2866,18 @@ static int ospfinished_exec(
}
ast_debug(1, "OSPFinish: cause '%d'\n", cause);
- if (ast_channel_cdr(chan)) {
- start = ast_channel_cdr(chan)->start.tv_sec;
- connect = ast_channel_cdr(chan)->answer.tv_sec;
- if (connect) {
- end = time(NULL);
- } else {
- end = connect;
- }
+ if (!ast_tvzero(ast_channel_creationtime(chan))) {
+ start = ast_channel_creationtime(chan).tv_sec;
+ }
+ if (!ast_tvzero(ast_channel_answertime(chan))) {
+ connect = ast_channel_answertime(chan).tv_sec;
+ }
+ if (connect) {
+ end = time(NULL);
} else {
- start = 0;
- connect = 0;
- end = 0;
+ end = connect;
}
+
ast_debug(1, "OSPFinish: start '%ld'\n", start);
ast_debug(1, "OSPFinish: connect '%ld'\n", connect);
ast_debug(1, "OSPFinish: end '%ld'\n", end);