I have discussed with Emil the idea that we need a jitsi-videobridge service in order to be able to use a jitsi-videobridge in SIP calls (for example).
Currently the following parts of the code are videobridge-aware:
OperationSetVideobridgeJabberImpl: Has createConfCall() and inviteCalleeToCall() methods (pretty much just wrappers around the OperationSetTelephonyConference methods by the same name). Also serves as an entry point for COLIBRI packets.
Classes in protocol.jabber.extensions.colibri: Represent the COLIBRI IQs
CallJabberImpl: Implements most of the videobridge logic -- handle incoming COLIBRI packets, allocate and expire channels as needed.
CallPeerJabberImpl and CallPeerMediaHandlerJabberImpl: handle changes to media indicated in COLIBRI Conference IQs
CallConference: Has a flag that indicates that a jitsi-videobridge is in use.
The GUI (somewhere): Discovers videobridge XMPP entities, initiates calls/adds peers using OperationSetVideobridge.
Probably some others, which I'm missing.
I don't see an obvious or simple way to do the abstraction, but here is an outline of the solution I came up with:
Add a VideobridgeService class (in service.protocol somewhere). It is responsible for discovering videobridge entities (by going over all the available XMPP ProtocolProviders). It has something like this:
Videobridge getVideobridge(String jid)
A Videobridge instance is associated with a specific jid and provides methods to manage a conference on it (allocating channels, etc)
The GUI uses the list of Videobridge obtained from the VideobridgeProvider to display a list of bridges for the user to use. It uses a Videobridge instance to initiate a call or add participants (instead of using OperationSetVideoBridge)
The code in CallJabberImpl that deals with videobridge stuff is moved to Videobridge. In CallJabberImpl are left only wrappers to Videobridge calls. Eventually those wrappers will be moved to MediaAwareCall to allow use in SIP.
OperationSetVideoBridgeJabberImpl only serves as an entry point for COLIBRI IQs and routes them to the appropriate Videobridge instance.
RawUdpTransportManager -- I don't know yet.
I haven't started to actually implement the change (hence the lack of details), but I'd appreciate any feedback. Does the above even make sense? Is there something that conceptually won't work? Something I've forgotten about? Something that's just bad practice or could be done better?