Appendix
Microsoft® Real Time
Communication (RTC) Client
Introduction
The RTC client is an object oriented COM (Component Object Model) interface for
real time peer-to-peer communication over the SIP protocol.
It can be used to establish a session between two users and send streaming
information such as Audio and Video in real time between them.
It can also maintain a "buddy list" and keep track of their current state.
There exists a new service called the Live Communication Server (LCS), which is
actually the RTC Server.
Challenges
The RTC Server goes into much more detail regarding the SIP protocol but is not
available for the Java environment yet. That is why we chose to write the server
using a package called JAIN-SIP, which isn't very compatible with RTC but is
flexible enough to allow communication with the client.
This was indeed a tough integration, since the RTC client uses a certain kind of
version of the SIP protocol, known as SIMPLE (SIP for Instant Messaging and
Presence Leveraging Extensions). This protocol is an extension of SIP and has not
been declared official yet. For that reason it's somewhat undocumented and
Microsoft didn't follow its specifications in certain issues. Those issues where very
tough to solve, since there was no information we could find about them.
Eventually, we managed to figure out what the RTC client expected to receive from
our server, through a lot of trial-and-error tests.
RTC Design: Classes and Interfaces layout in RTC
The main class is created by a CoCreateInstance() call set to CLSID_RTCClient as
a class identifier (the RTCClientClass object).
We also pass the IID_IRTCClient constant as the interface we want to use from the
client. This is done so we get the IRTCClient interface immediately, in order to call
it’s method Initialize(). This method must be called before any other operation is to
be performed on RTC.
In order to get a profile starting (to “login”), we use the QueryInterface() function to
get the IRTCClientProvisioning interface, which is implemented (exposed) by the
RTCClientClass object. This interface is then used to create a Profile object (using
the GetProfile() method it defines), which implements the IRTCProfile interface.
The information about this profile is now shared among the rest of the RTC
elements.
An IRTCProfileEvent event is fired upon creation of the new profile. Now all we
have to do is call the IRTCClientProvisioning’s method – EnableProfile().
There are different ways to start a profile, but this is the simplest, basic course of
action.
The creation of the rest of the objects in RTC is quite similar to the Profile object
described above.
The chart below describes the basic interfaces, and which interface contains a
method to get to the next.
IRTCClient IRTCSession IRTCParticipant
IRTCWatcher
IRTCClientPresence
RTCClientClass
(COM Server) IRTCBuddy
IRTCClientProvisioning IRTCProfile
QueryInterface() Instantiates:
Implements:
Figure 1: The design of Microsoft’s RTC Client (simplified).
Note
The RTCClientClass COM object is not thread safe. For that reason we need to use
the STA (single apartment threaded model) which leaves the thread synchronization
for Windows to handle via the Windows messaging system.
In C# this is declared by the use of the [STAThread] attribute at the beginning of the
program.
XML Documents used in RTC Messages
The body of the RTC messages has XML structure. This structure depends on the
message being sent.
Examples:
ADD_CONTACT
IM
Hi there!
XML Headers and their Meanings
SIP Request XML Header Message Meaning
REGISTER LOGIN User logging in event.
REGISTER LOGOUT User logging out event.
SUBSCRIBE LOGIN User is subscribing for a
notification regarding his contacts.
MESSAGE ADD_CONTACT Add a new contact to the user.
MESSAGE REMOVE_CONTACT Remove a contact from the user.
MESSAGE ADD_STATUS Add a new status to the user.
MESSAGE REMOVE_STATUS Remove a status from the user.
MESSAGE IM A text message to forward to
another user.
INFO GET_LOCATION Ask for a user's whereabouts.
INFO UPDATE_LOCATION Notify the server of the user's new
location.
Presence Information in RTC
Microsoft uses a type of XML document in its RTC model, called - XPIDF.
XPIDF is an extension to PIDF, which was suggested by the IETF, but has not been
officially released, as of the time of this writing. Therefore, its RFC is marked
XXXX, which will be replaced with the real RFC number when it is officially
published.
This XML document contains all there is to know about a person's presence, if it's
his current status, different ways to call him, etc…
An example of an XPIDF document:
Going to eat.