Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/voip/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"documentation": "https://www.home-assistant.io/integrations/voip",
"iot_class": "local_push",
"quality_scale": "internal",
"requirements": ["voip-utils==0.0.7"]
"requirements": ["voip-utils==0.1.0"]
}
26 changes: 21 additions & 5 deletions homeassistant/components/voip/voip.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
from typing import TYPE_CHECKING

import async_timeout
from voip_utils import CallInfo, RtpDatagramProtocol, SdpInfo, VoipDatagramProtocol
from voip_utils import (
CallInfo,
RtcpState,
RtpDatagramProtocol,
SdpInfo,
VoipDatagramProtocol,
)

from homeassistant.components import stt, tts
from homeassistant.components.assist_pipeline import (
Expand Down Expand Up @@ -46,7 +52,10 @@


def make_protocol(
hass: HomeAssistant, devices: VoIPDevices, call_info: CallInfo
hass: HomeAssistant,
devices: VoIPDevices,
call_info: CallInfo,
rtcp_state: RtcpState | None = None,
) -> VoipDatagramProtocol:
"""Plays a pre-recorded message if pipeline is misconfigured."""
voip_device = devices.async_get_or_create(call_info)
Expand All @@ -70,6 +79,7 @@ def make_protocol(
hass,
"problem.pcm",
opus_payload_type=call_info.opus_payload_type,
rtcp_state=rtcp_state,
)

vad_sensitivity = pipeline_select.get_vad_sensitivity(
Expand All @@ -86,6 +96,7 @@ def make_protocol(
Context(user_id=devices.config_entry.data["user"]),
opus_payload_type=call_info.opus_payload_type,
silence_seconds=VadSensitivity.to_seconds(vad_sensitivity),
rtcp_state=rtcp_state,
)


Expand All @@ -101,13 +112,14 @@ def __init__(self, hass: HomeAssistant, devices: VoIPDevices) -> None:
session_name="voip_hass",
version=__version__,
),
valid_protocol_factory=lambda call_info: make_protocol(
hass, devices, call_info
valid_protocol_factory=lambda call_info, rtcp_state: make_protocol(
hass, devices, call_info, rtcp_state
),
invalid_protocol_factory=lambda call_info: PreRecordMessageProtocol(
invalid_protocol_factory=lambda call_info, rtcp_state: PreRecordMessageProtocol(
hass,
"not_configured.pcm",
opus_payload_type=call_info.opus_payload_type,
rtcp_state=rtcp_state,
),
)
self.hass = hass
Expand Down Expand Up @@ -147,13 +159,15 @@ def __init__(
tone_delay: float = 0.2,
tts_extra_timeout: float = 1.0,
silence_seconds: float = 1.0,
rtcp_state: RtcpState | None = None,
) -> None:
"""Set up pipeline RTP server."""
super().__init__(
rate=RATE,
width=WIDTH,
channels=CHANNELS,
opus_payload_type=opus_payload_type,
rtcp_state=rtcp_state,
)

self.hass = hass
Expand Down Expand Up @@ -454,13 +468,15 @@ def __init__(
opus_payload_type: int,
message_delay: float = 1.0,
loop_delay: float = 2.0,
rtcp_state: RtcpState | None = None,
) -> None:
"""Set up RTP server."""
super().__init__(
rate=RATE,
width=WIDTH,
channels=CHANNELS,
opus_payload_type=opus_payload_type,
rtcp_state=rtcp_state,
)
self.hass = hass
self.file_name = file_name
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2614,7 +2614,7 @@ venstarcolortouch==0.19
vilfo-api-client==0.4.1

# homeassistant.components.voip
voip-utils==0.0.7
voip-utils==0.1.0

# homeassistant.components.volkszaehler
volkszaehler==0.4.0
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,7 @@ venstarcolortouch==0.19
vilfo-api-client==0.4.1

# homeassistant.components.voip
voip-utils==0.0.7
voip-utils==0.1.0

# homeassistant.components.volvooncall
volvooncall==0.10.3
Expand Down