diff --git a/panoramisk/actions.py b/panoramisk/actions.py index c1710c5..53d42c4 100644 --- a/panoramisk/actions.py +++ b/panoramisk/actions.py @@ -66,8 +66,6 @@ def multi(self): return True elif msg.startswith('added') and msg.endswith('to queue'): return True - elif msg.endswith('successfully queued') and self['async'] != 'false': - return True return False @property @@ -75,6 +73,8 @@ def completed(self): resp = self.responses[-1] if resp.event.endswith('Complete'): return True + elif resp.event == 'AsyncAGIExec': + return True elif resp.subevent in ('End', 'Exec'): return True elif resp.response in ('Success', 'Error', 'Fail', 'Failure'): diff --git a/panoramisk/manager.py b/panoramisk/manager.py index 6ca6dcb..f0d2a3a 100644 --- a/panoramisk/manager.py +++ b/panoramisk/manager.py @@ -99,9 +99,15 @@ def login(self, future): self.authenticated = bool(resp.success) if self.authenticated: self.loop.call_soon(self.on_login, self) - if self.pinger is not None: - self.pinger.cancel() - self.pinger = self.loop.call_later(self.ping_delay, self.ping) + if self.pinger is not None: + self.pinger.cancel() + self.pinger = self.loop.call_later(self.ping_delay, self.ping) + else: + self.log.error( + 'Asterisk AMI user %s with secret %s...%s login failed.', + self.config['username'], + str(self.config['secret'])[:1], + str(self.config['secret'])[-1:]) return self.authenticated def ping(self): # pragma: no cover