Yes, the OpenSIPS 3.3 focuses on messaging and MSRP is a key element when talking about messaging/chat sessions. Packing messages into sessions enables the creation of advanced chatting / conferencing services in the RCS and UC world.
The MSRP stack
The MSRP implementation in OpenSIPS 3.3 comes as complex stack, covering from the lowest protocol level, up to the highest application level.
This implementation approach, of multiple layers interconnected via internal API allows a better modularity, resulting is a easy creation of various MSRP related functionalities in OpenSIPS. For example, the MSRP conferencing feature was part of the original design, but it didn’t make it into 3.3 release (due to time constrains) – nevertheless, its future addition is a very simple one, as it will take advantage (and share) of the existing MSRP User Agent API. Similarly, more MSRP high level application may be added, reusing the full protocol, transactional and UA existing stack.
MSRP Protocol layer
The MSRP protocol stack is provided by the proto_msrp module, the foundation of the entire MSRP support in OpenSIPS. It implements the MSRP(S) support according to RFC 4975. The implementation provides a generic MSRP(S) stack covering the network operations (reading / writing MSRP(S) messages), the parsing of MSRP messages and managing of MSRP transactions (request-reply and timeouts). The module cannot be used by itself, as it is not exposing any scripting or MI capabilities – it exposes only an internal API for other modules to build functionalities on top of it.
The MSRP relay
The module provides capabilities for:
- authenticating MSRP end points
- managing MSRP sessions
- perform MSRP traffic relaying
- perform bridging between multiple interfaces.
The relay is an essential building block, similar to a RTP relay, from the perspective of the interconnections (network bridging in SBC) and of security (topology hiding and authentication). To a certain point, the MSRP reply is the “must” component that helps interconnecting all the entities of an MSRP network.
Even if the MSRP operations provided by the module are well dictated by the RFC, the implementation brings a lot of flexibility via script integration. Dedicated script routes are triggered for :
- providing the authentication credentials when connecting a new MSRP end point
- selecting the outbound MSRP interface (for bridging purposes) when starting a new MSRP relaying session.
The MSRP User Agent
The msrp_ua module bundles the SIP and MSRP capabilities required for implementing a chatting / IM end point in OpenSIPS. Built on top of proto_msrp and b2b_entities, the module is able to initiate or receive SIP sessions with MSRP and send/receive chats via those sessions.
This ability to handle MSRP User Agent sessions is another important building block of the the MSRP stack in OpenSIPS 3.3 as:
- this MSRP UA support is re-used/shared by several other higher level MSRP services/functionalities implemented by OpenSIPS 3.3;
- this support is exposed/provided for usage via different channels/interfaces in OpenSIPS
The MSRP UA module may be used directly from the script level, like for accepting incoming MSRP calls. This is to be further used in conjunction with the external API provided by the module, where using MI commands and Events, you can have a total control over the MSRP sessions and their messaging.
For example, one can exclusively use the MSRP UA module, with the scripting and its external API in order to build a full MSRP API to be used by external apps – to be able to initiate or answer MSRP sessions and to send or received messages.
In the same time, the MSRP UA module exposes an internal API to be used by any modules implementing advanced MSRP functionalities. Right now the MSRP (to SIP Message) gateway module is the only one that implements the API. For the future versions we target an MSRP conferencing module, also using the MSRP UA module for implementing the MSRP end points in the conference.
The MSRP gateway
To support SIP clients with Page Mode (SIP MESSAGE) as well, OpenSIPS 3.3 is able to act as a Gateway between SIP MESSAGE (or “Page Mode”) and MSRP-based (“Session Mode”) Instant Messaging – in this way, such SIP clients (with MESSAGE only support) will be able to access all the advanced messaging services built on top of MSRP (like chats, Queuing, RCS, etc).
The module creates temporary mappings between MSRP sessions and bundles of SIP Messages. Such bundles are created based on compound keys such “same SIP user & same SIP device & same time session”.
The module exposes two simple to use script functions that encapsulate the whole bundling on the “SIP Message” side, but also the mapping between the SIP Message bundles and the MSRP sessions:
msrp_gw_answer() – for MSRP to Message direction
msg_to_msrp() – for the Message to MSRP direction
The MSRP conference support is an item we have on the roadmap in the MSRP area. The current IMC module is oldish, supporting only Page Mode for IM and only an IRC-based way of functioning.
The new MSRP conference module aims to (1) support Session Mode IM (MSRP) as well, (2) to provide a more flexible and modern way of managing the chat rooms (not IRC based) and (3) to provide an API to allow the integration of IM with WEB services.