-
Notifications
You must be signed in to change notification settings - Fork 788
Subscribe support #711
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
base: master
Are you sure you want to change the base?
Subscribe support #711
Conversation
|
Hi @ikq, JsSIP code must have the same style in order to make it readable and maintainable. Comments before making a deeper review:
Please take a certain file (ie: RTCSession.js) as a reference and try to stick to its style. |
|
Thanks for the cleanup, 👍 We'll review the PR as we can. |
|
@ikq, Cosmetic comment, we use camelCase in API method arguments (not in 100% of the cases, I know, but we will get there). Could you please make such change? |
jmillan
left a comment
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.
I've made the first review.
Please go through all the comments and modify as needed. We'll go for sencond review afterwards.
|
I mostly fixed the issues. [I thought about dialog: About dialog, seems: dialog interface:
other functionality:
It's already implemented in Subscriber/Notifier. |
|
Hi, Super busy lately. Will come back to this when we have some time. |
|
H @ikq,
|
|
Hmm... I just did not consider this possibility before because I found INVITE/CANCEL/ACK specific code and properties in the Dialog (e.g. subscriber used different dialog states set). |
|
There is INVITE related code in Dialog because a dialog for INVITE method needs to behave in certain way, different to generic dialogs, but that's an implementation detail. Other clases should be able to create dialogs the same way RTCSession does. |
|
Hi Jose, I'll continue to test next week:
|
|
Testing of the current version has been completed successfully. |
|
subscribe authentication checked using special test. |
|
I see I should change debug/debugerror to logger... |
|
Hi @ikq, We are super busy lately. Please keep using your branch and update this PR whenever you find any issue/enhancement. Also, tests would accelerate the adoption. |
|
I already use this code for my work and so far no problem. Two browsers test can be taken from: |
|
@ikq, more than an external test I mean tests in JsSIP as part of this PR, testing the clases created here. |
|
Hi, is there some news? I'd like to test this functionality. |
IMHO it's stable code. The subscriber/notifier test can taken from https://github.com/ikq/subscribe_notify_test |
|
Hi, is there a specific reason why Subscriber and Notifier don't use the Contact header from the UA like RTCSession does? If the user provides a custom contact_uri in the UAConfiguration he would have to manually add it as a extra header to Subscriber and Notifier again, wouldn't he? |
I'd like to use the official repository, so I'd like if it will be merged ASAP |
Yes, I'm not using the Configuration.contact_uri In fact, I was in a hurry to do this work, and did not pay attention at all to that there is such a parameter in the configuration ! Let check, how the configuration used for INVITE: Thanks. P.S. |
|
@ikq if you don't mind external contributions i'd be willing to take a swing at writing unit tests for this project's test framework |
Thank you, I will gladly accept your help. I have provided an external test for 2 browsers: one is sending an SUBSCRIBE and the other is receiving it and sending a NOTIFY. Seems in unit test should be simulated 2 instances of JsSIP one send/other receive. |
@ikq Is there a specific reason to use Configuration.contact_uri? Why not just do it as in RTCSession, with |
|
Thank you markusatm for founding the problem. |
|
Hi, Yes, in order for this PR to be merged we need tests in JsSIP project. You don't need two JsSIP instances, just one instance and you should inject a transport that you control (a FAKE transport) that you use to send JsSIP UA SUBSCRIBE|NOTIFY messages and receive and check what comes from JsSIP. If you need some help please let us know. |
|
Hi,
The test SIP sequence is:
The unit test work silently, but if uncomment line JsSIP.debug.enable('JsSIP:*'); SUBSCRIBE and NOTIFY headers checking: |
|
Up! |
|
Hello. We also want to use this feature. Will this pull request be merged? |
|
This is waiting for the docs to be generated. @ikq are you willing to create a PR for the doc? We cannot merge the feature without it. |
|
Writing documentation is never easy for me but let's try. How do you do this? I have to download the zip (or git clone) from https://github.com/versatica/jssip.net, install nanoc and modify content/documentation/api/ua.html And then check the result using nanoc compile, nanoc view? If the modified doc compiled, make Pull Request of https://github.com/versatica/jssip.net with modified api/ua.html, Do I understand correctly ? |
|
I created pull request for https://github.com/versatica/jssip.net |
|
@jmillan Hello! Could you please check it up? Thank you! |
|
I'll review when I can. If you are in a hurry, please do use this branch freely. |
This way you will also collaborate on using, testing and reporting. |
|
@jmillan We already using it this way :) but it's a bit difficult to maintain separate branch. |
|
I'm not forgetting about this..., |
|
@jmillan Hello! Any chance you had time to review this one? |
|
@jmillan Ping? |
|
For those willing to use this feature I would suggest you use this branch. I don't have at the moment the resources to re-check and merge this, so please, do use this branch for the time being. |
|
Looking forward with this merge also 👍 |
|
@jmillan ping? |
|
Pushed a rebased version in #922. |
lib/Notifier.js
Outdated
| * @param {String} body Notify body | ||
| * @param {Array<string>} extraHeaders | ||
| */ | ||
| _notify(subsStateParameters, body=null, extraHeaders=null) |
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.
private methods must appear after all public ones. Also, this could be called _sendNotify() also to dissambiguate.
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.
Done
lib/Notifier.js
Outdated
| /** | ||
| * Private API | ||
| */ | ||
| _dialogTerminated(termination_code) |
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.
I think terminate() would be a better name for this, as it is what the method does. RTCSession has the same name for such function.
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.
I see terminate() is already taken, then terminateDialog() would work.
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.
Done
|
@ikq thanks for the patience. I'll try 🤞 to finish the review and accept it in the following weeks. Can I ask you to not include any change in |
| registrar_server : null, | ||
| register : true, | ||
| register_expires : 600, | ||
| register_from_tag_trail : '', |
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.
Everything related to register_from_tag_trail does not belong to this PR. It's already in master. Please remove it.
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.
Done
| register_from_tag_trail(register_from_tag_trail) | ||
| { | ||
| if (typeof register_from_tag_trail === 'function') | ||
| { | ||
| return register_from_tag_trail; | ||
| } | ||
|
|
||
| return String(register_from_tag_trail); | ||
| }, | ||
|
|
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.
to be removed.
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.
Done
| let fromTag = Utils.newTag(); | ||
|
|
||
| if (this._ua.configuration.register_from_tag_trail) | ||
| { | ||
| if (typeof this._ua.configuration.register_from_tag_trail === 'function') | ||
| { | ||
| fromTag += this._ua.configuration.register_from_tag_trail(); | ||
| } | ||
| else | ||
| { | ||
| fromTag += this._ua.configuration.register_from_tag_trail; | ||
| } | ||
| } | ||
|
|
||
| const request = new SIPMessage.OutgoingRequest( | ||
| JsSIP_C.REGISTER, this._registrar, this._ua, { | ||
| 'to_uri' : this._to_uri, | ||
| 'call_id' : this._call_id, | ||
| 'cseq' : (this._cseq += 1) | ||
| 'to_uri' : this._to_uri, | ||
| 'call_id' : this._call_id, | ||
| 'cseq' : (this._cseq += 1), | ||
| 'from_tag' : fromTag |
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.
to be removed.
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.
Done
lib/UA.d.ts
Outdated
| ha1?: string; | ||
| register?: boolean; | ||
| register_expires?: number; | ||
| register_from_tag_trail?: string | function() : string; |
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.
to be removed.
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.
Done
|
Also please do not edit |
| if (finished) | ||
| { | ||
| return; | ||
| } | ||
|
|
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.
This change does not belong to this PR. It's already in master. Please remove.
| } | ||
|
|
||
| else if (!finished) | ||
| else |
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.
Change already in master, please remove.
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.
Done
| connection.addEventListener('icegatheringstatechange', iceGatheringStateListener = () => | ||
| { | ||
| if ((connection.iceGatheringState === 'complete') && !finished) | ||
| if (connection.iceGatheringState === 'complete') |
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.
Change already in master, please remove.
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.
Done
lib/Notifier.js
Outdated
| /** | ||
| * Get dialog state. | ||
| */ | ||
| get state() |
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.
Getters are set after constructor. Please check RTCSession.js
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.
Done
b2ef69c to
d390a7c
Compare
Done |
|
Thanks, I'll take some time on a further, and hopefully last review. |
I added Subscriber.js Notifier.js to JsSIP
I tried write them according JsSIP style and lint errors.
Please take a look and let me know what needs to be fixed.
I already see that *.d.ts files are missing.
The work still in progress: I want add to SUBSCRIBE Contact +sip.instance
as you do in REGISTER