Possible extension: SIP SUBSCRIBE/NOTIFY dialog
SIP SUBSCRIBE/NOTIFY dialog implemented in user (not JsSIP) code. For this to JsSIP added arbitrary client transaction:
JsSIP modifications: UA.js: added method:
sendRequest(method, target, params, headers, body, handlers, credential)
{
debug('sendRequest()');
const request = new SIPMessage.OutgoingRequest(method, this.normalizeTarget(target), this, params, headers, body);
const requestSender = new RequestSender(this, request, handlers, credential);
requestSender.send();
}
To allow different from REGISTER authentication realm to RequestSender added argument credential. The modification is optional.
Hi,
Which RFC does it implement and to which extent? What is it missing from the spec, if any?
NOTE: In order for this to be considered for a PR it should respect the current JsSIP syntax and format.
Hi José,
It's RFC 6665 SIP-Specific Event Notification
I think I mostly implemented the RFC, but it should be checked....
Missed in current implementation:
- Record/Record-Route - not tested
- support of RFC 7621 (GRUU) - not implemented.
- the SUBSCRIBE responses terminate subscription 404, 405, 410, 416, 480-485, 489, 501, or 604. In the implementation any non OK final response (except 401/407) terminate it.
- SUBSCRIBE/NOTIFY authentication - not tested.
- Server client dialog implementation used for testing client dialog (did not tested separately)
Not everyone needs SUBSCRIBE dialog, so to keep JsSIP small, the class that implements the ClientSubscribeDialog dialog located in the user's code, not in JsSIP.
Other reason not include ClientSubscribeDialog to JsSIP code:
Currently it's beta level code.
It works with my specific server, but when working with another server, you may need some minor modification of the code, which is possible if it is at the disposal of the user.
It's not tested enough to be sure that it's compatible with all subscription servers.
<edited, now subscribe dialog implementation moved from test to JsSIP code>
JsSIP extension that enable using the SUBSCRIBE/NOTIFY : https://github.com/ikq/JsSIP/tree/subscribe_support Contains:
- arbitrary non-invite client transaction (to send SUBSCRIBE and NOTIFY ,see sendRequest method)
- different from REGISTER authentication user/password/realm (optional)
- incoming subscribe event (for notifier)
- Subscriber.js
- Notifier.js
Browser test: https://github.com/ikq/subscribe_notify_test Contains:
- JsSIP with proposed extension.
- test client with basic GUI (send REGISTER, send/receive SUBSCRIBE/NOTIFY)
Note:
To run provided test please use your SIP server and two user accounts.
The server must be configured to forward SUBSCRIBE and NOTIFY from one registered user to other.
In the test SIP server address set in format: ["wss://webrtc.example.com"]
@ikq,
Due to the generic nature of the specification, I think this could become part of JsSIP. At the same level as RTCSession.
There are two clear implementation parts: Subscriber and Notifier, both making use of current JsSIP Dialog implementation, etc. Each of them could be implemented in its own JS file.
If you are willing to do this effort, honor the current code style, variable naming, spacing, new lines, logging, etc. Comment the code as needed.
Also, use EventEmitter the same way is done in the rest of the code.
@ibc, what's your opinion on this one?
I added the Subscriber.js and Notifier.js to JsSIP clone and updated the test Please see the pull request.
Тhe main part of the code is ready, I'm thinking about small improvements:
- add +sip.instance to SUBSCRIBE contact
- require fewer parameters then build SUBSCRIBE if the same user and domain is used as in the register.
By the way: the SUBSCRIBE refreshing interval is different from that you use to REGISTER - to continue work even if timer resolution is 60 seconds. see: Chrome intensive timer throttling: https://www.chromestatus.com/feature/4718288976216064)
beta is ready.
Remaining debugging & bug fixes and improvements (if you suggest them)
Thanks @ikq!
Let us some days to check it. I'll review it after the weekend.
When will it be released? Will JsSIP have subscriber/publish available soon?
@jmillan Do you have an update for us? Any chance this will be implemented soon? :)
I need to come back and review it again. I'll try to get some time for this.
Hi i'm also interested on this do you have update ?