Make sure that ringing stops when call is rejected
Fixed handling of incoming call Do not call startRinging() when mobile all is coming in
This commit is contained in:
@ -545,6 +545,8 @@ class BaresipService: Service() {
|
|||||||
"Call Reject" -> {
|
"Call Reject" -> {
|
||||||
val callp = intent!!.getLongExtra("callp", 0L)
|
val callp = intent!!.getLongExtra("callp", 0L)
|
||||||
val call = Call.ofCallp(callp)
|
val call = Call.ofCallp(callp)
|
||||||
|
stopRinging()
|
||||||
|
stopMediaPlayer()
|
||||||
if (call == null) {
|
if (call == null) {
|
||||||
Log.w(TAG, "onStartCommand did not find call $callp")
|
Log.w(TAG, "onStartCommand did not find call $callp")
|
||||||
} else {
|
} else {
|
||||||
@ -667,7 +669,6 @@ class BaresipService: Service() {
|
|||||||
else -> {
|
else -> {
|
||||||
Log.e(TAG, "Unknown start action $action")
|
Log.e(TAG, "Unknown start action $action")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return START_STICKY
|
return START_STICKY
|
||||||
@ -1795,17 +1796,23 @@ class BaresipService: Service() {
|
|||||||
calls.add(call)
|
calls.add(call)
|
||||||
setCallVolume()
|
setCallVolume()
|
||||||
ensureCommunicationMode()
|
ensureCommunicationMode()
|
||||||
postServiceEvent(ServiceEvent(
|
|
||||||
if (isIncoming) "call incoming" else "call outgoing",
|
if (isIncoming)
|
||||||
arrayListOf(ua.uap, call.callp),
|
handleIncomingCall(call)
|
||||||
System.nanoTime())
|
else
|
||||||
)
|
postServiceEvent(ServiceEvent(
|
||||||
|
"call outgoing",
|
||||||
|
arrayListOf(ua.uap, call.callp),
|
||||||
|
System.nanoTime())
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun handleExternalCallRemoved(telecomCall: android.telecom.Call) {
|
fun handleExternalCallRemoved(telecomCall: android.telecom.Call) {
|
||||||
val callp = telecomCall.hashCode().toLong()
|
val callp = telecomCall.hashCode().toLong()
|
||||||
val call = calls.find { it.callp == callp }
|
val call = calls.find { it.callp == callp }
|
||||||
if (call != null) {
|
if (call != null) {
|
||||||
|
stopRinging()
|
||||||
|
stopMediaPlayer()
|
||||||
if (call.ua.account.callHistory) {
|
if (call.ua.account.callHistory) {
|
||||||
val historyPeerUri = e164Uri(call.peerUri, call.ua.account.countryCode)
|
val historyPeerUri = e164Uri(call.peerUri, call.ua.account.countryCode)
|
||||||
val history = CallHistoryNew(call.ua.account.aor, historyPeerUri, call.dir)
|
val history = CallHistoryNew(call.ua.account.aor, historyPeerUri, call.dir)
|
||||||
@ -1888,7 +1895,7 @@ class BaresipService: Service() {
|
|||||||
val callp = call.callp
|
val callp = call.callp
|
||||||
|
|
||||||
val callerNumber = Utils.uriUserPart(peerUri)
|
val callerNumber = Utils.uriUserPart(peerUri)
|
||||||
if (shouldStartRinging(callerNumber))
|
if (call !is Call.ExternalCall && shouldStartRinging(callerNumber))
|
||||||
startRinging()
|
startRinging()
|
||||||
|
|
||||||
if (!Utils.isVisible()) {
|
if (!Utils.isVisible()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user