INNER CODE UNIT · Python

load_menu_from_file

arnonym/ha-plugins · ha-sip/src/main.py:38

def load_menu_from_file(file_name: Optional[str], sip_account_index: int) -> Optional[incoming_call.IncomingCallConfig]:
    if not file_name:
        log(sip_account_index, 'No file name for incoming call config specified.')
        return None
    try:
        with open(file_name) as stream:
            content = yaml.safe_load(stream)
            log(sip_account_index, f'Loaded menu for incoming call from "{file_name}".')
            return content
    except BaseException as e:
        log(sip_account_index, f'Error loading menu for incoming call: {e}')
        return None


def get_name_server(raw_name_server: str):
    name_server = [ns.strip() for ns in raw_name_server.split(",")]
    name_server_without_empty = [ns for ns in name_server if ns]
    if name_server_without_empty:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…