From 8247f53f548c944552e59dba7d1619374de33db0 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Mon, 25 May 2026 08:53:21 +0300 Subject: [PATCH] Synched user agent handling --- .../main/kotlin/com/tutpro/baresip/UserAgent.kt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/tutpro/baresip/UserAgent.kt b/app/src/main/kotlin/com/tutpro/baresip/UserAgent.kt index b5a07218..2a217436 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/UserAgent.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/UserAgent.kt @@ -36,16 +36,19 @@ class UserAgent(val uap: Long, virtualAccount: Account? = null) { fun calls(dir: String = ""): ArrayList { val result = ArrayList() - for (c in BaresipService.calls) - if ((c.ua == this) && ((dir == "") || c.dir == dir)) result.add(c) + synchronized(BaresipService.calls) { + for (c in BaresipService.calls) + if ((c.ua == this) && ((dir == "") || c.dir == dir)) result.add(c) + } return result } - // Returns call of UA that was added last or NULL fun currentCall(): Call? { - for (c in BaresipService.calls.reversed()) - if (c.ua == this) - return c + synchronized(BaresipService.calls) { + for (c in BaresipService.calls.reversed()) + if (c.ua == this) + return c + } return null }