Fix bare KeyError crash in _callback_RESP_NotFound / _callback_RESP_Unavailable - #320
Open
hainesdev wants to merge 1 commit into
Open
Fix bare KeyError crash in _callback_RESP_NotFound / _callback_RESP_Unavailable#320hainesdev wants to merge 1 commit into
hainesdev wants to merge 1 commit into
Conversation
Fixes tayler6000#85 [FIX] Fixed _callback_RESP_NotFound and _callback_RESP_Unavailable checking `if call_id not in self.calls` and logging a debug message, but never returning afterward, unlike the otherwise identical _callback_RESP_OK. Both fell through into self.calls[call_id]... and crashed with a bare KeyError. Reachable in normal operation: invite()'s own blocking response loop can hand either of these an early response (e.g. a 404 on a registration, or a 503 on a pre-auth probe INVITE) that arrives before the call/registration is registered in self.calls.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #85
_callback_RESP_NotFoundand_callback_RESP_Unavailablecheckif call_id not in self.callsand log a debug message, but (unlike the otherwise-identical_callback_RESP_OK, which already has the correctreturn) never actually return afterward -- so they fall through intoself.calls[call_id]...and crash with a bareKeyErrorinstead of the graceful handling the surrounding code clearly intended.This matches the traceback in #85 exactly: a 404 arriving during registration lands in
_callback_RESP_NotFoundbefore the call/registration is inself.calls, and crashes withKeyError: '<call-id>'. It's also reachable from a normal call attempt:invite()'s own blocking response loop can hand either callback an early response (e.g. a 503 on a pre-auth probe INVITE) that arrives beforeVoIPPhone.call()has gotten around to registering the call inself.calls.Fix adds the missing
returnto both, matching the pattern_callback_RESP_OKalready uses correctly.