-
Notifications
You must be signed in to change notification settings - Fork 746
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
Don't fire "unregistered" event when there is no 200 to the un-REGISTER #26
Comments
I think a new event 'unRegistrationFailure' will cover all the cases: When executing unregister(), no event is emitted until response reception. |
This behavior is not aligned with what we do for sessions, for example. In sessions we fire the ended event even if there is no 200 OK for the BYE. I'm not sure how relevant this is for registrations, in the end, you may unregister, and one second later the server sends you a call, what do you do? Timeout may come very late, you don't want to be waiting that long for unregistering... I'd give the request a 1 second timeout, and if it's not replied within this amount of time, just fake the event. Nothing bad can happen anyway. |
Yes. If there is not response in the first second/s.., the response is not likely to reach anyway, and having to wait the transaction timeout makes the event unresponsive. This is quite a special case. |
Hi, I guess the following approach satisfies all the needs:
Every |
+1 |
Why not have a single event: registrationStatusChanged and then in the payload have a status attribute with registrationStarted, registrationCompleted, registrationFailed, derefgistrationStarted, .... |
It is a good approach indeed. This is something that may be extended to every JsSIP object that handles a 'status' attribute. It reduces the number of events in those objects handling a 'status' attribute like; This supposes a mayor change and is being considered. Thanx for suggestion! |
Lets implement by adding those new events (registering, unregistering, unregistrationFailed) insead of the 'registrationStatusChanged' approach. Both are perfectly valid and usable. JsSIP does already implement the first approach in all the library. |
That doesn't make it correct though ;-) On Friday, February 1, 2013, José Luis Millán wrote:
/Saúl |
I don' t find one option more correct than the other, just different. Both are different (and not so much at the end) ways to fire events. The difference here is mostly cosmetic. Some could prefer one way over the other but I find this reason not heavy enough to make the change. It would also imply an inconsistency between all other elements which state change and which named event implementation is OK from my point of view. |
Fair enough. Even though my approach is a lot easier to extend, that it , On Fri, Feb 1, 2013 at 9:07 AM, José Luis Millán
/Saúl |
@saghul, with your approach the public API "would not change" but the user code would be broken or would not work as expected (since it did not include the new status "shitting" in the "if / else" stament). Current approach is really good. Future possible changes will require changes, indeed, what's wrong? This is still 0.3.X version... |
You didn't get my point. My point is that it's a much easier way to extend the API without breaking it. Reacting to any event has always been optional, so if yon't react to the new 'foobar' event, nothing happens. Now, if you would ever change the name of an event, that would be like changing the API. |
So let's change the API and document it when needed. Or is the new fashion never to change the API? |
Is not a new fashion, it's just a mechanism which makes it easier to manage On Fri, Feb 1, 2013 at 10:57 AM, Iñaki Baz Castillo <
/Saúl |
Here I am. Back from the mud. Apart of the event firing mechanism being discussed over the last comments in this issue, I don't feel like increasing the number of events/states makes it useful for the user. Though I made the first proposal. As a API user, I wan't to know whether the UA is registered (Boolean). I want to get the response (if any) and cause for successful/unsuccessfull un/registration. But it is not easy for the user nor beautiful having 6 events/states for registration handling. I find this proposal fine:
The error with the actual implementation is that 'unregistered' is fired just before sending the un-REGISTER request. It must be fired:
In any of those three cases, the UA becames 'unregistered' and an event with such name is fired with the SIP response if any, and the cause, given by the SIP response, transaction tiemout or transport errror. Note. Even if receiving a negative SIP response to un-REGISTER request, the UA is set as 'unregistered' and the 'unregistered' event is fired. Any thoughts? |
It's just perfect. |
The naming is not consistent. registrationFailure should be registrationFailed, since the other events are actions, not nouns. |
Hi, it was a typo en the issue comment. |
Great work! On Sat, Feb 2, 2013 at 11:23 AM, José Luis Millán
/Saúl |
(Reported by Fabian Santana in jssip maillist, and related to #25)
JsSIP emits "unregistered" event if it has no confirmation from the registrar (no 200 OK). Maybe jsSIP may fire other event, or perhaps provide some argument in the "unregistered" event telling the user whether the SIP un-registration succeded (200 OK) or not.
This maybe a change in the API so for 0.3.
The text was updated successfully, but these errors were encountered: