SIP.js with no Microphone

1,419 views
Skip to first unread message

joda...@gmail.com

unread,
Sep 3, 2014, 4:22:14 PM9/3/14
to sip...@googlegroups.com
Hello!

I have been successful in using SIP.js to make calls and can already see so many cases where WebRTC will be useful for my work.

One case would be as a monitor only client on our mission intercom system. However, I would like for users to be able to monitor channels without a microphone or webcam. WebRTC seems to require that a mic or webcam is plugged in to work.

Is there something I'm missing, or any way around this?

Thanks,
JD

Joseph Frazier

unread,
Sep 3, 2014, 5:00:27 PM9/3/14
to sip...@googlegroups.com, joda...@gmail.com
Hi Jonathan,

Thanks for using SIP.js, we're glad to hear it's working well for you!

It's actually fairly straightforward to make calls without needing local devices. The trick is use AudioContext.createMediaStreamDestination() to get a MediaStream that doesn't have media from any devices, then pass the stream to UA#invite as options.media.stream. Here's an example that works with audio-only calls: http://jsfiddle.net/dawpysus/

If you'd like to receive video as well, it gets a tad more complicated. You just need to provide an extra RTCConstraints option to UA#invite, as shown here: http://jsfiddle.net/e41h2pjc/ (note that the address called in that example does not send video, but it should work with addresses that do).

Let us know how it goes,
Joseph

joda...@gmail.com

unread,
Sep 4, 2014, 10:38:29 AM9/4/14
to sip...@googlegroups.com, joda...@gmail.com
Works like a charm, thanks Joseph!

One more question. Is there a way to detect a microphone so that if the user doesn't have a mic plugged in it won't ask for it but if they do than it will?

Joseph Frazier

unread,
Sep 4, 2014, 11:18:57 AM9/4/14
to sip...@googlegroups.com, joda...@gmail.com
Sure, if you're on Chrome, you can use MediaStreamTrack.getSources to enumerate the devices available to the browser. Here's an example that lets the user select which device is requested by getUserMediahttps://simpl.info/getusermedia/sources/

Cheers,
Joseph

Joseph Frazier

unread,
Sep 4, 2014, 11:46:05 AM9/4/14
to sip...@googlegroups.com, joda...@gmail.com
Alternatively, if you'd like to use Firefox, you could call getUserMedia right off the bat. If there's no microphone available, the user shouldn't see a prompt, and the failure callback will be executed, within which you can make the call with a silent stream: demo

Good luck in space!
Joseph

psevdo...@gmail.com

unread,
Apr 3, 2020, 4:03:51 AM4/3/20
to SIP.js
How to repeat this in 0.15.x version now?

David Plappert

unread,
Jul 8, 2021, 11:01:06 PM7/8/21
to SIP.js
Also interested how to do this in 0.20. 

Adrian Hand

unread,
Feb 5, 2022, 1:57:30 PM2/5/22
to SIP.js
David, did you ever come up with a way to do this? My use case is identical to yours and it would be great to avoid the needless request for microphone access. 

Andreas Backman

unread,
Apr 19, 2023, 5:57:21 AM4/19/23
to SIP.js
We are facing the same issue. Is this possible in later versions?
Reply all
Reply to author
Forward
0 new messages