When I want to mute microphone I use mediastream which I get from
session.sessionDescriptionHandler.on('userMedia',
onUserMediaObtained.bind(this))
function onUserMediaObtained(stream) {
localMediaStream = stream
}
Session value is from agent.invite() method.
But when I get incoming call, in onInvite event handler:
agent.on('invite', onInvite(dispatch, store))
const onInvite = (dispatch, store) => session => {
if (session.sessionDescriptionHandler) {}
else { //always undefined here}
}
I try again attach event in onaccepted event handler
session.on('accepted', onAccepted(dispatch))
There is sessionDescriptionHandler object initialized, but I think it's too late, onUserMediaObtained isn't fired.
You can use the session object to mute/unmute the microphone. It seems that these two functions have been removed from the Session API page, but I'm pretty sure it still works.
In this the 0.7.0 API page you have it specified https://sipjs.com/api/0.7.0/session/#muteoptions