- 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
@@ -338,19 +338,27 @@ class BaresipService: Service() {
else else
status[account_index] = R.drawable.dot_green status[account_index] = R.drawable.dot_green
updateStatusNotification() updateStatusNotification()
if (!Utils.isVisible())
return
} }
"registering failed" -> { "registering failed" -> {
status[account_index] = R.drawable.dot_red status[account_index] = R.drawable.dot_red
updateStatusNotification() updateStatusNotification()
if (!Utils.isVisible())
return
} }
"unregistering" -> { "unregistering" -> {
status[account_index] = R.drawable.dot_yellow status[account_index] = R.drawable.dot_yellow
updateStatusNotification() updateStatusNotification()
if (!Utils.isVisible())
return
} }
"call progress", "call ringing" -> { "call progress", "call ringing" -> {
if (!isAudioFocused()) { if (!isAudioFocused()) {
requestAudioFocus(AudioManager.STREAM_VOICE_CALL) requestAudioFocus(AudioManager.STREAM_VOICE_CALL)
setCallVolume() setCallVolume()
} else {
return
} }
} }
"call incoming" -> { "call incoming" -> {
@@ -430,6 +438,8 @@ class BaresipService: Service() {
requestAudioFocus(AudioManager.STREAM_VOICE_CALL) requestAudioFocus(AudioManager.STREAM_VOICE_CALL)
setCallVolume() setCallVolume()
} }
if (!Utils.isVisible())
return
} }
"call verified", "call secure" -> { "call verified", "call secure" -> {
val call = Call.find(callp) val call = Call.find(callp)
@@ -443,6 +453,8 @@ class BaresipService: Service() {
call.security = R.drawable.box_green call.security = R.drawable.box_green
call.zid = ev[1] call.zid = ev[1]
} }
if (!Utils.isVisible())
return
} }
"call transfer" -> { "call transfer" -> {
val call = Call.find(callp) val call = Call.find(callp)
@@ -515,6 +527,8 @@ class BaresipService: Service() {
if (am.isSpeakerphoneOn) am.isSpeakerphoneOn = false if (am.isSpeakerphoneOn) am.isSpeakerphoneOn = false
speakerPhone = false speakerPhone = false
} }
if (!Utils.isVisible())
return
} }
"transfer failed" -> { "transfer failed" -> {
Log.d(LOG_TAG, "AoR $aor hanging up call $callp with ${ev[1]}") 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 if (newEvent == null) newEvent = event
val intent = Intent("service event") val intent = Intent("service event")
intent.flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP intent.flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP
@@ -630,8 +630,8 @@ class MainActivity : AppCompatActivity() {
": ${ev[1]}", ": ${ev[1]}",
Toast.LENGTH_LONG).show() Toast.LENGTH_LONG).show()
} }
"call ringing" -> { "call ringing", "call progress" -> {
setVolumeControlStream(AudioManager.STREAM_VOICE_CALL) volumeControlStream = AudioManager.STREAM_VOICE_CALL
} }
"call rejected" -> { "call rejected" -> {
if (ua == UserAgent.uas()[aorSpinner.selectedItemPosition]) { if (ua == UserAgent.uas()[aorSpinner.selectedItemPosition]) {
@@ -785,6 +785,7 @@ class MainActivity : AppCompatActivity() {
callsButton.setImageResource(R.drawable.calls_missed) callsButton.setImageResource(R.drawable.calls_missed)
} }
speakerIcon.setIcon(R.drawable.speaker_off) speakerIcon.setIcon(R.drawable.speaker_off)
volumeControlStream = AudioManager.USE_DEFAULT_STREAM_TYPE
val param = ev[1].trim() val param = ev[1].trim()
if ((param != "") && (Call.uaCalls(ua, "").size == 0)) { if ((param != "") && (Call.uaCalls(ua, "").size == 0)) {
if (param.get(0).isDigit()) if (param.get(0).isDigit())