Recording CDR events new property 'duration'

pull/73/head
pabloFuente 2018-04-17 16:16:53 +02:00
parent 9971e6394b
commit 2926c64a4e
1 changed files with 4 additions and 2 deletions

View File

@ -63,6 +63,7 @@ public class CDREvent implements Comparable<CDREvent> {
} }
this.timeStamp = System.currentTimeMillis(); this.timeStamp = System.currentTimeMillis();
this.id = recording.getId(); this.id = recording.getId();
this.duration = (int) recording.getDuration();
this.size = recording.getSize(); this.size = recording.getSize();
this.hasAudio = recording.hasAudio(); this.hasAudio = recording.hasAudio();
this.hasVideo = recording.hasVideo(); this.hasVideo = recording.hasVideo();
@ -118,12 +119,13 @@ public class CDREvent implements Comparable<CDREvent> {
json.put("receivingFrom", this.receivingFrom); json.put("receivingFrom", this.receivingFrom);
} }
} }
if (this.duration != null) { if (this.startTime != null && this.duration != null) {
json.put("startTime", this.startTime); json.put("startTime", this.startTime);
json.put("endTime", this.timeStamp); json.put("endTime", this.timeStamp);
json.put("duration", (this.timeStamp - this.startTime) / 1000); json.put("duration", (this.timeStamp - this.startTime) / 1000);
} else if (this.duration != null) {
json.put("duration", duration);
} }
if (this.reason != null) { if (this.reason != null) {
json.put("reason", this.reason); json.put("reason", this.reason);
} }