Improved access to raw audio resources

This commit is contained in:
Juha Heinanen
2026-04-06 20:34:19 +03:00
parent b62bb9cc9c
commit d72a76785f

View File

@ -827,15 +827,15 @@ class BaresipService: Service() {
}
else {
val name = "callwaiting_$toneCountry"
val resourceId = applicationContext.resources.getIdentifier(
val resourceId = resources.getIdentifier(
name,
"raw",
applicationContext.packageName
packageName
)
if (resourceId != 0) {
playUnInterrupted(resourceId, 1)
} else {
Log.e(TAG, "Callwaiting tone $name.wav not found\")")
Log.e(TAG, "Callwaiting tone $name.wav not found")
}
if (ua.account.callHistory) {
CallHistoryNew(aor, peerUri, "in").add()
@ -1791,10 +1791,10 @@ class BaresipService: Service() {
private fun playRingBack() {
if (mediaPlayer == null) {
val name = "ringback_$toneCountry"
val resourceId = applicationContext.resources.getIdentifier(
val resourceId = resources.getIdentifier(
name,
"raw",
applicationContext.packageName)
packageName)
if (resourceId != 0) {
mediaPlayer = MediaPlayer.create(this, resourceId)
mediaPlayer?.isLooping = true
@ -1809,10 +1809,10 @@ class BaresipService: Service() {
private fun playBusy() {
if (mediaPlayer == null ) {
val name = "busy_$toneCountry"
val resourceId = applicationContext.resources.getIdentifier(
val resourceId = resources.getIdentifier(
name,
"raw",
applicationContext.packageName)
packageName)
if (resourceId != 0) {
mediaPlayer = MediaPlayer.create(this, resourceId)
mediaPlayer?.setOnCompletionListener {