From 1bd304fee9880a27e0709e9705cf74dc350c2d37 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Sat, 6 Dec 2025 08:22:18 +0200 Subject: [PATCH] Clear recordings from call history after restore Improved handling of call recording merge --- .../kotlin/com/tutpro/baresip/BaresipService.kt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt index 5ad74aa5..93eb7ce7 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt @@ -463,6 +463,13 @@ class BaresipService: Service() { } } + val restored = File(filesPath, "restored") + if (restored.exists()) { + CallHistoryNew.clearRecordings() + CallHistoryNew.save() + restored.delete() + } + Message.restore() hotSpotAddresses = Utils.hotSpotAddresses() @@ -1099,17 +1106,20 @@ class BaresipService: Service() { history.stopTime = GregorianCalendar() history.startTime = if (completedElsewhere) history.stopTime else call.startTime history.rejected = call.rejected - + if (call.dumpfiles[0] != "") { + history.recording = call.dumpfiles + } + history.add() CoroutineScope(Dispatchers.IO).launch { if (call.startTime != null && call.dumpfiles[0] != "") { delay(500) val rxFile = File(call.dumpfiles[0]) val txFile = File(call.dumpfiles[1]) val mergedFile = File(filesPath, "${rxFile.nameWithoutExtension}_stereo.wav") - if (Utils.mergeWavFiles(rxFile, txFile, mergedFile)) { Log.d(TAG, "Automatic merge succeeded.") history.recording = arrayOf(mergedFile.absolutePath, "") + CallHistoryNew.save() try { rxFile.delete() txFile.delete() @@ -1121,9 +1131,7 @@ class BaresipService: Service() { history.recording = call.dumpfiles } } - history.add() } - ua.account.missedCalls = ua.account.missedCalls || missed } if (!Utils.isVisible()) {