diff --git a/src/danog/MadelineProto/API.php b/src/danog/MadelineProto/API.php index 6b24cfbbb..6f5d82c26 100644 --- a/src/danog/MadelineProto/API.php +++ b/src/danog/MadelineProto/API.php @@ -92,8 +92,9 @@ class API extends InternalDoc * Session paths. * * @internal + * @var SessionPaths */ - public SessionPaths $session; + public $session; /** * Instance of MadelineProto. @@ -343,7 +344,7 @@ class API extends InternalDoc if ($this->unlock) { ($this->unlock)(); } - } else { + } else if ($this->logger) { $this->logger->logger('Shutting down MadelineProto (old deserialized instance of API)'); } } diff --git a/src/danog/MadelineProto/VoIP.php b/src/danog/MadelineProto/VoIP.php index df92ff919..85e5dc201 100644 --- a/src/danog/MadelineProto/VoIP.php +++ b/src/danog/MadelineProto/VoIP.php @@ -285,7 +285,7 @@ class VoIP */ public function discard($reason = ['_' => 'phoneCallDiscardReasonDisconnect'], $rating = [], $debug = false) { - if ($this->callState === self::CALL_STATE_ENDED || empty($this->configuration)) { + if (($this->callState ?? self::CALL_STATE_ENDED) === self::CALL_STATE_ENDED || empty($this->configuration)) { return false; } $this->callState = self::CALL_STATE_ENDED; @@ -606,7 +606,7 @@ class VoIP */ public function getCallState(): int { - return $this->callState; + return $this->callState ?? self::CALL_STATE_ENDED; } /** diff --git a/src/danog/MadelineProto/VoIP/AuthKeyHandler.php b/src/danog/MadelineProto/VoIP/AuthKeyHandler.php index 8b6087941..a3b99ca92 100644 --- a/src/danog/MadelineProto/VoIP/AuthKeyHandler.php +++ b/src/danog/MadelineProto/VoIP/AuthKeyHandler.php @@ -324,6 +324,7 @@ trait AuthKeyHandler if ($controller->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_ENDED) { $this->logger("Discarding ended call..."); $controller->discard(); + unset($this->calls[$id]); } }); }