Listen-only session not working in Safari or Firefox

35 views
Skip to first unread message

Jeff Whelpley

unread,
Jan 25, 2022, 2:39:32 PMJan 25
to JsSIP
I am using jssip to make a call where the user is only listening to the conference audio from a Freeswitch conference.

```
const audioContext = new AudioContext();

ua.on('newRTCSession', (data: any) => {
    data.session.connection.ontrack = (evt: RTCTrackEvent) => {
audio.srcObject = evt.streams[0];
audio.play();
}
});

ua.call(uri, {
    pcConfig: { iceServers: [] },
    mediaConstraints: { audio: false, video: false },
    rtcOfferConstraints: { offerToReceiveAudio: true, offerToReceiveVideo: false },
    mediaStream: audioContext.createMediaStreamDestination().stream
});
```

This code works in Chrome where the user hears the audio from the Freeswitch conference but their microphone is not active and (importantly) they have not been prompted to give microphone access (which is what I am trying to avoid).

In Safari, there is no error, but the input stream is empty. In Firefox, the `ontrack` event is never fired.

Looking at the jssip debug track, it looks like the key difference is that in the SIP invite, Chrome is still including private IPs for ICE candidates while FireFox and Safari use mDNS addresses like `a1472baa-c542-4cd2-875a-904b16831522.local`.

If I call `getUserMedia({ audio: true })` then it all works fine in all browsers as you would expect, but I am trying to avoid prompting the user to give microphone permissions.

Is there any way around this or am I running into an intentional security feature for Firefox and Safari?


Reply all
Reply to author
Forward
0 new messages