diff --git a/.strict-typing b/.strict-typing index 02d9968d247..169a361262c 100644 --- a/.strict-typing +++ b/.strict-typing @@ -95,7 +95,6 @@ homeassistant.components.aruba.* homeassistant.components.arwn.* homeassistant.components.aseko_pool_live.* homeassistant.components.assist_pipeline.* -homeassistant.components.asterisk_cdr.* homeassistant.components.asterisk_mbox.* homeassistant.components.asuswrt.* homeassistant.components.autarco.* diff --git a/homeassistant/brands/asterisk.json b/homeassistant/brands/asterisk.json deleted file mode 100644 index 1df3e660afe..00000000000 --- a/homeassistant/brands/asterisk.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "domain": "asterisk", - "name": "Asterisk", - "integrations": ["asterisk_cdr", "asterisk_mbox"] -} diff --git a/homeassistant/components/asterisk_cdr/__init__.py b/homeassistant/components/asterisk_cdr/__init__.py deleted file mode 100644 index d681a392c56..00000000000 --- a/homeassistant/components/asterisk_cdr/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""The asterisk_cdr component.""" diff --git a/homeassistant/components/asterisk_cdr/mailbox.py b/homeassistant/components/asterisk_cdr/mailbox.py deleted file mode 100644 index fde4826fcee..00000000000 --- a/homeassistant/components/asterisk_cdr/mailbox.py +++ /dev/null @@ -1,70 +0,0 @@ -"""Support for the Asterisk CDR interface.""" - -from __future__ import annotations - -import datetime -import hashlib -from typing import Any - -from homeassistant.components.asterisk_mbox import ( - DOMAIN as ASTERISK_DOMAIN, - SIGNAL_CDR_UPDATE, -) -from homeassistant.components.mailbox import Mailbox -from homeassistant.core import HomeAssistant, callback -from homeassistant.helpers.dispatcher import async_dispatcher_connect -from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType - -MAILBOX_NAME = "asterisk_cdr" - - -async def async_get_handler( - hass: HomeAssistant, - config: ConfigType, - discovery_info: DiscoveryInfoType | None = None, -) -> Mailbox: - """Set up the Asterix CDR platform.""" - return AsteriskCDR(hass, MAILBOX_NAME) - - -class AsteriskCDR(Mailbox): - """Asterisk VM Call Data Record mailbox.""" - - def __init__(self, hass: HomeAssistant, name: str) -> None: - """Initialize Asterisk CDR.""" - super().__init__(hass, name) - self.cdr: list[dict[str, Any]] = [] - async_dispatcher_connect(self.hass, SIGNAL_CDR_UPDATE, self._update_callback) - - @callback - def _update_callback(self, msg: list[dict[str, Any]]) -> Any: - """Update the message count in HA, if needed.""" - self._build_message() - self.async_update() - - def _build_message(self) -> None: - """Build message structure.""" - cdr: list[dict[str, Any]] = [] - for entry in self.hass.data[ASTERISK_DOMAIN].cdr: - timestamp = datetime.datetime.strptime( - entry["time"], "%Y-%m-%d %H:%M:%S" - ).timestamp() - info = { - "origtime": timestamp, - "callerid": entry["callerid"], - "duration": entry["duration"], - } - sha = hashlib.sha256(str(entry).encode("utf-8")).hexdigest() - msg = ( - f"Destination: {entry['dest']}\n" - f"Application: {entry['application']}\n " - f"Context: {entry['context']}" - ) - cdr.append({"info": info, "sha": sha, "text": msg}) - self.cdr = cdr - - async def async_get_messages(self) -> list[dict[str, Any]]: - """Return a list of the current messages.""" - if not self.cdr: - self._build_message() - return self.cdr diff --git a/homeassistant/components/asterisk_cdr/manifest.json b/homeassistant/components/asterisk_cdr/manifest.json deleted file mode 100644 index 581b9dfb9a5..00000000000 --- a/homeassistant/components/asterisk_cdr/manifest.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "domain": "asterisk_cdr", - "name": "Asterisk Call Detail Records", - "codeowners": [], - "dependencies": ["asterisk_mbox"], - "documentation": "https://www.home-assistant.io/integrations/asterisk_cdr", - "iot_class": "local_polling" -} diff --git a/homeassistant/generated/integrations.json b/homeassistant/generated/integrations.json index 25a78e30017..55e7a89c669 100644 --- a/homeassistant/generated/integrations.json +++ b/homeassistant/generated/integrations.json @@ -502,22 +502,11 @@ "config_flow": false, "iot_class": "local_push" }, - "asterisk": { - "name": "Asterisk", - "integrations": { - "asterisk_cdr": { - "integration_type": "hub", - "config_flow": false, - "iot_class": "local_polling", - "name": "Asterisk Call Detail Records" - }, - "asterisk_mbox": { - "integration_type": "hub", - "config_flow": false, - "iot_class": "local_push", - "name": "Asterisk Voicemail" - } - } + "asterisk_mbox": { + "name": "Asterisk Voicemail", + "integration_type": "hub", + "config_flow": false, + "iot_class": "local_push" }, "asuswrt": { "name": "ASUSWRT", diff --git a/mypy.ini b/mypy.ini index 0f4f8907612..67755595e69 100644 --- a/mypy.ini +++ b/mypy.ini @@ -705,16 +705,6 @@ disallow_untyped_defs = true warn_return_any = true warn_unreachable = true -[mypy-homeassistant.components.asterisk_cdr.*] -check_untyped_defs = true -disallow_incomplete_defs = true -disallow_subclassing_any = true -disallow_untyped_calls = true -disallow_untyped_decorators = true -disallow_untyped_defs = true -warn_return_any = true -warn_unreachable = true - [mypy-homeassistant.components.asterisk_mbox.*] check_untyped_defs = true disallow_incomplete_defs = true