![]() |
![]() |
![]() |
|
Communications: IM, voice, videoFrom Rex community wiki
IntroductionCommunicationModule offers IM, voip, video and presence services. Actual protocol specific implementation is done using existing libraries. The module provides interfaces to these services and hides actual implementation and possible threading. The user interfaces for communication features are implemented separately. These user interface modules use the services of UserInterface and CommunicationModule modules. Communication protocolsThere are several commonly used IM protocols and plenty of libraries which implement those [3] but the requirements reduces the available choices. XMPP/JingleExtensible Messaging and Presence Protocol (XMPP) also known as Jabber protocol was originally intended to be a messaging and presence protocol. Features like VoIP and file transfer have been added later. For basics of XMPP see Appendix A. Jingle protocol adds streaming and signaling features, enabling peer to peer streaming of video, VoIP and other media. [1][2][5]
SIP/SIMPLE/MSRPSession Initialization Protocol (SIP) is, as its name implies, used to initiate sessions. The session initialization itself is done in client-server manner, but actual data transmission in a session is done peer to peer. The origins of SIP lie in setting up a protocol for IP-based call and signaling communications, a protocol for "IP-phones". [4] Simple (Session Initiation Protocol for Instant Messaging and Presence Leveraging Extensions) is an extension to the SIP protocol and provides presence functionality, short text messages and signaling for real time messaging.
SIP clients need also SIP relay server software like Freeswitch and MSRP proxy server to deliver messages to clients over NAT. OpenSimulatorOpenSimulator server currently supports text chat and presence status. These services are world specific and the users can only communicate with other users from the same world. The transfer protocol used is OpenSimulator/Secondlife specific.
(*) with Modular realXtend this is possible.
RTPReal-time Transfer Protocol (RTP) is used for media streaming, for example streaming real time video or audio streams. Specification xep-0167 [13] specifies how the RTP protocol is used with Jingle. Jingle sessions can contain more than one RTP stream at one time. For example a video call with another user would combine video and audio streams in a synchronized manner. RTP protocol is useful in establishing group sessions, because it can combine multiple streams to one stream. That way group session can be establised in the way that each individual participating group session receives the same copy of incoming stream that is the sum of everyone's outgoing streams. LibrariesTelepathy framework
Chosen technologiesWe use Telepathy framework for implementation jabber IM and voip/video streaming. Its component based and third party implementations of different IM protocols already exist and more might be written in the near future. It also includes components for audio and video streaming. Telepathy supports both SIP and XMPP protocols as well many others. XMPP seems to fit better for IM and presence functionality whereas SIP is more about VoIP like solutions. However our implementation doesn't have to be fixed to use just certain IM protocol, because Telepathy supports them as plugins. It is rather new one and it is developing rapidly. It is still a young product and changes and fixes are common. The biggest problem is the lack of proper support for Windows platforms. There is no existing build files for Windows so those have to be made by ourselves. If Telepathy turns out to be not mature enough for Windows development at the moment, we can still implement IM functionality with eg. loudmouth library and test the features and develope IM user interface with it. DesignThe CommunicationModule is userinterface agnostic and just implements the communication functionality using lower level comminication spesific libraries. The module runs in its own thread and interacts with the framework by events. The IM user interface is implemented in CommunicationUIModule and it's tied to main user interface thread. Communication between CommunicationModule and the user interface implementations Use case - client connect to IM server:
communicationModule.login(username, password);
eventManager.raiseEvent(IMCONNECTION_LOGGED_IN);
Use case - client receives incoming IM session request
eventManager.raiseEvent(INCOMING_CHAT_SESSION_REQUEST);
chatSession.accept()
Use case - User sends a text message during chat session
chatSession.sendMessage(message);
Use case - a friend of the user comes online
eventManager.raiseEvent(PRESENCE_STATE_UPDATE, presenceState);
CommunicationModule designThe image below describes extensible structure communications component model. The exact way of communicating, used protocols and libraries (Telepathy, XMPP, Loudmouth), is hidden and can't be seen by higher level user interfaces and applications using it. However, connection metadata can be dug out and advanced users can find configuration settings that define the used libraries. What is common to different types of communication protocols is sessions and connections and sessions usually have Identifiers. Image [Comms SD]: Class diagram presenting data structures of shared belonging to communications component.
Citations
[1] http://www.ietf.org/rfc/rfc3920.txt Appendix A - How XMPP worksIn XMPP communication data is transferred through XML streams. XML streams are like open XML documents going from client to server and from server to client over a TCP connection. XML streams start with opening stream XML tag and end with ending stream XML tag. Simple XMPP session could look like something in the listing below (Listing [XML streams]). C: <?xml version='1.0'?>
<stream:stream
to='example.com'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'
version='1.0'>
S: <?xml version='1.0'?>
<stream:stream
from='example.com'
id='someid'
xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams'
version='1.0'>
... encryption, authentication, and resource binding ...
C: <message from='humptey@example.com'
to='dumptey@example.net'
xml:lang='en'>
C: <body>Doo doo daa</body>
C: </message>
S: <message from='dumptey@example.net'
to='humptey@example.com'
xml:lang='en'>
S: <body>That's all you've gotta say to me?</body>
S: </message>
C: </stream:stream>
S: </stream:stream>
Listing [XML streams]: Listing showing basic XML stream data flows between client and server. C: marks XML tags send by client and S: marks XML tags send by Server. Timeline goes from up to down and </stream:stream> ends stream.
Jingle is an extension to XMPP that allows XMPP to create P2P media sessions. Jingle protocol contains XMPP Information Query (IQ XMPP stream elements) requests that enable client to ask list of STUN servers (STUN = Simple Traversal of User Datagram Protocol(UDP) Through Network Address Translators (NATs)). Establishing session in NATed network between 2 XMPP clients is described in image below (Image [XMPPandP2P]). When client A wants to establish P2P media session with client B, it first queries available STUN servers. With STUN server client then lists possible connections for the media session counterpart to use: Local addresses, Global address (external NAT addresses), relay server addresses (see Image [JingleAddresses]).
[1,2,9,10,11] Appendix B - How SIP worksIn SIP protocol media sessions are basically negotiated with Invite request. In the image below (Image [SipFlow]) host A UA client sends Invite to host B acting as UA Server. The server between sends TRYING message, indicating it has received Invite from host A and tries to reach host B, which is the target of the Invite message. Ringing message is send from host B as indication that destination is reached. When user on the host B side accepts media session OK is send back to host A. As a result a media session is established.
Appendix C - How Telepathy framework worksIn Telepathy framework the userinterface and actual protocol implementations are separated into different modules. These modules communicate through D-bus. The protocol implementations are called connection managers and those provide connections for different protocols. Multiple application can use same connection manager instance at same time. The communication is separated to connections and channels. Connection is a session between client and server. Connection provides different type of channels. Channels represents actual data flow between communicating participants. Eg. Text channel is used to send and receive text messages between users and RoomList channel is used to retrieve a list of currently users on some chat room. Channel types:
|
|||
![]() |
![]() |
![]() |







