versatica / JsSIP

JsSIP, the JavaScript SIP library
https://jssip.net
Other
2.42k stars 744 forks source link

Decouple signaling and WebRTC stuff #427

Open ibc opened 7 years ago

ibc commented 7 years ago

A perfect rationale is given in the Janus NoSIP plugin discussion.

This is: make JsSIP WebRTC agnostic and let the app provide JsSIP with externally produced SDP blobs.

michelepra commented 7 years ago

what you think about my solution?

jmordica commented 6 years ago

Is this to support interop with legacy sip servers?

If not, can someone point me to an open issue that contains such?

Thanks!

ibc commented 6 years ago

Define "interop with legacy SIP server". A browser cannot have a "call" with plain RTP audio.

jmordica commented 6 years ago

I’m referring to how Janus gateway (when using sip plugin) works with legacy sip servers. So from browser to Janus gateway it uses normal webrtc (ICE/DTLS), and from Janus gateway to sip server just regular SDP.

ibc commented 6 years ago

JsSIP is just a client side SIP UA library. Said that, once we get this feature done, how the application sends and receives SDP is up to it.

jmordica commented 6 years ago

Ah right on. I think this belongs in oversip. I'll delete my comments :)

mgoodenUK commented 3 years ago

This feature looks really interesting - Is it still on your roadmap?

ibc commented 3 years ago

Yes, but no ETA for now.

mgoodenUK commented 3 years ago

We'd like to implement this ourselves with the goal of ultimately raising a PR - Do you have any pointers on the best place to start? Obviously we'd prefer to implement in a way that you guys would find acceptable.

ibc commented 3 years ago

I'm afraid we have not yet thought on how to do this so cannot provide any pointers. Coming to my mind (but must re-check in the future):

jmillan commented 3 years ago

Agreed with @ibc, we haven't thought of it yet.

IMHO a good starting point would be, following what @ibc commented:

Haardt commented 3 years ago

This is a really great feature. Can I use jsSIP with Mediasoup to send an RTP stream to a SIP server (for example to mixing audio)?

jmillan commented 3 years ago

No you can't. Maybe this effort would be a starting point that would let you to it, but you would have to do a module that communicates with mediasoup, deals with SDP etc. In short no, this will not allow you do that.

Haardt commented 3 years ago

Yes, not out of the box - Maybe the wrong place, but we have developed a SFU based on Mediasoup and wanted to use jsSIP to send the RTP streams to another SIP server. We wanted to use the SDP data from Medasoup and then pass it to jsSIP. We need to support "phone ports" :).

ibc commented 3 years ago

mediasoup does not generate SDPs. However there is an ongoing mediasoup-sdp-bridge project. Let's please not use this issue to discuss this.

Haardt commented 3 years ago

I have been working on this ticket. I removed the "RTCPeerConnection" and the "...getUserMedia" from the RTCSession file. My current API for Browser/Node-MediaConnectionInterface:

I can use the 'tryit-jssip' application with the modifications. However, the 'RTCPeerConnection' is also used outside (as 'peerconnection') - maybe 'beaking changes'.

@jmillan I can't find the events? How to handle 'newtrack, close' in the RTCSession?

jmillan commented 3 years ago

How to handle 'newtrack, close' in the RTCSession?

In the MediaConnection light spec done here it is said that such events are triggered by the MediaConnection instance.

RTCSession.connection will now be a MediaConnection instance instead of a RTCPeerConnection one.

Could you please detail the question having that in mind?

Haardt commented 3 years ago

Exactly, I have replaced the 'connection'. Now the 'Interface / MediaConnection' is used everywhere. I have created a feature branch: https://github.com/Haardt/JsSIP/tree/feature/427-Decouple_signaling_and_WebRTC_stuff Maybe you can look into it - i'm on the right way?

jmillan commented 3 years ago

Sure! Let us few days and we'll take a look.

jmillan commented 3 years ago

I've made some comments @Haardt, it's starting to look nice! I've more comments to do but I prefer that you handle these comments and then we'll go for a second round.

jmillan commented 3 years ago

few points:

jmillan commented 3 years ago
Haardt commented 3 years ago

@jmillan i made some progress:

jmillan commented 3 years ago

Hi Haardt,

