Remove deprecated asterisk_cdr integration (#123180)
parent
b73ca874bb
commit
96364f0452
|
@ -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.*
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"domain": "asterisk",
|
||||
"name": "Asterisk",
|
||||
"integrations": ["asterisk_cdr", "asterisk_mbox"]
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
"""The asterisk_cdr component."""
|
|
@ -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
|
|
@ -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"
|
||||
}
|
|
@ -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",
|
||||
|
|
10
mypy.ini
10
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
|
||||
|
|
Loading…
Reference in New Issue