added ability to switch audio profile during an active call

This commit is contained in:
liamcottle 2025-11-26 00:37:45 +13:00
parent e2ac380d0a
commit 94b14470ad
2 changed files with 33 additions and 0 deletions

View file

@ -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):

View file

@ -43,6 +43,15 @@
</span>
</div>
<!-- settings during connected call -->
<div v-if="activeCall.status === 6" class="mb-4">
<div class="w-full">
<select v-model="selectedAudioProfileId" @change="switchAudioProfile(selectedAudioProfileId)" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-zinc-900 dark:border-zinc-600 dark:text-white dark:focus:ring-blue-600 dark:focus:border-blue-600">
<option v-for="audioProfile in audioProfiles" :value="audioProfile.id">{{ audioProfile.name }}</option>
</select>
</div>
</div>
<!-- controls during connected call -->
<div v-if="activeCall.status === 6" class="mx-auto space-x-2 mb-4">
@ -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);
}
},
},
}
</script>