- Set volume control stream to STREAM_VOICE_CALL also when '183 Session

Progress' response is received.
- Set volume control stream to STREAM_VOICE_CALL only once.
- When call is closed, set volume control stream to DEFAULT_STREAM_TYPE.
This commit is contained in:
Juha Heinanen
2019-07-11 18:19:21 +03:00
parent 7ef11865ef
commit 0533642f59
2 changed files with 17 additions and 4 deletions

View File

@ -338,19 +338,27 @@ class BaresipService: Service() {
else
status[account_index] = R.drawable.dot_green
updateStatusNotification()
if (!Utils.isVisible())
return
}
"registering failed" -> {
status[account_index] = R.drawable.dot_red
updateStatusNotification()
if (!Utils.isVisible())
return
}
"unregistering" -> {
status[account_index] = R.drawable.dot_yellow
updateStatusNotification()
if (!Utils.isVisible())
return
}
"call progress", "call ringing" -> {
if (!isAudioFocused()) {
requestAudioFocus(AudioManager.STREAM_VOICE_CALL)
setCallVolume()
} else {
return
}
}
"call incoming" -> {
@ -430,6 +438,8 @@ class BaresipService: Service() {
requestAudioFocus(AudioManager.STREAM_VOICE_CALL)
setCallVolume()
}
if (!Utils.isVisible())
return
}
"call verified", "call secure" -> {
val call = Call.find(callp)
@ -443,6 +453,8 @@ class BaresipService: Service() {
call.security = R.drawable.box_green
call.zid = ev[1]
}
if (!Utils.isVisible())
return
}
"call transfer" -> {
val call = Call.find(callp)
@ -515,6 +527,8 @@ class BaresipService: Service() {
if (am.isSpeakerphoneOn) am.isSpeakerphoneOn = false
speakerPhone = false
}
if (!Utils.isVisible())
return
}
"transfer failed" -> {
Log.d(LOG_TAG, "AoR $aor hanging up call $callp with ${ev[1]}")
@ -524,8 +538,6 @@ class BaresipService: Service() {
}
}
}
if (!Utils.isVisible())
return
if (newEvent == null) newEvent = event
val intent = Intent("service event")
intent.flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP

View File

@ -630,8 +630,8 @@ class MainActivity : AppCompatActivity() {
": ${ev[1]}",
Toast.LENGTH_LONG).show()
}
"call ringing" -> {
setVolumeControlStream(AudioManager.STREAM_VOICE_CALL)
"call ringing", "call progress" -> {
volumeControlStream = AudioManager.STREAM_VOICE_CALL
}
"call rejected" -> {
if (ua == UserAgent.uas()[aorSpinner.selectedItemPosition]) {
@ -785,6 +785,7 @@ class MainActivity : AppCompatActivity() {
callsButton.setImageResource(R.drawable.calls_missed)
}
speakerIcon.setIcon(R.drawable.speaker_off)
volumeControlStream = AudioManager.USE_DEFAULT_STREAM_TYPE
val param = ev[1].trim()
if ((param != "") && (Call.uaCalls(ua, "").size == 0)) {
if (param.get(0).isDigit())