- Added Call History menu that allows deleting of account's call history

and disabling/enabling production of account's call history.
This commit is contained in:
Juha Heinanen
2019-09-30 17:58:40 +03:00
parent e5369e4b82
commit 0e8ba14deb
6 changed files with 89 additions and 22 deletions
@@ -201,8 +201,10 @@ class BaresipService: Service() {
val aor = call.ua.account.aor
Log.d(LOG_TAG, "Aor $aor rejected incoming call $callp from $peerUri")
Api.ua_hangup(call.ua.uap, callp, 486, "Rejected")
CallHistory.add(CallHistory(aor, peerUri, "in", false))
CallHistory.save(filesPath)
if (call.ua.account.callHistory) {
CallHistory.add(CallHistory(aor, peerUri, "in", false))
CallHistory.save(filesPath)
}
}
}
@@ -409,9 +411,11 @@ class BaresipService: Service() {
if ((Call.calls().size > 0) || (tm.callState != TelephonyManager.CALL_STATE_IDLE)) {
Log.d(LOG_TAG, "Auto-rejecting incoming call $uap/$callp/$peerUri")
Api.ua_hangup(uap, callp, 486, "Busy Here")
CallHistory.add(CallHistory(aor, peerUri, "in", false))
CallHistory.save(filesPath)
ua.account.missedCalls = true
if (ua.account.callHistory) {
CallHistory.add(CallHistory(aor, peerUri, "in", false))
CallHistory.save(filesPath)
ua.account.missedCalls = true
}
if (!Utils.isVisible())
return
newEvent = "call rejected"
@@ -486,9 +490,11 @@ class BaresipService: Service() {
Log.d(LOG_TAG, "AoR $aor call $callp established")
call.status = "connected"
call.onhold = false
CallHistory.add(CallHistory(aor, call.peerURI, call.dir, true))
CallHistory.save(filesPath)
call.hasHistory = true
if (ua.account.callHistory) {
CallHistory.add(CallHistory(aor, call.peerURI, call.dir, true))
CallHistory.save(filesPath)
call.hasHistory = true
}
if (call.dir == "in") {
stopRinging()
am.mode = AudioManager.MODE_IN_COMMUNICATION
@@ -574,7 +580,7 @@ class BaresipService: Service() {
Log.d(LOG_TAG, "AoR $aor call $callp is closed")
if (call.status == "incoming") stopRinging()
calls.remove(call)
if (!call.hasHistory) {
if (ua.account.callHistory && !call.hasHistory) {
CallHistory.add(CallHistory(aor, call.peerURI, call.dir, false))
CallHistory.save(filesPath)
if (call.dir == "in") ua.account.missedCalls = true