MSRP has similar syntax as other IETF text based protocol such as SIP, HTTP and RTSP. Each message is either a request or a response, uses URIs, a message contains headers and a body that can carry any type of data, including binary information. Unlike SIP, MSRP is much simpler. The first 2 headers must be To-Path and From-Path and the last must be Content-Type, this significantly reduces the complexity of parsers. Messages must also end with 7 dash characters, followed by a transaction identifier which appears in the first line, these are followed by a continuation flag, which is a single character and end of line. This last line at the end of messages makes it rather simple to find and detect the message boundaries. MSRP is not defined for connection-less protocols, such as UDP, thus one be certain that a response to a request would arrive on the same connection. MSRP also relies on a reliable transport layer, that is, guarantees delivery and maintains the order of the messages, which further simplifies the protocol design. An MSRP URI has a scheme, authority, as defined by RFC 3986, which holds the IP/domain name and possibly the port, an optional session identifier, the transport and additional optional parameters. For example: msrp://atlanta.example.com:7654/jshA7weztas;tcp
msrp is the scheme
atlanta.example.com:7654 is the authority
jshA7weztas is the session identifier
tcp is the transport
Usage in SIP
MSRP can be used within a SIP session:
to do instant messaging in a one-to-one or one-to-many mode
to do an attachment file transfer
to do some photo sharing based on prior exchange of capabilities between the user endpoints
MSRP session is set up through SIP's offer-answer model. The SDP m-line media type is message and the protocol is either TCP/MSRP for MSRP over TCP and TCP/TLS/MSRP for MSRP over secure TLS. Furthermore, the MSRP URI is specified in a path attribute. A full SDP example, as provided by the RFC: v=0 o=alice 2890844526 2890844527 IN IP4 alice.example.com s= - c=IN IP4 alice.example.com t=0 0 m=message 7394 TCP/MSRP * a=accept-types:text/plain a=path:msrp://alice.example.com:7394/2s93i9ek2a;tcp The address and port are contained in the c- and m-lines, but also in the path attribute on an a-line. Generally, other media types use the c-line and m-line to describe the address and port, but the MSRP says the path attribute is the authoritative source for MSRP.
Implementations
A generic and open source peer library is implemented in the following programming languages:
Libraries
, which sprung the following ports:
Clients
is a cross platform SIP client with MSRP protocol support.
Servers
MSRP relay has an open source implementation written in Python, .
MSRP switch has an open source implementation written in Python, .
Kamailio SIP server has an embedded open source MSRP relay written in C, .