37 lines
1.9 KiB
Diff
37 lines
1.9 KiB
Diff
Upstream: Yes
|
|
Source: https://github.com/AGProjects/python3-sipsimple/commit/d75b225e566cae2c998504dc5cd76bb30226cb43
|
|
|
|
From d75b225e566cae2c998504dc5cd76bb30226cb43 Mon Sep 17 00:00:00 2001
|
|
From: Adrian Georgescu <ag@ag-projects.com>
|
|
Date: Tue, 16 Mar 2021 13:54:03 +0000
|
|
Subject: [PATCH] Decode uri.transport if is bytes in DNS Lookup
|
|
|
|
---
|
|
sipsimple/lookup.py | 5 +++--
|
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/sipsimple/lookup.py b/sipsimple/lookup.py
|
|
index 8ce86a92..27672da7 100644
|
|
--- a/sipsimple/lookup.py
|
|
+++ b/sipsimple/lookup.py
|
|
@@ -255,8 +255,9 @@ def lookup_sip_proxy(self, uri, supported_transports, timeout=3.0, lifetime=15.0
|
|
|
|
try:
|
|
# If the host part of the URI is an IP address, we will not do any lookup
|
|
+ transport = uri.transport.decode() if isinstance(uri.transport, bytes) else uri.transport
|
|
if re.match("^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$", uri.host.decode()):
|
|
- transport = 'tls' if uri.secure else uri.transport.lower()
|
|
+ transport = 'tls' if uri.secure else transport.lower()
|
|
if transport not in supported_transports:
|
|
raise DNSLookupError("IP transport %s dictated by URI is not supported" % transport)
|
|
port = uri.port or (5061 if transport=='tls' else 5060)
|
|
@@ -270,7 +271,7 @@ def lookup_sip_proxy(self, uri, supported_transports, timeout=3.0, lifetime=15.0
|
|
|
|
# If the port is specified in the URI, we will only do an A lookup
|
|
if uri.port:
|
|
- transport = 'tls' if uri.secure else uri.transport.lower()
|
|
+ transport = 'tls' if uri.secure else transport.lower()
|
|
if transport not in supported_transports:
|
|
raise DNSLookupError("Host transport %s dictated by URI is not supported" % transport)
|
|
addresses = self._lookup_a_records(resolver, [uri.host.decode()], log_context=log_context)
|