-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for multiple request matching strategies when processing NOTIFY requests #24
base: master
Are you sure you want to change the base?
Add support for multiple request matching strategies when processing NOTIFY requests #24
Conversation
This commit introduces a concept of a request processing strategy, which is evaluated against the incoming request. This (collection of) strateg(y/ies) provides a determination mechanism of a request being processed by a SipSession or its children. Thus a user may provide extensions to the SipSession on which inbound requests may be accepted without the need to mutate any parameters, or request event processing mechanisms in SipPhone This is a derivation of the request matcher, allowing for a more flexible implementation.
In order to support extensible request handling, we introduce the RequestProcessor class, which is tasked with executing a sequence of strategies over an inbound request for a SipListener instance. These strategies execute sequentially until one of the strategies accepts the request. If no strategies were executed or the validation fails, the governing SipPhone will return an appropriate error (which indicates that either the event was not recognized or the subscription was orphaned).
@jaimecasero this one is also up for review ;) |
* | ||
* @see RequestProcessor | ||
*/ | ||
public class RequestProcessingResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about converting this to an enum, because the double boolean tautology may confuse the implementing user of the strategies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@teles-mami makes sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After further analysis, we will need this form for the event processing logic.
Specifically in "presence" event processing, we will have successful (orphaned) events which will be processed later on, but not in the current handler.
Leaving the logic as-is.
Also like the other PR, |
The SipPhone class has a specific flow for processing NOTIFY requests:
validate request -> process if event is (conference | refer | presence | send bad request) -> else orphaned event error (call or transaction does not exist).
This flow is hard to intercept and extend via inheritance without actually copy-pasting code from the SipPhone itself. In order to avoid cumbersome inheritance of SipPhone for NOTIFY request processing, we introduce the conctept of executable NOTIFY processing strategies, which will determine if a request belongs to one of the registered EventSubscriber classes (which are not so difficultly inherited).
Thus we take inspiration from the request handling strategy solution and introduce strategies which will allow to further the spectrum of event packages which the SipPhone supports.
This pull request does NOT provide extended set of event packages, and does not address the issue of coupling of EventSubscriber with the SipPhone parent. It is a prelude and a gateway to the end user/tester to provide their own solutions and customized event handling without actually inheriting the SipPhone itself.
Related issue