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

Attempting to mute a unanswered call makes it unmuteable after answer #685

Open
KraftyKraft opened this issue Jan 28, 2021 · 2 comments
Open

Comments

@KraftyKraft
Copy link
Contributor

We're running JsSIP v3.6.1.

When session.mute() is called on an unanswered incoming call, the following error is thrown.

TypeError: Cannot read property 'getSenders' of null
    at RTCSession._toggleMuteAudio (RTCSession.js:3029)
    at RTCSession.mute (RTCSession.js:984)

I suppose that since the call is not answered yet, its RTCPeerConnection is null. However, the variable RTCSession#_audioMuted is set to true regardless.

After answering the call, we can attempt to mute it again by calling session.mute(). Since _audioMuted is still true, nothing happens, and no tracks are disabled. The call is unmuteable at this point.

There are pretty easy, somewhat hacky, ways to get around this - calling RTCSession.unmute first, checking for a connection, etc - but it seems somewhat buggy, so we thought an issue is appropriate :)

@jmillan
Copy link
Member

jmillan commented Jan 29, 2021

In order to allow muting before connection is created we could add a check in _toggleMuteAudio and _toggleMuteVideo.

 _toggleMuteAudio(mute)
  {
    // RTCPeerConnection is not created yet, skipping.
    if (!this._connection) {
      return;
    }

    const senders = this._connection.getSenders().filter((sender) =>
    {

But then everywhere we do this._connection.addTrack(track, stream); in RTCSession we must check if we are muted (audio|video) and call the _toogleMuteXXXX() accordingly.

@ibc
Copy link
Member

ibc commented Jan 29, 2021

I think we should just document that, for receiving invites, (un)mute(), (un)hold() methods will throw if the call is not answered. And obviously we should really throw and not change flags state (_audioMuted, _videoMuted) if so.

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

3 participants