INNER CODE UNIT · Python
log_all_sip_headers
arnonym/ha-plugins · ha-sip/src/account.py:168
def log_all_sip_headers(account_index: int, whole_msg: str) -> None:
log(account_index, 'Available SIP headers:')
for line in whole_msg.split('\r\n'):
if not line.strip():
break # End of headers
if ':' in line:
name, value = line.split(':', 1)
log(account_index, f' {name.strip()}: {value.strip()}')
@staticmethod
def is_number_in_list(number: Optional[str], number_list: list[str]) -> bool:
def map_to_regex(st: str) -> str:
if st == '{*}':
return '.*'
if st == '{?}':
return '.'
return re.escape(st)
if not number: