Skip to content

Commit 31d6026

Browse files
committed
res_phreaknet: Don't emit warning on 0-second billed calls.
This particular branch may not serve much of a good purpose anymore, but don't emit a warning simply because a number answered and immediately hung up.
1 parent 5b0b101 commit 31d6026

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

res/res_phreaknet.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -609,11 +609,14 @@ static int cdr_handler(struct ast_cdr *cdr)
609609
}
610610

611611
if (!billsec && answer->tv_sec) {
612-
int oldduration = duration;
612+
int calcduration, oldduration = duration;
613613
/* XXX May or may not be necessary anymore. Edge case where called party hangs up first... */
614614
/* Manually fix the duration. Unfortunately, this sets billsec=duration, which is wrong. */
615-
duration = duration ? duration : time(NULL) - cdr_channel->startsecs;
616-
ast_log(LOG_WARNING, "Call was answered, but billsec is 0? Adjusting duration from %d to %d\n", oldduration, duration);
615+
calcduration = time(NULL) - cdr_channel->startsecs;
616+
duration = duration ? duration : calcduration;
617+
if (duration != oldduration) {
618+
ast_log(LOG_WARNING, "Call was answered, but billsec is 0? Adjusting duration from %d to %d\n", oldduration, duration);
619+
}
617620
}
618621

619622
ast_localtime(answer, &tm, NULL); /* Use the local time zone here, the server will use UTC. */

0 commit comments

Comments
 (0)