mirror of
https://github.com/home-assistant/core.git
synced 2026-09-28 02:18:10 -04:00
VoIP listening tone and "not configured" message (#91762)
* Play tone when starting a VoIP call * Play audio message when call is rejected * Add option to disable tone for tests * Send RTP audio in executor to reduce jitter * Don't start pipeline until speech * Bump voip utils
This commit is contained in:
@@ -35,7 +35,6 @@ async def test_pipeline(
|
||||
async for _chunk in stt_stream:
|
||||
# Stream will end when VAD detects end of "speech"
|
||||
assert _chunk != bad_chunk
|
||||
pass
|
||||
|
||||
# Test empty data
|
||||
event_callback(
|
||||
@@ -84,14 +83,17 @@ async def test_pipeline(
|
||||
new=async_get_media_source_audio,
|
||||
):
|
||||
rtp_protocol = voip.voip.PipelineRtpDatagramProtocol(
|
||||
hass, hass.config.language, voip_device
|
||||
hass,
|
||||
hass.config.language,
|
||||
voip_device,
|
||||
listening_tone_enabled=False,
|
||||
)
|
||||
rtp_protocol.transport = Mock()
|
||||
|
||||
# Ensure audio queue is cleared before pipeline starts
|
||||
rtp_protocol._audio_queue.put_nowait(bad_chunk)
|
||||
|
||||
async def send_audio(*args, **kwargs):
|
||||
def send_audio(*args, **kwargs):
|
||||
# Test finished successfully
|
||||
done.set()
|
||||
|
||||
@@ -123,9 +125,16 @@ async def test_pipeline_timeout(hass: HomeAssistant, voip_device: VoIPDevice) ->
|
||||
with patch(
|
||||
"homeassistant.components.voip.voip.async_pipeline_from_audio_stream",
|
||||
new=async_pipeline_from_audio_stream,
|
||||
), patch(
|
||||
"homeassistant.components.voip.voip.PipelineRtpDatagramProtocol._wait_for_speech",
|
||||
return_value=True,
|
||||
):
|
||||
rtp_protocol = voip.voip.PipelineRtpDatagramProtocol(
|
||||
hass, hass.config.language, voip_device, pipeline_timeout=0.001
|
||||
hass,
|
||||
hass.config.language,
|
||||
voip_device,
|
||||
pipeline_timeout=0.001,
|
||||
listening_tone_enabled=False,
|
||||
)
|
||||
transport = Mock(spec=["close"])
|
||||
rtp_protocol.connection_made(transport)
|
||||
@@ -158,7 +167,11 @@ async def test_stt_stream_timeout(hass: HomeAssistant, voip_device: VoIPDevice)
|
||||
new=async_pipeline_from_audio_stream,
|
||||
):
|
||||
rtp_protocol = voip.voip.PipelineRtpDatagramProtocol(
|
||||
hass, hass.config.language, voip_device, audio_timeout=0.001
|
||||
hass,
|
||||
hass.config.language,
|
||||
voip_device,
|
||||
audio_timeout=0.001,
|
||||
listening_tone_enabled=False,
|
||||
)
|
||||
transport = Mock(spec=["close"])
|
||||
rtp_protocol.connection_made(transport)
|
||||
|
||||
Reference in New Issue
Block a user