My company is going to try replacing nearly all of our phones with softphones. We've chosen Jitsi for this. The only feature we're still wanting is a speakerphone button. The idea being that by pushing this button, a call could be initially answered via headset but later transferred to a mic/speaker setup and possibly back to the headset again. The behavior would mimic most business handsets.
I've started attempting to implement this. I've got the actual speakerphone button added to the GUI, I've added two additional combo boxes to the audio device setup (Speakerphone Audio In and Speakerphone Audio Out). I'm also successful in setting these options and saving them to the configuration file. The trouble I'm having is actually getting the devices to switch when the button is selected.
I'm having a hard time getting my head around the architecture in the media layers. Initially I had thought that the proper place to switch both the input and output device would be in MediaAwareCall but I found that the MediaAwarePeers only contain data regarding input devices. I did go ahead and try setting the capture device like this:
for(MediaAwareCallPeer<?,?,?> peer : getCallPeersVector())
MediaStream audio = peer.getMediaHandler().getStream(MediaType.AUDIO);
//TODO: SPEAKERPHONE FIX THIS!
//TODO: SPEAKERPHONE set it back to the regular audio device
However, all call audio goes silent when the speakerphone button is toggled. I also noticed the the level indicator for the output device hangs until the the speakerphone button is toggled off, at which point it appears to resume normal operation; however, there's still no sound.
I also have noticed that portaudio gets registered as a custom renderer for JMF in the DeviceConfiguration code. Is this the only place that the output configuration is ever manipulated? Is it necessary to create a new portaudio instance to change the output device?
Anyway, I'm at a loss as to how to proceed and I'm afraid I'm going to walk all over the architecture if I hack any further without guidance (I may have already...). So, is there anyone out there that could help me understand what's going on with the media devices and where would be the proper place to implement this kind of functionality?