- 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");
|
len = re_snprintf(event_buf, sizeof event_buf, "%s", "call incoming");
|
||||||
break;
|
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:
|
case UA_EVENT_CALL_RINGING:
|
||||||
play = mem_deref(play);
|
play = mem_deref(play);
|
||||||
(void)play_file(&play, player, "ringback.wav", -1, NULL, NULL);
|
(void)play_file(&play, player, "ringback.wav", -1, NULL, NULL);
|
||||||
|
|||||||
@@ -419,8 +419,6 @@ class BaresipService: Service() {
|
|||||||
"SetSpeaker" -> {
|
"SetSpeaker" -> {
|
||||||
Log.d(LOG_TAG, "Set speakerphone $speakerPhone")
|
Log.d(LOG_TAG, "Set speakerphone $speakerPhone")
|
||||||
am.isSpeakerphoneOn = speakerPhone
|
am.isSpeakerphoneOn = speakerPhone
|
||||||
if (Call.call("established") != null)
|
|
||||||
proximitySensing(!speakerPhone)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
"Stop", "Stop Force" -> {
|
"Stop", "Stop Force" -> {
|
||||||
@@ -547,6 +545,10 @@ class BaresipService: Service() {
|
|||||||
if (!Utils.isVisible())
|
if (!Utils.isVisible())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
"call offered" -> {
|
||||||
|
proximitySensing(true)
|
||||||
|
return
|
||||||
|
}
|
||||||
"call progress", "call ringing" -> {
|
"call progress", "call ringing" -> {
|
||||||
requestAudioFocus(AudioAttributes.USAGE_VOICE_COMMUNICATION)
|
requestAudioFocus(AudioAttributes.USAGE_VOICE_COMMUNICATION)
|
||||||
setCallVolume()
|
setCallVolume()
|
||||||
@@ -629,6 +631,10 @@ class BaresipService: Service() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"call answered" -> {
|
||||||
|
proximitySensing(true)
|
||||||
|
return
|
||||||
|
}
|
||||||
"call established" -> {
|
"call established" -> {
|
||||||
nm.cancel(CALL_NOTIFICATION_ID)
|
nm.cancel(CALL_NOTIFICATION_ID)
|
||||||
val call = Call.find(callp)
|
val call = Call.find(callp)
|
||||||
@@ -649,7 +655,6 @@ class BaresipService: Service() {
|
|||||||
am.mode = AudioManager.MODE_IN_COMMUNICATION
|
am.mode = AudioManager.MODE_IN_COMMUNICATION
|
||||||
requestAudioFocus(AudioAttributes.USAGE_VOICE_COMMUNICATION)
|
requestAudioFocus(AudioAttributes.USAGE_VOICE_COMMUNICATION)
|
||||||
setCallVolume()
|
setCallVolume()
|
||||||
proximitySensing(!speakerPhone)
|
|
||||||
if (!Utils.isVisible())
|
if (!Utils.isVisible())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user