Skip to content

Fix bare KeyError crash in _callback_RESP_NotFound / _callback_RESP_Unavailable - #320

Open
hainesdev wants to merge 1 commit into
tayler6000:masterfrom
hainesdev:bugfix/Issue-85
Open

Fix bare KeyError crash in _callback_RESP_NotFound / _callback_RESP_Unavailable#320
hainesdev wants to merge 1 commit into
tayler6000:masterfrom
hainesdev:bugfix/Issue-85

Conversation

@hainesdev

Copy link
Copy Markdown

Fixes #85

_callback_RESP_NotFound and _callback_RESP_Unavailable check if call_id not in self.calls and log a debug message, but (unlike the otherwise-identical _callback_RESP_OK, which already has the correct return) never actually return afterward -- so they fall through into self.calls[call_id]... and crash with a bare KeyError instead 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_NotFound before the call/registration is in self.calls, and crashes with KeyError: '<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 before VoIPPhone.call() has gotten around to registering the call in self.calls.

Fix adds the missing return to both, matching the pattern _callback_RESP_OK already uses correctly.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KeyError: 'd4735e3a265e16eee03f59718b9b5d03@0.0.0.0:5060'

1 participant