Skip to content

Inviter.invite() fails when 2 headsets are connect to a computer #1120

@DemyGlassix

Description

@DemyGlassix

Voice calls work great with and without a headset but if we have 2 devices connected invite call throws an error:

Failed to make call: NotReadableError: Could not start audio source

The code that calls it:

try {
    // Construct full SIP URI if only number is provided
    const fullUri = targetUri.includes('@') ? targetUri : getSIPUri(sipConfig, targetUri);
    const inviter = new window.SIP.Inviter(userAgentRef.current, window.SIP.UserAgent.makeURI(fullUri), { extraHeaders });
    setCurrentCall(inviter);
    setCallStatus(CallStatus.Calling);
    addNotification('call', `Calling ${targetUri}`);

    // Set up session state change handler
    inviter.stateChange.addListener((newState) => {
        switch (newState) {
            case window.SIP.SessionState.Establishing:
                setCallStatus(CallStatus.Connecting);
                break;
            case window.SIP.SessionState.Established:
                setCallStatus(CallStatus.Connected);
                setupAudio(inviter);
                addNotification('call', 'Call connected');
                break;
            case window.SIP.SessionState.Terminated:
                setCallStatus(CallStatus.Ended);
                setCurrentCall(null);
                cleanupAudio();
                addNotification('call', 'Call ended');
                setTimeout(() => setCallStatus(CallStatus.Idle), 2000);
                break;
        }
    });

    await inviter.invite();
} catch (error) {
    console.error('Failed to make call:', error);
    setCallStatus(CallStatus.Idle);
    setCurrentCall(null);
    addNotification('error', `Failed to make call: ${error.message}`);
}

The error happens on the await inviter.invite(); line.

To Reproduce
Steps to reproduce the behavior:

  1. Connect two headsets to the same computer
  2. Make a call that normally works (makeCall)
Image Image

Expected behavior
The call works as usual

Observed behavior
We receive an error, the call fails
Failed to make call: NotReadableError: Could not start audio source
Image

Environment Information

  • Checked in Chrome Version 142.0.7444.176 (Official Build) (64-bit)

Additional context

  • Google Meet works in the same browser with the same setup, so may be something could be done to fix it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions