play beep when voice call connects

This commit is contained in:
Daniel Gultsch 2020-04-28 07:30:27 +02:00
parent 418cecad11
commit 27bf871472
1 changed files with 18 additions and 2 deletions

View File

@ -48,6 +48,13 @@ public class ToneManager {
return ToneState.ENDING_CALL; return ToneState.ENDING_CALL;
} }
} }
if (state == RtpEndUserState.CONNECTED) {
if (media.contains(Media.VIDEO)) {
return ToneState.NULL;
} else {
return ToneState.CONNECTED;
}
}
return ToneState.NULL; return ToneState.NULL;
} }
@ -64,6 +71,9 @@ public class ToneManager {
case RINGING: case RINGING:
scheduleWaitingTone(); scheduleWaitingTone();
break; break;
case CONNECTED:
scheduleConnected();
break;
case BUSY: case BUSY:
scheduleBusy(); scheduleBusy();
break; break;
@ -74,9 +84,15 @@ public class ToneManager {
this.state = state; this.state = state;
} }
private void scheduleConnected() {
this.currentTone = JingleConnectionManager.SCHEDULED_EXECUTOR_SERVICE.schedule(() -> {
this.toneGenerator.startTone(ToneGenerator.TONE_CDMA_ONE_MIN_BEEP, 145);
}, 0, TimeUnit.SECONDS);
}
private void scheduleEnding() { private void scheduleEnding() {
this.currentTone = JingleConnectionManager.SCHEDULED_EXECUTOR_SERVICE.schedule(() -> { this.currentTone = JingleConnectionManager.SCHEDULED_EXECUTOR_SERVICE.schedule(() -> {
this.toneGenerator.startTone(ToneGenerator.TONE_CDMA_CONFIRM, 600); this.toneGenerator.startTone(ToneGenerator.TONE_CDMA_CALLDROP_LITE, 375);
}, 0, TimeUnit.SECONDS); }, 0, TimeUnit.SECONDS);
} }
@ -100,6 +116,6 @@ public class ToneManager {
} }
private enum ToneState { private enum ToneState {
NULL, RINGING, BUSY, ENDING_CALL NULL, RINGING, CONNECTED, BUSY, ENDING_CALL
} }
} }