Skip to content

Broken Reinvite/Unhold on Chrome 76 #728

Closed

Description

@solispauwels

Describe the bug
The SDP in latest chrome have changed from Plan B to Unified plan.
“Unified Plan” Transition Guide (JavaScript)

This causes to have many audios when switch from a device to another when do a reinvite or a unhold as described in issue #664.

Yes we can use the sender.replaceTrack API for that purpose (what I use now as a workaround) but this does not change the fact that the reinvite is now broken if the constraints options have changed when do reinvite or unhold And even if replaceTrack work, I have to acquire the user media by myself, If I use sessionDecriptionHandler.acquire it broke the sender because it try to remove the previous track and then there is no chance to replace it, adding the track without reinvite it simply does not work. Also after acquire the user media I have to manually trigger the trackAdded and userMedia event. If I don't do that sipjs don't understand that the user media has changed and don't stop it correctly when terminate.

Here is my workaround code:

session.sessionDescriptionHandler.WebRTC.getUserMedia(constraints).then(streams => {
  streams.getTracks().forEach(track => {
    session.sessionDescriptionHandler.peerConnection.getSenders().forEach(sender => {
      sender.track && sender.track.kind === track.kind && sender.replaceTrack(track)
    })
    session.sessionDescriptionHandler.observer.trackAdded()
    session.sessionDescriptionHandler.emit('userMedia', streams)
   })
})

Logs

v=0
o=- 1025239875102185327 3 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0 1
a=msid-semantic: WMS 7D2NrImu3kLms1dLkhRwl10RsyVV1xF0TCdL
m=audio 62611 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126
c=IN IP4 172.16.39.93
a=rtcp:9 IN IP4 0.0.0.0
a=candidate:299851297 1 udp 2122260223 172.16.39.93 62611 typ host generation 0 network-id 1
a=ice-ufrag:Lb7r
a=ice-pwd:JvCyppp+emtwF01gDfLX9NJx
a=ice-options:trickle
a=fingerprint:sha-256 65:3C:9E:35:63:86:41:47:32:14:CA:B8:8B:86:FD:B6:87:D2:7F:DD:37:97:91:1E:39:39:57:73:9D:FE:35:22
a=setup:actpass
a=mid:0
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
a=recvonly
a=msid:7D2NrImu3kLms1dLkhRwl10RsyVV1xF0TCdL 86a884a8-915b-43e6-b9b2-eef848ec9d70
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:106 CN/32000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:112 telephone-event/32000
a=rtpmap:113 telephone-event/16000
a=rtpmap:126 telephone-event/8000
a=ssrc:4009328187 cname:tEKkzyFtv2z9vxcA
a=ssrc:4009328187 msid:7D2NrImu3kLms1dLkhRwl10RsyVV1xF0TCdL 86a884a8-915b-43e6-b9b2-eef848ec9d70
a=ssrc:4009328187 mslabel:7D2NrImu3kLms1dLkhRwl10RsyVV1xF0TCdL
a=ssrc:4009328187 label:86a884a8-915b-43e6-b9b2-eef848ec9d70
m=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:Lb7r
a=ice-pwd:JvCyppp+emtwF01gDfLX9NJx
a=ice-options:trickle
a=fingerprint:sha-256 65:3C:9E:35:63:86:41:47:32:14:CA:B8:8B:86:FD:B6:87:D2:7F:DD:37:97:91:1E:39:39:57:73:9D:FE:35:22
a=setup:actpass
a=mid:1
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
a=sendrecv
a=msid:jnxyznbOkzjOBETtQ9w1sqxQgfXR5KgmVU7s f7254bfb-a34e-465a-9b15-ad431c5c679d
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:106 CN/32000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:112 telephone-event/32000
a=rtpmap:113 telephone-event/16000
a=rtpmap:126 telephone-event/8000
a=ssrc:3155171097 cname:tEKkzyFtv2z9vxcA
a=ssrc:3155171097 msid:jnxyznbOkzjOBETtQ9w1sqxQgfXR5KgmVU7s f7254bfb-a34e-465a-9b15-ad431c5c679d
a=ssrc:3155171097 mslabel:jnxyznbOkzjOBETtQ9w1sqxQgfXR5KgmVU7s
a=ssrc:3155171097 label:f7254bfb-a34e-465a-9b15-ad431c5c679d

