Fixed adding of new call to call history
This commit is contained in:
@@ -19,20 +19,12 @@ class CallHistoryNew(val aor: String, val peerUri: String, val direction: String
|
|||||||
|
|
||||||
fun add() {
|
fun add() {
|
||||||
BaresipService.callHistory.add(this)
|
BaresipService.callHistory.add(this)
|
||||||
var count = 0
|
var aorSpecificHistory = BaresipService.callHistory.filter { it.aor == this.aor }
|
||||||
var remove: CallHistoryNew? = null
|
if (aorSpecificHistory.size > CALL_HISTORY_SIZE) {
|
||||||
for (h in BaresipService.callHistory)
|
val oldestToRemove = aorSpecificHistory.first()
|
||||||
if (h.aor == this.aor) {
|
if (oldestToRemove.recording[0].isNotEmpty())
|
||||||
count++
|
deleteRecording(oldestToRemove.recording)
|
||||||
if (count > CALL_HISTORY_SIZE) {
|
BaresipService.callHistory.remove(oldestToRemove)
|
||||||
remove = h
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (remove != null) {
|
|
||||||
if (remove.recording[0] != "")
|
|
||||||
deleteRecording(remove.recording)
|
|
||||||
BaresipService.callHistory.remove(remove)
|
|
||||||
}
|
}
|
||||||
save()
|
save()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user