From 256130c7303cb3cc60161b2f362c676a6fbb9a18 Mon Sep 17 00:00:00 2001 From: Tayler Porter Date: Mon, 12 Sep 2022 11:01:04 -0500 Subject: [PATCH] Released v1.5.6 [FIX] Fixed blank `except:` to be `except Exception:` [FIX] Fixed trying check timeout --- docs/conf.py | 2 +- pyVoIP/RTP.py | 2 +- pyVoIP/SIP.py | 16 ++++++++++------ pyVoIP/__init__.py | 2 +- setup.py | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 6cb4d1b..fcdf47a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,7 +24,7 @@ author = 'Tayler J Porter' # The full version, including alpha/beta/rc tags -release = '1.5.5' +release = '1.5.6' master_doc = 'index' diff --git a/pyVoIP/RTP.py b/pyVoIP/RTP.py index 78e9028..a040b6a 100644 --- a/pyVoIP/RTP.py +++ b/pyVoIP/RTP.py @@ -217,7 +217,7 @@ def __init__(self, assoc, inIP, inPort, outIP, outPort, sendrecv, dtmf = None): debug(f"Selected {assoc[m]}") self.preference = assoc[m] #Select the first available actual codec to encode with. TODO: will need to change if video codecs are ever implemented. break - except: + except Exception: debug(f"{assoc[m]} cannot be selected as an audio codec") self.inIP = inIP diff --git a/pyVoIP/SIP.py b/pyVoIP/SIP.py index 1fb3139..669dad2 100644 --- a/pyVoIP/SIP.py +++ b/pyVoIP/SIP.py @@ -934,11 +934,15 @@ def tryingTimeoutCheck(self, response): # when this happens, the first response you get from the server is # SIPStatus.TRYING. This while loop tries checks every second for an updated # response. It times out after 30 seconds. - waitTime = 0 + start_time = time.monotonic() + old_timeout = self.s.gettimeout() while response.status == SIPStatus.TRYING: - time.sleep(1) - waitTime += 1 - response = SIPMessage(self.s.recv(8192)) - if waitTime >= 30: + self.s.settimeout(1) + try: + response = SIPMessage(self.s.recv(8192)) + except TimeoutError: + pass + self.s.settimeout(old_timeout) + if (time.monotonic() - start_time) >= 30: raise ResponseTimeoutError("Timeout error for response, waited 30 seconds but SIPStatus is still TRYING") - return response \ No newline at end of file + return response diff --git a/pyVoIP/__init__.py b/pyVoIP/__init__.py index 12986b9..9d9d93c 100644 --- a/pyVoIP/__init__.py +++ b/pyVoIP/__init__.py @@ -1,7 +1,7 @@ __all__ = ['SIP', 'RTP', 'VoIP'] -version_info = (1, 5, 5) +version_info = (1, 5, 6) __version__ = ".".join([str(x) for x in version_info]) diff --git a/setup.py b/setup.py index fb0b2da..1393f9a 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name='pyVoIP', - version='1.5.5.post1', + version='1.5.6', description='PyVoIP is a pure python VoIP/SIP/RTP library.', long_description=long_description, long_description_content_type="text/markdown",