Notifier: 489/400 to incoming SUBSCRIBE, final NOTIFY on UA.stop() - #980
Open
neutrino38 wants to merge 1 commit into
Open
neutrino38 wants to merge 1 commit into
neutrino38 wants to merge 1 commit into
Conversation
- Without a `newSubscribe` listener, an incoming SUBSCRIBE got 405 Method Not Allowed, although SUBSCRIBE is in the Allow header of that very response. What is missing is the event package: 489 Bad Event (RFC 6665 4.2.1.1). - A SUBSCRIBE without Contact or Event, or with a bad Expires, got 405 too; it is a malformed request: 400 Bad Request. - UA.stop() ends every Notifier with a final NOTIFY (Subscription-State: terminated), sent before the UA is closed, as it does for sessions. Subscribers no longer wait for the subscription to expire to learn that we are gone. - IncomingRequest.reply() is declared: every `newSubscribe` listener calls it, and had to cast the request to do so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Why
newSubscribelistener, an incoming SUBSCRIBE gets 405 Method Not Allowed, even though SUBSCRIBE appears in theAllowheader ofthat same response. What is unsupported is the event package, which is what 489 Bad Event says (RFC 6665 4.2.1.1).
UA.stop()leaves the subscriptions we serve open. Subscribers learn we are gone only when their subscription expires.IncomingRequest.reply()is not declared, although everynewSubscribelistener has to call it, so TypeScript users must cast the request.What
UA.receiveRequest(): an incoming SUBSCRIBE with no listener gets 489 instead of 405.Notifier.init_incoming(): a malformed SUBSCRIBE gets 400 instead of 405.UA.stop()sends a final NOTIFY (Subscription-State: terminated) for every activeNotifier, before the UA is closed. The UA tracksnotifiers through
newNotifier()anddestroyNotifier(), as it does for sessions. A fetch SUBSCRIBE (Expires: 0) is not tracked, since it isalready over. The final NOTIFY carries no
reason, so subscribers may re-subscribe whenever they want (RFC 6665 4.1.3).SIPMessage.d.tsnow declaresIncomingRequest.reply().Behaviour changes
The response code becomes 489 or 400 where it used to be 405. Applications that already call
notifier.terminate()beforeua.stop()areunaffected, because
terminate()is idempotent.Tests
src/test/test-Notifier.tscovers three cases: 489 without a listener, 400 on a SUBSCRIBE with no Event header, and the final NOTIFY onUA.stop(). All three fail without this change.npm testandnpm run lintpass.