Integrating Windows Real-Time Communications into Applications
January 15, 2002
Summary: The Windows XP RTC Client API enables developers to add rich, real-time communications into applications. This article provides an overview of the RTC technologies and the components required to implement them in applications. (7 printed pages)
RTC-Enabled Application Scenarios
The RTC Client Application Programming Interface
Profiles and Provisioning
For More Information
Today we have many ways to communicate with our peers, customers, support network, family, and friends. E-mail has become a pervasive mechanism to communicate, but is not quite real time. The telephone is tried and true, but has limitations, such as being voice only—and it lacks a mechanism to know whether or not the other party is present to receive your call.
Enter Real-Time Communications
Real-Time Communications (RTC) offers rich communications and collaboration features combined with presence information, enabling you to know when and where a contact can be found. Many of the features of RTC exist in another form or application, but have never been pulled together in a single implementation to enable and compliment each other.
For example, Instant Messaging (IM) is one of the fastest growing Internet communication mechanisms because it's easy and productive. IM is in real time, and it includes presence capabilities to enable you to know when the other party is available. Still, some features, like voice and video conferencing and online collaboration, were missing from the simple IM experience.
Microsoft® Windows® XP includes all of this RTC functionality in Microsoft® Windows Messenger. Windows Messenger lets you communicate with customers and colleagues in real time using text, audio (voice calls can be established from PC to PC, PC to phone, and from phone to phone), video, and sharing a whiteboard or application. You can keep a contact list, and through presence, know when your contacts are online and available. What's more, these capabilities are not limited to the Windows Messenger application; they are also available to enrich other applications through the RTC Client API.
The Windows Messenger client leverages the Windows XP RTC Client components. This client exposes all of the capabilities of RTC in a single application. There are many situations, however, where requiring a secondary application for communication is burdensome.
RTC is based on Internet technology and protocol standards, enabling other devices and applications using these technologies to communicate with the Windows Messenger client.
The Windows XP RTC Client implementation also exposes an open application programming interface (API) so everyday applications built on the Windows platform can add these capabilities. For example, a Web-based purchasing application could contain a button for instant assistance. When the button is clicked, the application opens an IM session with a support representative or help-desk technician.
Windows Messenger exposes much of the RTC functionality in a single package. This solution has multiple uses and may be the best solution for many scenarios. There are, however, situations where including this functionality inside your application might make things easier, more complete, or more sensible.
Here are a few example scenarios where the user experience would be enhanced were RTC functionality included in an application. There are likely many others enabled by this technology.
Customer Relations Management—Help Desk Remote Assistance
Jim is attempting to purchase a book through an online bookstore, but is having problems entering his credit card and address. By pressing a button on the Web page, he is immediately placed in an IM conversation with an Amazon representative. Using IM and Application Sharing, the representative is able to find the problem (Jim hadn’t entered in his credit card expiry date) and the book is ordered. Without the ability to get real-time assistance, Jim might have given up and the sale may have been lost.
Knowledge Management—Team and Project Communication Web Sites
The product development team site has several functional areas of responsibility (for example, client and server teams). By navigating into the relevant functional area, a user sees a pane that lists all the relevant members of that team, as well as their presence. By clicking the relevant contact, the user is immediately communicating with that member of the team. The immediate knowledge of presence eliminates potentially multiple e-mails and phone calls, eliminating frustration.
A large manufacturer has a lot of suppliers connected to external networks. Instead of sending e-mail to discuss orders and so on, they can use the RTC Client APIs to develop an application that communicates their specific information. For example, the manufacturer could send an order for 1000 widgets, and using IM, immediately receive confirmation that the order has been received by their supplier and entered into their system. Status could be automatically retrieved when needed as the order progresses.
System Alerts—Delivered to Users' Desktop PC or Mobile Device
A company has deployed an e-mail server. To save on support calls, they develop a small application that notifies all users of a particular e-mail server (using IM) that the server is about to go down for routine maintenance. Even without the e-mail server online, the users get the message and keep the phones quiet.
Most multiplayer games already include a mechanism to chat with adversaries and partners. But, can you imagine being able to see your friend’s face as you are about to end his game?
There are potentially many other uses of RTC functionality in applications. Instant communication and collaboration can be enabled by integrating RTC with existing line-of-business applications, resulting in productivity improvements. This could offer benefits to many industries and departments, including finance, manufacturing, health care, human resources, and so on.
To access the same RTC client functionality used by Windows Messenger, Windows XP exposes RTC through the RTC Client API. This API enables applications to make PC-PC, PC-phone, or even phone-phone calls. Applications can add functionality to create IM sessions over the Internet or Intranet. Both voice and video calls can be established between users on their PC. Applications can retrieve and display presence information for a set of contacts. Application and whiteboard sharing can be added to enhance collaboration.
Who might use these interfaces? In-house development groups might use these APIs to add RTC capabilities to their in-house tools. Software vendors might use the RTC API to integrate RTC into their applications, or build specialized applications for sale or to meet a client need. Applications can also be built for telephony service providers for residential or corporate customers. Telecommunication providers that want to sell RTC services can build their own client applications using these APIs. Applications can be built using C++ or Microsoft® Visual Basic®.
The basic coding model for RTC is COM. The objects used for communication in RTC are the Client, Session, and Participant objects.
Figure 1. RTC Client COM objects
- Client object. The Client object implements the IRTCClient interface and sets up the allowed session types and parameters for the session, such as the preferred devices and media types, bitrates, and other media properties, such as volume and acoustic echo cancellation. This interface is also used to create the session object.
- Session object. The Session object is created through the IRTCClient::CreateSession method and is used to manage a session. This object implements the IRTCSession interface that is then used to initiate, answer, or terminate sessions, add participants, and other management of the session. This object supports IM and all other session types. The Session object can be used, for example, to create an IM session with your buddy, or start the audio call with the Web site representative.
- Participant object. The Participant object is created by the IRTCSession::AddParticipant method and contains all methods related to a session participant. This includes the name and current state of a participant. The IRTCParticipant interface is implemented by this object.
Presence information is managed through the Buddy and Watcher objects. These objects expose interfaces used to manage retrieve information pertaining to contacts and presence partners.
- Buddy object. The Buddy object is used to manage, set, and retrieve information about contacts. The Buddy object is created when a contact is added through the IRTCClientPresence::AddBuddy method (IRTCClientPresence is implemented in the Client object). Information such as the contact name and status can be retrieved through this object’s IRTCBuddy interface.
- Watcher object. The Watcher object is used to retrieve information about the state of a watcher, someone who has added you as a contact. This object is also added through the IRTCClientPresence interface, this time using the AddWatcher method. Watcher state and other information is retrieved using methods implemented in the IRTCWatcher interface of this object.
A Profile object is used for maintenance of client provisioning. A profile contains information such as the client’s display and user names, supported session types, and information about the RTC provider for the client. This information enables knowledge of network resources and accounts that can then be used to place calls or handle presence. The Profile object is created through methods exposed by the IRTCClientProvisioning interface (implemented in the Client object).
The client creates a profile to store information used to allow the client access to services on the network. The client application must create an XML profile to store the client's provisioning information. Separate profiles can be used to provision the client with different types of services using a variety of providers, proxy servers, or gateways.
After initializing RTC, the client application creates and enables a profile.
The RTC Client API allows for applications to be notified of various RTC event occurrences, including messaging events, session state changes, participant state changes, presence state changes, device changes, and network quality changes. To implement, an application sets an event filter (mask) through the IRTCClient interface and registers an IRTCEventNotification event interface in the application’s event sink object. When the events of interest occur, the event type and object will be provided to the client’s Event method for processing.
There are several interfaces implemented in the RTC objects discussed above. These interfaces can be used to fully add the desired RTC functionality to an application. The RTC interfaces and the methods associated with them are fully documented in the Platform SDK.
For the latest information on Windows XP, check out the Windows XP home page.
For detailed information on the RTC Client API, refer to the Real-Time Communications (RTC) Client documentation in the Platform SDK.