- Simplified proximity sensing control with help of two new call events.
This commit is contained in:
@ -186,6 +186,12 @@ static void ua_event_handler(struct ua *ua, enum ua_event ev,
|
||||
}
|
||||
len = re_snprintf(event_buf, sizeof event_buf, "%s", "call incoming");
|
||||
break;
|
||||
case UA_EVENT_CALL_LOCAL_SDP:
|
||||
if (strcmp(prm, "offer"))
|
||||
len = re_snprintf(event_buf, sizeof event_buf, "%s", "call offered");
|
||||
else
|
||||
len = re_snprintf(event_buf, sizeof event_buf, "%s", "call answered");
|
||||
break;
|
||||
case UA_EVENT_CALL_RINGING:
|
||||
play = mem_deref(play);
|
||||
(void)play_file(&play, player, "ringback.wav", -1, NULL, NULL);
|
||||
|
||||
@ -419,8 +419,6 @@ class BaresipService: Service() {
|
||||
"SetSpeaker" -> {
|
||||
Log.d(LOG_TAG, "Set speakerphone $speakerPhone")
|
||||
am.isSpeakerphoneOn = speakerPhone
|
||||
if (Call.call("established") != null)
|
||||
proximitySensing(!speakerPhone)
|
||||
}
|
||||
|
||||
"Stop", "Stop Force" -> {
|
||||
@ -547,6 +545,10 @@ class BaresipService: Service() {
|
||||
if (!Utils.isVisible())
|
||||
return
|
||||
}
|
||||
"call offered" -> {
|
||||
proximitySensing(true)
|
||||
return
|
||||
}
|
||||
"call progress", "call ringing" -> {
|
||||
requestAudioFocus(AudioAttributes.USAGE_VOICE_COMMUNICATION)
|
||||
setCallVolume()
|
||||
@ -629,6 +631,10 @@ class BaresipService: Service() {
|
||||
return
|
||||
}
|
||||
}
|
||||
"call answered" -> {
|
||||
proximitySensing(true)
|
||||
return
|
||||
}
|
||||
"call established" -> {
|
||||
nm.cancel(CALL_NOTIFICATION_ID)
|
||||
val call = Call.find(callp)
|
||||
@ -649,7 +655,6 @@ class BaresipService: Service() {
|
||||
am.mode = AudioManager.MODE_IN_COMMUNICATION
|
||||
requestAudioFocus(AudioAttributes.USAGE_VOICE_COMMUNICATION)
|
||||
setCallVolume()
|
||||
proximitySensing(!speakerPhone)
|
||||
if (!Utils.isVisible())
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user