Play busy tone when busy or decline response is received
This commit is contained in:
@@ -887,7 +887,9 @@ class BaresipService: Service() {
|
|||||||
call.onHoldCall = null
|
call.onHoldCall = null
|
||||||
}
|
}
|
||||||
call.remove()
|
call.remove()
|
||||||
if (!Call.inCall()) {
|
if (ev[2] == "busy") {
|
||||||
|
playBusy()
|
||||||
|
} else if (!Call.inCall()) {
|
||||||
resetCallVolume()
|
resetCallVolume()
|
||||||
abandonAudioFocus(applicationContext)
|
abandonAudioFocus(applicationContext)
|
||||||
proximitySensing(false)
|
proximitySensing(false)
|
||||||
@@ -1241,13 +1243,16 @@ class BaresipService: Service() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("UNUSED")
|
private fun playBusy() {
|
||||||
private fun playMedia(raw: Int, count: Int) {
|
|
||||||
if (mediaPlayer == null ) {
|
if (mediaPlayer == null ) {
|
||||||
mediaPlayer = MediaPlayer.create(this, raw)
|
mediaPlayer = MediaPlayer.create(applicationContext, R.raw.busy)
|
||||||
mediaPlayer?.setOnCompletionListener {
|
mediaPlayer?.setOnCompletionListener {
|
||||||
stopMediaPlayer()
|
stopMediaPlayer()
|
||||||
if (count > 1) playMedia(raw, count - 1)
|
if (!Call.inCall()) {
|
||||||
|
resetCallVolume()
|
||||||
|
abandonAudioFocus(applicationContext)
|
||||||
|
proximitySensing(false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mediaPlayer?.start()
|
mediaPlayer?.start()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user