Skip to content
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

Possible extension: SIP SUBSCRIBE/NOTIFY dialog #708

Open
ikq opened this issue May 12, 2021 · 11 comments
Open

Possible extension: SIP SUBSCRIBE/NOTIFY dialog #708

ikq opened this issue May 12, 2021 · 11 comments

Comments

@ikq
Copy link

ikq commented May 12, 2021

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.

@jmillan
Copy link
Member

jmillan commented May 13, 2021

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.

@ikq
Copy link
Author

ikq commented May 13, 2021

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.

@ikq
Copy link
Author

ikq commented May 13, 2021

<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"]

@jmillan
Copy link
Member

jmillan commented May 20, 2021

@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?

@ikq
Copy link
Author

ikq commented May 20, 2021

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)

@ikq
Copy link
Author

ikq commented May 28, 2021

beta is ready.

Remaining debugging & bug fixes and improvements (if you suggest them)

@jmillan
Copy link
Member

jmillan commented May 28, 2021

Thanks @ikq!

Let us some days to check it. I'll review it after the weekend.

@zviad-gvilava
Copy link

When will it be released? Will JsSIP have subscriber/publish available soon?

@fpaaske
Copy link

fpaaske commented Nov 1, 2023

@jmillan Do you have an update for us? Any chance this will be implemented soon? :)

@jmillan
Copy link
Member

jmillan commented Nov 1, 2023

I need to come back and review it again. I'll try to get some time for this.

@warenbe
Copy link

warenbe commented Feb 22, 2024

Hi
i'm also interested on this
do you have update ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants