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

SIP plugin: add audio/video stream with an update request(or reinvite) #2164

Merged
merged 3 commits into from
May 25, 2020
Merged

SIP plugin: add audio/video stream with an update request(or reinvite) #2164

merged 3 commits into from
May 25, 2020

Conversation

ihusejnovic
Copy link
Contributor

Hi,
this pull request is about adding option in SIP plugin to add audio/video stream with update request (or SIP reinvite) if it wasn’t initially negotiated.
Of course, for SIP reinvite it will work only if you don’t use autoaccept_reinvites feature.
I have tested it with Kamailio and it works fine. We are using it in production for last 5 days and we didn’t notice any issue.

The main change is allocating local media ports on update request if audio or video stream is added.
Also, if update request is answer(not offer) session->media.updated is set to TRUE because we need to connect new media ports.

Let me know if you have any question, suggestion or anything else. Thanks.

@@ -5785,10 +5804,6 @@ static void janus_sip_connect_sockets(janus_sip_session *session, struct sockadd
if(!session || (!audio_server_addr && !video_server_addr))
return;

if(session->media.updated) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is removed because session->media.updated is always false on this place.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why you think it will always be false there? Anyway, since it only showed an additional log line, no harm in getting rid of it, I guess.

@lminiero
Copy link
Member

Thanks! I won't have time to look into this today, I'll try to do that next week 👍

Copy link
Member

@lminiero lminiero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found some time after lunch to have a quick look, and it seems fine, thanks! I added a couple of small notes, but nothing important: especially considering you tested it for quite some time, I guess this is good to go. Could I ask you to apply the same changes to the NoSIP plugin as well, though, since they share a lot of the same media code?

if(video_added)
session->media.has_video = TRUE; /* FIXME Maybe we need a better way to signal this */

if(audio_added || video_added) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove the three empty lines above, since they belong to the same group of code.

@@ -5785,10 +5804,6 @@ static void janus_sip_connect_sockets(janus_sip_session *session, struct sockadd
if(!session || (!audio_server_addr && !video_server_addr))
return;

if(session->media.updated) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why you think it will always be false there? Anyway, since it only showed an additional log line, no harm in getting rid of it, I guess.

@lminiero
Copy link
Member

One more note: I guess this won't work if the SIP session is using SDES-SRTP, since I think we only set that up at the beginning of the call, and I don't see crypto-related changes here.

@lminiero
Copy link
Member

Merging.

@lminiero lminiero merged commit a77d2eb into meetecho:master May 25, 2020
@lminiero
Copy link
Member

PS: looks like the NoSIP plugin already supports all that, and using the same additional update property in janus_nosip_allocate_local_ports: possibly what you took as inspiration for this patch? Anyway, less work for me 😄

@ihusejnovic
Copy link
Contributor Author

Hello Lorenzo,
Sorry for the late reply, it's a holiday here. Thank you for review and merge.

Yes, I have implemented this based on the NoSIP plugin implementation.

When you asked me about SDES-SRTP I realized that I didn't test it because we are not using it.
I tried it now and it doesn't work when a new stream is added. I will create a new pull request to fix this.

@ihusejnovic ihusejnovic deleted the ihusejnovic-sip-plugin-add-stream-update-request branch May 25, 2020 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants