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
api for sessions #68
Comments
I don't strongly agree. JsSIP wants to be a lowlevel library. The application on top of it should manage "sessions" instead. Typicall the application using JsSIP retrieves the Session object in the |
Applications can inspect ua.sessions, it contains all the current sessions. I also don't see a need to getting by URI or what not. |
Yes, I found ua.sessions, but it is not fair... :) |
|
I do not see any difference between ua.sessions and application.sessions? Why each developer will maintain own list if it is already implemented in library. |
Let's leave this issue open for studying whether |
I think it should. But should it return a copy or de read only, in case On Wednesday, February 27, 2013, Iñaki Baz Castillo wrote:
/Saúl |
It's not possible to provide a "read only" or a "copy" of If |
A copy of the array, not the sessions themselves. But you are right, we can't prevent the user from shutting himself in the foot if he wants to. |
@jmillan should @ua.sessions@ be part of the public API? If so we should document it in the API. However I'm not sure... |
Since the high layer app is already noticed about every new Session via the corresponding event, it can store them following the most suitable pattern in each case when convenient, for later access. That is meant to be part of each app logic. I don't feel like JsSIP should give a high layer API for retrieving Sessions. |
What about that use case when a user reloads a window while there are active calls? Why should we force the user to keep track of sessions if we are already doing it? |
IMHO the only question here is: make @ua.sessions@ API public or not. I don't think that should be painful. Agree? |
Making |
@saghul, a window reload will tear down any UA instance as well. |
Yep, I strongly discourage the API for retrieving sessions requested by @vf1, I just mean the @ua.session@ method. |
Yes, but that has nothing to see with JsSIP, has it? It is managed via the If you feel that making Some use cases sustaining the approach are welcome though. |
On 3/19/13 6:28 PM, José Luis Millán wrote:
I want to send an in-dialog SIP MESSAGE to everyone I'm talking to Saúl Ibarra Corretgé |
IMHO JsSIP is a core library so it's responsability of the app on top of JsSIP storing and managing sessions (which are given via the |
None prevents you from storing the Sessions as you get them via |
IMHO we can close this issue. |
I know it can be done like that, but why do you insist in having the user duplicate the work already done by the library?
No, if it's public it has to be documented as such, otherwise someone may rely on it and will be pissed off if we change it. I doesn't require any effort on our end to say it's public and we (potentially) add some value. I fail to see why you are against it and want to force the user to do the same thing which the library already does. FWIW, we have the same thing in python-sipsimple and it's part of the public API. |
Is it a Pandora'x box? If we let I strongly think that using The developer should save the session obtained in |
I still haven't seen a single reason explaining why it's such a "bad" idea. Users can make calls, why not give them the damm list of calls?! Seriously. Anyway, do whatever you want, I'm tired of this bikeshed discussion. |
The developer can call to
JsSIP is not the app but the library. |
Let's close this issue. After implementing several apps on top of JsSIP I strongly consider that retrieving the list of active sessions from JsSIP itself means a bad programming practice. Really, things must not be done in that way. If the user wants to terminate all the active sessions at a given time (i.e. when the browser tab is to be closed and the |
I still disagree. |
Why? I would repeat my comment:
Really, it somebody needs to get the active sessions from JsSIP itself then it is doing things wrongly. |
The fact that you didn't need it doesn't mean it's not useful. |
Tell me one usecase. |
But you said that:
So, why do you ask me if you don't want to add it anyway? Anyhow, I would make that sessions array "private" (_sessions name) and add an API function like getActiveSessions, which returns a copy of it, thus preventing the user from breaking things. |
We don't use "_xxxxx" Pythonist stuff for naming private methods or attributes, but I am OK with having something like |
It's used in Python yes, but also in Node, that's why I suggested it, I don't know what the convention is. You never explained why it's a "bad programming practice". It's not. I gave you good enough reasons 9 months ago, so do whatever you want I won't lose more time with this bikeshed discussion. |
Let's be clear. Do you know why some people have requested this feature? To terminate active calls when the browser tab is closed. Good news: we have |
I am using list of session for sending special message to all participants on some events in https://github.com/vf1/muvconf. It peer-to-peer multi-user chat, and conference is maintained by clients w/o server. |
IHMO you should keep the list of participants rather than the list of "JsSIP RTPSession's" and, anyhow, if you use JsSIP.UA.sessions then you are limited to a single multiconference per JsSIP::UA instance. As said above, IMHO that is not a good design. It can work, but it is not a good design, and, as developer I cannot suggest such a way to refer to all the active sessions. |
I disagree with your opinion about design. It is real example, and it is not relayted to |
JsSIP provides (along with many others) these events:
May I understand what else is needed for the user to keep the list of existing sessions? |
Nothing. jsSIP already keeps it. Stop saying it's not ok to use it. Period. |
It's not ok to use it. Reasons:
So, accepting this feature request (make @saghul hope you find above some reasons not to insist on this topic (at least as it is requested now). |
This is just circular reasoning. "We don't accept it because it's private and it's private because we don't accept it.". Seriously.
The user can check the state.
Then expose the state as well.
And what is the problem? Instead of exposing constants just provide a human readable status like 'connecting' 'connected', 'ending', 'ended' etc.
They are insufficient. If you don't want to add this, they say the real reason: you don't want to. Don't try to continue arguing about it when you've already been proven wrong. |
I don't want to enforce bad programming practices. Still I haven't seen a real usecase in which iterating the ua.sessions list is the best choice. |
The fact that it's a bad programming practice it's your opinion. And you are wrong. I gave you an example ages ago and @vf1 gave you a very valid use case. Just stop it already. |
It would be nice to have api for sessions: enumerate, get by uri etc. Because application should have sessions list almost always, probably there is no reason to duplicate this functionality.
The text was updated successfully, but these errors were encountered: