From ef90520b87f1d080e0591e4573a053fe1a49a185 Mon Sep 17 00:00:00 2001 From: Jamin Hitchcock Date: Mon, 26 Aug 2024 21:43:19 -0500 Subject: [PATCH] Fix to make mypy happy --- voip_utils/sip.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/voip_utils/sip.py b/voip_utils/sip.py index 263c1bb..dddda08 100644 --- a/voip_utils/sip.py +++ b/voip_utils/sip.py @@ -190,10 +190,10 @@ def datagram_received(self, data: bytes, addr): caller_endpoint = None # The From header should give us the URI used for sending SIP messages to the device if headers.get("from") is not None: - caller_endpoint = SipEndpoint(headers.get("from")) + caller_endpoint = SipEndpoint(headers.get("from") or "") # We can try using the Contact header as a fallback elif headers.get("contact") is not None: - caller_endpoint = SipEndpoint(headers.get("contact")) + caller_endpoint = SipEndpoint(headers.get("contact") or "") # If all else fails try to generate a URI based on the IP and port from the address the message came from else: caller_endpoint = get_sip_endpoint(caller_ip, port=caller_sip_port)