Synched user agent handling
This commit is contained in:
@@ -36,16 +36,19 @@ class UserAgent(val uap: Long, virtualAccount: Account? = null) {
|
|||||||
|
|
||||||
fun calls(dir: String = ""): ArrayList<Call> {
|
fun calls(dir: String = ""): ArrayList<Call> {
|
||||||
val result = ArrayList<Call>()
|
val result = ArrayList<Call>()
|
||||||
|
synchronized(BaresipService.calls) {
|
||||||
for (c in BaresipService.calls)
|
for (c in BaresipService.calls)
|
||||||
if ((c.ua == this) && ((dir == "") || c.dir == dir)) result.add(c)
|
if ((c.ua == this) && ((dir == "") || c.dir == dir)) result.add(c)
|
||||||
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns call of UA that was added last or NULL
|
|
||||||
fun currentCall(): Call? {
|
fun currentCall(): Call? {
|
||||||
|
synchronized(BaresipService.calls) {
|
||||||
for (c in BaresipService.calls.reversed())
|
for (c in BaresipService.calls.reversed())
|
||||||
if (c.ua == this)
|
if (c.ua == this)
|
||||||
return c
|
return c
|
||||||
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user