diff --git a/meshchat.py b/meshchat.py index d15c471..df56948 100644 --- a/meshchat.py +++ b/meshchat.py @@ -427,6 +427,7 @@ class ReticulumMeshChat: "is_outgoing": telephone_active_call.is_outgoing, "remote_identity_hash": remote_identity_hash, "remote_identity_name": remote_identity_name, + "audio_profile_id": self.telephone.active_profile, "is_receive_muted": is_receive_muted, "is_transmit_muted": is_transmit_muted, "tx_packets": telephone_active_call.tx, @@ -464,6 +465,15 @@ class ReticulumMeshChat: "message": "Hanging up call...", }) + # switch outbound audio profile + @routes.get("/api/v1/telephone/switch-audio-profile/{audio_profile_id}") + async def index(request): + audio_profile_id = int(request.match_info.get("audio_profile_id")) + AsyncUtils.run_async(asyncio.to_thread(self.telephone.switch_profile, audio_profile_id)) + return web.json_response({ + "message": "ok", + }) + # mute received audio @routes.get("/api/v1/telephone/mute-receive") async def index(request): diff --git a/src/frontend/components/telephone/TelephonePage.vue b/src/frontend/components/telephone/TelephonePage.vue index a38afd9..3c6b94f 100644 --- a/src/frontend/components/telephone/TelephonePage.vue +++ b/src/frontend/components/telephone/TelephonePage.vue @@ -43,6 +43,15 @@ + +
+
+ +
+
+
@@ -469,6 +478,12 @@ export default { this.isMicMuted = response.data.active_call?.is_transmit_muted ?? false; this.isSpeakerMuted = response.data.active_call?.is_receive_muted ?? false; + // update audio profile to what is being used in call + const audioProfileId = response.data.active_call.audio_profile_id; + if(audioProfileId != null){ + this.selectedAudioProfileId = audioProfileId; + } + } catch(e) { // do nothing on error console.error(e); @@ -528,6 +543,14 @@ export default { console.log(e); } }, + async switchAudioProfile(audioProfileId) { + try { + await window.axios.get(`/api/v1/telephone/switch-audio-profile/${audioProfileId}`); + await this.getTelephoneStatus(); + } catch(e) { + console.log(e); + } + }, }, }