To Reproduce (if possible)
Steps to reproduce the behavior:

  1. Invite with a constraint.
  2. Change constraint.
  3. Do a reinvite or an unhold.
  4. There is no more outgoing audio.

Expected behavior
When do a reinvite or and unhold with another constraint, sipjs automatically acquire the new media and trigger the track added event.

Observed behavior
The outgoing audio is lost.

Environment Information

  • Asterisk 13
  • Chrome 76

Additional context
Also, in latest Chrome unified plan, there is no candidates on new audios when do a reinvite. I have tried to create a modifier to correct this but I had not good results for now. This is may related to this #711

Activity

  1. james-criscuolo commented on Sep 18, 2019

    @james-criscuolo
    Collaborator

    Hi @solispauwels,
    Have you tried this with our beta API? Reinvite handling has been entirely reworked, so a handful of cases that did not work in the legacy API will now work. That said, if this issue is solely with SDP handling, and the SIP signaling is OK, I'd anticipate our default session description handler will still not work.

    Would you mind trying this with the beta API, and post full logs in a gist? This is mainly so we can confirm the signaling is as expected. The last thing I'll mention, we've made the session description handler in such a way that you can override it, and it could be as easy as copy/pasting our file, then altering the pieces you deem necessary (such as the snippet you posted above) and passing your custom SDH in your UserAgent constructor. At that point, if you get it working, we would certainly welcome a Pull Request. Whether you go that route or not, we would like to get this case working, and expect to as work on the new API continues, we just haven't gotten to the session description handler yet.

  2. mbarinov commented on Sep 19, 2019

    @mbarinov

    I've faced the very same issue. Tab crash after unhold action.
    @james-criscuolo Due to some lack of documentation for 0.15.x, could you please provide a piece of additional information about "unhold" issue?

  3. james-criscuolo commented on Sep 19, 2019

    @james-criscuolo
    Collaborator

    There is no issue that we are aware of, but if you have an issue, please provide full logs in a gist. The case in question in this ticket involves a case we aren't directly supporting at this point (changing audio/video sources mid-call), but if you have a plain unhold that isn't working we'd be interested to see logs and fix.

  4. james-criscuolo commented on Sep 19, 2019

    @james-criscuolo
    Collaborator

    Can you give full logs instead of a snippet please?

  5. egreenmachine commented on Sep 19, 2019

    @egreenmachine
    Collaborator

    Where is the crash happening in that log?

  6. mbarinov commented on Sep 19, 2019

    @mbarinov

    Right after last console.log. That was a tab crash.

  7. james-criscuolo commented on Sep 19, 2019

    @james-criscuolo
    Collaborator

    This code is still using the old API. I still think this crash would occur on the new API, as it seems to be something with chrome moreso than our code (though we could be causing it), but switching to the new API may give more visibility if an error is actually occurring within our code. The new API also deals with some edge cases with reINVITEs better, which may be what you're running into.

    In terms of documentation, the code you are running still follows the old documentation. I did not realize there was an issue with the 0.15.0 old API documentation on sipjs.com, and thought most of these mentions were in regards to the new API's documentation. I've fixed sipjs.com, but it should be noted that the documentation for the old API is virtually the same as 0.14.x, as that API is now frozen.

  8. offsetcyan commented on Apr 20, 2020

    @offsetcyan

    This is still present in the new API as of 0.15.10. The workaround above isn't applicable because the observer is private and so you can't call trackAdded(), though you can getUserMedia from the navigator manually.

  9. john-e-riordan commented on May 27, 2020

    @john-e-riordan
    Collaborator

    Hi,

    #815 is a new implementation which I believe/hope addresses this issue.

    Tracks adding, removal, and replacement is now done in a fashion which supports Unified Plan

  10. james-criscuolo commented on Jul 6, 2020

    @james-criscuolo
    Collaborator

    As there was no response and we believe this is fixed, we are going to close the issue. Please test with 0.17.0 and re-open if there is still an issue there.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions