Play busy tone when busy or decline response is received

This commit is contained in:
Juha Heinanen
2023-04-15 08:01:32 +03:00
parent 0e5ba4e559
commit ea4a584228

View File

@ -887,7 +887,9 @@ class BaresipService: Service() {
call.onHoldCall = null
}
call.remove()
if (!Call.inCall()) {
if (ev[2] == "busy") {
playBusy()
} else if (!Call.inCall()) {
resetCallVolume()
abandonAudioFocus(applicationContext)
proximitySensing(false)
@ -1241,13 +1243,16 @@ class BaresipService: Service() {
}
}
@Suppress("UNUSED")
private fun playMedia(raw: Int, count: Int) {
private fun playBusy() {
if (mediaPlayer == null ) {
mediaPlayer = MediaPlayer.create(this, raw)
mediaPlayer = MediaPlayer.create(applicationContext, R.raw.busy)
mediaPlayer?.setOnCompletionListener {
stopMediaPlayer()
if (count > 1) playMedia(raw, count - 1)
if (!Call.inCall()) {
resetCallVolume()
abandonAudioFocus(applicationContext)
proximitySensing(false)
}
}
mediaPlayer?.start()
}