Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VOIP - handle ongoing calls for announce and start conversation #136970

Closed
wants to merge 1 commit into from
Closed
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
9 changes: 7 additions & 2 deletions homeassistant/components/voip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
import logging

from voip_utils import SIP_PORT
from voip_utils.sip import get_sip_endpoint

from homeassistant.auth.const import GROUP_ID_USER
from homeassistant.components.network import async_get_source_ip
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr

from .const import CONF_SIP_PORT, DOMAIN
from .const import CONF_SIP_PORT, CONF_SIP_USER, DEFAULT_SIP_USER, DOMAIN
from .devices import VoIPDevices
from .voip import HassVoipDatagramProtocol

Expand Down Expand Up @@ -59,12 +61,15 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
entry, data={**entry.data, "user": voip_user.id}
)

sip_host = await async_get_source_ip(hass)
sip_port = entry.options.get(CONF_SIP_PORT, SIP_PORT)
sip_user = entry.options.get(CONF_SIP_USER, DEFAULT_SIP_USER)
devices = VoIPDevices(hass, entry)
devices.async_setup()
local_endpoint = get_sip_endpoint(sip_host, port=sip_port, username=sip_user)
transport, protocol = await _create_sip_server(
hass,
lambda: HassVoipDatagramProtocol(hass, devices),
lambda: HassVoipDatagramProtocol(hass, devices, local_endpoint),
sip_port,
)
_LOGGER.debug("Listening for VoIP calls on port %s", sip_port)
Expand Down
Loading
Loading