It's very difficult to comment on a branch if there is no PR. Could you make a PR from your new branch to a JsSIP master branch in your origin?

This way it'll be much more agile making comments and handling feedback.

Haardt commented 3 years ago

@jmillan i have create a draft pull request from my branch to my master.

Haardt commented 3 years ago

ping - some progress in the branch.

jmillan commented 3 years ago

We will comment on it.

jmillan commented 3 years ago

Another review done.

Haardt commented 3 years ago

I have implemented your comments. What do we do with 'getSender'? This is needed for mute.

I have also implemented two test projects:

I think I can publish both projects at the end of next week.

jmillan commented 3 years ago

What do we do with 'getSender'? This is needed for mute?

I commented here:

https://github.com/Haardt/JsSIP/pull/1/files#r586408690

I think I can publish both projects at the end of next week.

We need to review it further. Please make sure you have implemented all the comments I made.

jmillan commented 3 years ago

Thanks @Haardt,

We'll have another review as soon as possible.

jmillan commented 3 years ago

Another review done.

Please:

It's looking good @Haardt :+1:

Haardt commented 3 years ago

Hi, next round :)? I have been working on you comments, but why keep the MediaStream in answer/call? The only thing that happens with the 'stream' is that it is added to the connection.

     stream.getTracks().forEach((track) =>
      {
        this._connection.addTrack(track, stream);
      });
jmillan commented 3 years ago

next round :)? I have been working on you comments, but why keep the MediaStream in answer/call? The only thing that happens with the 'stream' is that it is added to the connection.

Sounds legit. Let us comment on next review.

jmillan commented 3 years ago

New review done.

jmillan commented 3 years ago

Hi @Haardt,

Is there anything you may need from our side?

Haardt commented 3 years ago

@jmillan Hi, An OKR needs my attention at the end of Q1 :). Next week I take my time!

nilsbandel commented 3 years ago

Hi!

What would this mean for apps currently using JsSIP? Does it mean that JsSIP will no longer handle the WebRTC stuff, or that it still can but it's also possible to decouple if you only want to use the signalling part of JsSIP?

ibc commented 3 years ago

It means that JsSIP will no longer manage any RTCPeerConnection or getUserMedia() and the application should do that and pass and receive SDPs from JsSIP, which will just manage the SIP message exchange, SIP session status, SIP registration and things like that.

nilsbandel commented 3 years ago

I can see the use case described above where you'd want to decouple things, but for all current users of the library, wouldn't that mean quite a large refactor then?

From the PR in https://github.com/Haardt/JsSIP/pull/1/files#r586408690 it seems like there will now be a MediaConnection interface and an implementation of that in RTCPeerMediaConnection that you could use if you want to use WebRTC, is that correct? Is there going to be a transition guide of some sort to guide users in the breaking API changes?

jmillan commented 3 years ago

There will be a default MediaConnection implementation handling basic RTCPeerConnection as it's done now. The user will have to provide an instance of such built-in class if not implementing its own. The very same way we do with the Socket interface in UA.

https://jssip.net/documentation/3.7.x/api/ua_configuration_parameters/

Haardt commented 3 years ago

@jmillan Sorry...more delay. I can work next week on it.

jmillan commented 3 years ago

Sure @Haardt :+1:, let us know if you need some help.

Haardt commented 3 years ago

Some small progress pushed.

Haardt commented 3 years ago

I added an integration test to the 'test-mediaConnect.js' file.

jmillan commented 3 years ago

Thanks,

Seems that the the PR does not exist anymore, which makes it very difficult to review & comment.

Once you feel the branch is ready, after having reviewed my previous comments, can you please create a PR against master branch? You should probably merge master into your branch to make it mergeable.

jmillan commented 3 years ago

I see the PR is in your account, I'm going to comment there.

jmillan commented 3 years ago

@Haardt,

Nice work!. I've commented in the PR. I've created a delimiter (------- 29th April delimiter ------) and made a review after that.

Please, make sure you handle all the comments. Hopefully the next will be the last review.

Congrats for the nice work!

Haardt commented 3 years ago

Hi, another round is done! I guess there will be more - maybe :).

jmillan commented 3 years ago

Hi Andreas,

We will revisit this with time. We are having some internal thoughts that may affect this. Let us please some time to come back to this.

Thanks a lot.