Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to using the From header for device ID #20

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions voip_utils/sip.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ def datagram_received(self, data: bytes, addr):

caller_uri = None
caller_name = None
# The Contact header should give us the URI used for sending SIP messages to the device
if headers.get("contact") is not None:
caller_uri, caller_name = self._parse_uri_header(headers.get("contact"))
# We can try using the From header as a fallback
elif headers.get("from") is not 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_uri, caller_name = self._parse_uri_header(headers.get("from"))
# We can try using the Contact header as a fallback
elif headers.get("contact") is not None:
caller_uri, caller_name = self._parse_uri_header(headers.get("contact"))
# If all else fails try to generate a URI based on the IP and port from the address the message came from
else:
caller_uri = "sip:" + caller_ip + ":" + caller_sip_port
Expand Down