diff --git a/asterisk/ami/client.py b/asterisk/ami/client.py index 5c7154a..0009a9c 100644 --- a/asterisk/ami/client.py +++ b/asterisk/ami/client.py @@ -312,6 +312,9 @@ def try_reconnect(self): if response is not None and not response.is_error(): self.on_reconnect(self._ami_client, response) return True + except (BrokenPipeError): + self._ami_client.disconnect() + self.try_reconnect() except: pass return False