IMS
MSRP

MSRP stands for Message Session Relay Protocol. It is used by IMS/RCS services to exchange instant messages, file-transfer payloads, delivery notifications, and other message bodies over an IP session.

From an application point of view, MSRP supports instant messaging behavior similar to SMS and MMS, but it is carried over IMS/RCS signaling and media sessions. In RCS, MSRP is commonly used for standalone messages, one-to-one chat, group chat, file transfer, and delivery reports.

There are two practical modes to understand: Pager Mode and Session Mode. Pager Mode sends a short standalone message using SIP MESSAGE. Session Mode establishes a SIP dialog with SDP and then exchanges MSRP SEND requests over the negotiated MSRP path.

Contents

Pager Mode

Pager Mode is used for short standalone messages. The message content is carried in the SIP MESSAGE request, so there is no separate MSRP media session to set up.

  • Each message are unrelated to previous message
  • There is no "Start" or "Stop" (Single MESSAGE does completes the message transfer)
  • Each message is routed through proxies
  • Max Message size is 1200 bytes

Pager mode may look simple in terms of protocol, but it has many drawbacks as listed below.

  • Message size is limit to max 1200 bytes
  • It may cause performance issue since every message should go through each proxy
  • It is hard to guarantee end-to-end security
  • Message overhead may get very large
  • SIP features specified on INVITE message does not apply to Pager Mode
  • It is not easy to support multiple devices

Example >

The simplest usage of Pager Mode message transfer is just a single MESSAGE and 200 OK. In real application, the operator may require additional sequence for additional information (e.g, Delivery Report). See Standalone message example in RCS.

Step

Direction

Protocol

Message

Comments

(1)

UA1 --> Proxy/UA2

SIP

MESSAGE

Send a text '123456789abcdef'

(2)

UA1 <-- Proxy/UA2

SIP

200 OK  

(1) MESSAGE

UA1 sends a standalone SIP MESSAGE carrying the short text body and CPIM-related headers. This request identifies the sender, recipient, message body type, and IMS access context.

    MESSAGE sip:+14448880011@sharetechnote.com;user=phone SIP/2.0

    P-Preferred-Service: urn:urn-7:3gpp-service.ims.icsi.oma.cpm.msg

    Contribution-ID: 477b66ae9662e3ad18549bf5dabf9d26d5e707ca

    Conversation-ID: 1710887c7ca47dc2c1274c11673eb0df5a604fd3

    P-Preferred-Identity: <sip:310410123456789@sharetechnote.com>

    Request-Disposition: no-fork

    User-Agent: TEST IMS 5.0

    CSeq: 1 MESSAGE

    Max-Forwards: 70

    P-Access-Network-Info: 3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=31041000010000000

    Route: <sip:[2001:0:0:1::2]:5060;lr>

    a: *;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.msg"

    c: message/cpim

    f: <sip:310410123456789@sharetechnote.com>;tag=1384874566

    i: 3712948749@2001::1:88fe:fccf:2870:5dee

    l: 322

    m: <sip:310410123456789@[2001::1:88fe:fccf:2870:5dee]:5060>;

    This SIP message clip highlights the following parameters: Route, CSeq, P-Access-Network-Info, Max-Forwards, User-Agent. Use these fields to correlate routing, dialog identity, transaction sequencing, registration/session state, security context, and media negotiation for this part of the procedure.

        +sip.instance="<urn:gsma:imei:35469106-056673-0>"

    t: <sip:+14448880011@sharetechnote.com;user=phone>

    v: SIP/2.0/TCP [2001::1:88fe:fccf:2870:5dee]:5060;branch=z9hG4bK2629405539smg;transport=TCP

    From: <sip:310410123456789@sharetechnote.com>

    To: <sip:+14448880011@sharetechnote.com;user=phone>

    This SIP message clip highlights the following parameters: From, To. Use these fields to correlate routing, dialog identity, transaction sequencing, registration/session state, security context, and media negotiation for this part of the procedure.

    DateTime: 2015-02-17T06:54:27Z

    NS: imdn <urn:ietf:params:imdn>

    imdn.Message-ID: PH7qAIV8cgH5

    imdn.Disposition-Notification: positive-delivery, display

    Content-type: text/plain;charset=UTF-8

    Content-Length: 15

    This MSRP message clip highlights the following parameters: Content-Type, Content-Length. Use these fields to correlate routing, dialog identity, transaction sequencing, registration/session state, security context, and media negotiation for this part of the procedure.

    123456789abcdef

(2) 200 OK

The 200 OK confirms that the MESSAGE request was accepted by the receiving side or proxy path. It mirrors the transaction identifiers so the response can be correlated with the original MESSAGE.

    SIP/2.0 200 OK

    Max-Forwards: 70

    Via: SIP/2.0/TCP [2001::1:88fe:fccf:2870:5dee]:5060;branch=z9hG4bK2629405539smg;transport=TCP

    From: <sip:310410123456789@sharetechnote.com>;tag=1384874566

    To: <sip:+14448880011@sharetechnote.com;user=phone>;tag=73335cbb32b744baaaf5097a34431c92

    Call-ID: 3712948749@2001::1:88fe:fccf:2870:5dee

    CSeq: 1 MESSAGE

    This SIP message clip highlights the following parameters: Via, CSeq, Call-ID, From, To, Max-Forwards. Use these fields to correlate routing, dialog identity, transaction sequencing, registration/session state, security context, and media negotiation for this part of the procedure.

    Server: TEST-RCS-serv/OMA1.0

    Content-Length: 0

    This SIP message clip highlights the following parameters: Content-Length. Use these fields to correlate routing, dialog identity, transaction sequencing, registration/session state, security context, and media negotiation for this part of the procedure.

Session Mode

In Session Mode, SIP first establishes a media-like session using INVITE and SDP. After the MSRP path is negotiated, message payloads are exchanged with MSRP SEND requests and the session is later released by normal SIP session teardown.

SDP for Session Mode

The SDP offer or answer describes the MSRP media stream. The key fields are the `m=message` media line, accepted content types, setup role, MSRP path URI, and send/receive direction.

    v=0

    o=TEST-IMS-UE 1234562 0 IN IP6 2001::1:4c16:9c0f:4986:9e6d

    s=SS VOIP

    c=IN IP6 2001::1:4c16:9c0f:4986:9e6d

    t=0 0

    m=message 8880 TCP/MSRP *   // Indicate this is for MSRP

    a=accept-types:message/cpim application/im-iscomposing+xml // allowed content type

    a=accept-wrapped-types:text/plain message/imdn+xml  // allowed content type

    a=setup:active

    a=path:msrp://[2001::1:4c16:9c0f:4986:9e6d]:8880/FmnP;tcp //MSRP URI. It indicates where message should be sent

    a=msrp-cema

    a=sendrecv

    This SDP/media clip highlights `m=message`, `a=accept-types`, `a=accept-wrapped-types`, `a=setup`, `a=path`, `a=msrp-cema`, and `a=sendrecv`. These parameters define the MSRP media stream, accepted payload types, connection setup role, MSRP URI, connection-model support, and media direction.

SEND Method

The MSRP SEND method carries a payload within the MSRP session. `To-Path`, `From-Path`, `Message-ID`, `Byte-Range`, and `Content-Type` identify the routing path, message instance, byte chunk, and payload type.

    MSRP RgGcYXJW2nHr SEND

    // To-Path indicates the MSRP path to the recipient

    To-Path: msrp://[2001:0000:0000:0001:0000:0000:0000:0002]:16000/558f02b9d0;tcp

    // From-Path indicates path from the sender

    From-Path: msrp://[2001::1:4c16:9c0f:4986:9e6d]:8880/FmnP;tcp

    // Message-ID is unique per MSRP message.

    Message-ID: ZNsPlykpMApIABRrejarbO37ADMMae

    Success-Report: no

    Failure-Report: yes

    // Byte-Range identifies the byte range when a large payload is split into chunks

    Byte-Range: 1-430/430

    // Content-Type identifies the payload type. It can be text/plain, cpim or any other.

    Content-Type: message/cpim  

    This MSRP message clip highlights the following parameters: Content-Type. Use these fields to correlate routing, dialog identity, transaction sequencing, registration/session state, security context, and media negotiation for this part of the procedure.

< Example >

Step

Direction

Protocol

Message

Comments

(1)

UA1 --> Proxy/UA2

SIP/SDP

INVITE  

(2)

UA1 <-- Proxy/UA2

SIP

100 Trying  

(3)

UA1 <-- Proxy/UA2

SIP

183 Session Progress  

(4)

UA1 <-- Proxy/UA2

SIP/SDP

200 OK  

(5)

UA1 --> Proxy/UA2

SIP

ACK  

(6)

UA1 --> Proxy/UA2

MSRP

SEND  

(7)

UA1 <-- Proxy/UA2

MSRP

200 OK  

(8)

UA1 --> Proxy/UA2

MSRP

SEND Send Text 'Hello'

(9)

UA1 <-- Proxy/UA2

MSRP

200 OK  

(10)

UA1 <-- Proxy/UA2

MSRP

SEND Delivery Notification

(11)

UA1 --> Proxy/UA2

MSRP

200 OK  

(1) INVITE

UA1 starts Session Mode by sending INVITE with SDP for an MSRP media stream. This establishes the SIP dialog and proposes the MSRP endpoint, accepted content types, and setup role.

    INVITE sip:+14448880000@sharetechnote.com;user=phone SIP/2.0

    Conversation-ID: 6b79b8bc937e4985b1dffd062b687bd7

    Contribution-ID: d5e4121aeec2cc59546ebaef8966ef185a2f37f0

    P-Preferred-Service: urn:urn-7:3gpp-service.ims.icsi.oma.cpm.session

    P-Preferred-Identity: <sip:310410123456789@sharetechnote.com>

    P-Early-Media: supported

    Allow: INVITE,ACK,OPTIONS,CANCEL,BYE,UPDATE,INFO,REFER,NOTIFY,MESSAGE,PRACK

    User-Agent: Samsung IMS 5.0

    CSeq: 1 INVITE

    Max-Forwards: 70

    P-Access-Network-Info: 3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=31041000010000000

    Route: <sip:[2001:0:0:1::2]:5060;lr>

    a: *;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.session"

    c: application/sdp

    f: <sip:310410123456789@sharetechnote.com>;tag=284849603

    i: 508868544@2001::1:4c16:9c0f:4986:9e6d

    k: timer

    l: 363

    m: <sip:310410123456789@[2001::1:4c16:9c0f:4986:9e6d]:5060;transport=UDP>;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.session"

    t: <sip:+14448880000@sharetechnote.com;user=phone>

    v: SIP/2.0/TCP [2001::1:4c16:9c0f:4986:9e6d]:5060;branch=z9hG4bK2563646430smg;transport=TCP

    v=0

    o=TEST-IMS-UE 1234562 0 IN IP6 2001::1:4c16:9c0f:4986:9e6d

    s=SS VOIP

    c=IN IP6 2001::1:4c16:9c0f:4986:9e6d

    t=0 0

    m=message 8880 TCP/MSRP *

    a=accept-types:message/cpim application/im-iscomposing+xml

    a=accept-wrapped-types:text/plain message/imdn+xml

    a=setup:active

    a=path:msrp://[2001::1:4c16:9c0f:4986:9e6d]:8880/FmnP;tcp

    a=msrp-cema

    a=sendrecv

    This SIP message clip highlights the following parameters: Route, CSeq, P-Access-Network-Info, Max-Forwards, Allow, User-Agent. Use these fields to correlate routing, dialog identity, transaction sequencing, registration/session state, security context, and media negotiation for this part of the procedure.

(2) 100 Trying

The 100 Trying response stops INVITE retransmission while the network or terminating side processes the session setup request.

    SIP/2.0 100 Trying

    Via: SIP/2.0/TCP [2001::1:4c16:9c0f:4986:9e6d]:5060;branch=z9hG4bK2563646430smg;transport=TCP

    Max-Forwards: 70

    From: <sip:310410123456789@sharetechnote.com>;tag=284849603

    To: <sip:+14448880000@sharetechnote.com;user=phone>

    Call-ID: 508868544@2001::1:4c16:9c0f:4986:9e6d

    CSeq: 1 INVITE

    Content-Length: 0

    This SIP message clip highlights the following parameters: Via, CSeq, Call-ID, From, To, Content-Length, Max-Forwards. Use these fields to correlate routing, dialog identity, transaction sequencing, registration/session state, security context, and media negotiation for this part of the procedure.

(3) 183 Session Progress

The 183 response provides early progress for the MSRP session setup and keeps the same dialog identifiers from the INVITE.

    SIP/2.0 183 Session Progress

    Max-Forwards: 70

    Via: SIP/2.0/TCP [2001::1:4c16:9c0f:4986:9e6d]:5060;branch=z9hG4bK2563646430smg;transport=TCP

    From: <sip:310410123456789@sharetechnote.com>;tag=284849603

    To: <sip:+14448880000@sharetechnote.com;user=phone>;tag=b2fbe90a8c2e488ba04ad6d0c0956a6c

    Call-ID: 508868544@2001::1:4c16:9c0f:4986:9e6d

    CSeq: 1 INVITE

    Contact: <sip:+14448880000@sharetechnote.com>

    This SIP message clip highlights the following parameters: Via, Contact, CSeq, Call-ID, From, To, Max-Forwards. Use these fields to correlate routing, dialog identity, transaction sequencing, registration/session state, security context, and media negotiation for this part of the procedure.

    Record-Route: <sip:[2001:0:0:1::2]:5060;lr>

    Content-Length: 0

    This SIP message clip highlights the following parameters: Content-Length. Use these fields to correlate routing, dialog identity, transaction sequencing, registration/session state, security context, and media negotiation for this part of the procedure.

(4) 200 OK

The 200 OK accepts the MSRP session and returns the SDP answer, including the remote MSRP path and media parameters.

    Via: SIP/2.0/TCP [2001::1:4c16:9c0f:4986:9e6d]:5060;branch=z9hG4bK2563646430smg;transport=TCP

    From: <sip:310410123456789@sharetechnote.com>;tag=284849603

    To: <sip:+14448880000@sharetechnote.com;user=phone>;tag=b2fbe90a8c2e488ba04ad6d0c0956a6c

    Call-ID: 508868544@2001::1:4c16:9c0f:4986:9e6d

    CSeq: 1 INVITE

    Allow: INVITE, ACK, CANCEL, BYE, MESSAGE

    Contact: <sip:[2001:0:0:1::2]:49466;transport=tcp>

    Content-Type: application/sdp

    This SIP message clip highlights the following parameters: Via, Contact, CSeq, Call-ID, From, To, Content-Type, Allow. Use these fields to correlate routing, dialog identity, transaction sequencing, registration/session state, security context, and media negotiation for this part of the procedure.

    Record-Route: <sip:[2001:0:0:1::2]:5060;lr>

    Content-Length: 292

    v=0

    o=- 1192 5963 IN IP6 2001:0:0:1::2

    s=-

    c=IN IP6 2001:0:0:1::2

    m=message 16000 TCP/MSRP *

    a=accept-types:message/cpim application/im-iscomposing+xml

    a=accept-wrapped-types:*

    a=path:msrp://[2001:0000:0000:0001:0000:0000:0000:0002]:16000/558f02b9d0;tcp

    a=msrp-cema

    a=setup:passive

    This SIP message clip highlights the following parameters: Content-Length. Use these fields to correlate routing, dialog identity, transaction sequencing, registration/session state, security context, and media negotiation for this part of the procedure.

(5) ACK

ACK confirms the final 200 OK for the INVITE transaction. After this point, the MSRP session can exchange SEND requests.

    SIP/2.0 200 OK

    Max-Forwards: 70

    ACK sip:[2001:0:0:1::2]:49466;transport=UDP SIP/2.0

    CSeq: 1 ACK

    Max-Forwards: 70

    Route: <sip:[2001:0:0:1::2]:5060;lr>

    f: <sip:310410123456789@sharetechnote.com>;tag=284849603

    i: 508868544@2001::1:4c16:9c0f:4986:9e6d

    l: 0

    m: <sip:310410123456789@[2001::1:4c16:9c0f:4986:9e6d]:5060;transport=UDP>

    t: <sip:+14448880000@sharetechnote.com;user=phone>;tag=b2fbe90a8c2e488ba04ad6d0c0956a6c

    v: SIP/2.0/UDP [2001::1:4c16:9c0f:4986:9e6d]:5060;branch=z9hG4bK1597981393smg;transport=UDP

    This SIP message clip highlights the following parameters: Route, CSeq, Max-Forwards. Use these fields to correlate routing, dialog identity, transaction sequencing, registration/session state, security context, and media negotiation for this part of the procedure.

(6) SEND

The first MSRP SEND can be used as an empty or control SEND to confirm the negotiated MSRP path before user content is transferred.

    MSRP kePLNmnn6eCcn7lB9X SEND

    To-Path: msrp://[2001:0000:0000:0001:0000:0000:0000:0002]:16000/558f02b9d0;tcp

    From-Path: msrp://[2001::1:4c16:9c0f:4986:9e6d]:8880/FmnP;tcp

    Message-ID: IeGt4q5QsCmzD

    Success-Report: no

    Failure-Report: yes

    -------kePLNmnn6eCcn7lB9X$

    This MSRP message clip highlights `To-Path`, `From-Path`, `Message-ID`, `Success-Report`, and `Failure-Report`. These fields identify the MSRP routing endpoints, the request instance, and whether success or failure reports are expected.

(7) 200 OK

This MSRP 200 OK acknowledges the preceding SEND request at the MSRP layer.

    MSRP kePLNmnn6eCcn7lB9X 200 OK

    To-Path: msrp://[2001::1:4c16:9c0f:4986:9e6d]:8880/FmnP;tcp

    From-Path: msrp://[2001:0000:0000:0001:0000:0000:0000:0002]:16000/558f02b9d0;tcp

    -------kePLNmnn6eCcn7lB9X$

    This MSRP 200 OK clip highlights `To-Path` and `From-Path`, which reverse the sender and receiver paths to acknowledge the previous SEND request.

(8) SEND

This SEND carries the user message payload. The CPIM wrapper and text body identify the sender, recipient, message ID, disposition request, and message content.

    MSRP RgGcYXJW2nHr SEND

    To-Path: msrp://[2001:0000:0000:0001:0000:0000:0000:0002]:16000/558f02b9d0;tcp

    From-Path: msrp://[2001::1:4c16:9c0f:4986:9e6d]:8880/FmnP;tcp

    Message-ID: ZNsPlykpMApIABRrejarbO37ADMMae

    Success-Report: no

    Failure-Report: yes

    Byte-Range: 1-430/430

    Content-Type: message/cpim

    From: <sip:anonymous@anonymous.invalid>

    To: <sip:anonymous@anonymous.invalid>

    This MSRP message clip highlights the following parameters: From, To, Content-Type. Use these fields to correlate routing, dialog identity, transaction sequencing, registration/session state, security context, and media negotiation for this part of the procedure.

    DateTime: 2015-02-24T06:48:09Z

    NS: imdn <urn:ietf:params:imdn>

    NS: MyFeatures <mailto:RCSFeatures@test.com>

    MyFeatures.PANI: 3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=31041000010000000

    imdn.Message-ID: wYcJuXBbGOfCtBqIPQqz0I

    imdn.Disposition-Notification: positive-delivery, display

    Content-type: text/plain;charset=UTF-8

    Content-Length: 5

    This MSRP message clip highlights the following parameters: Content-Type, Content-Length. Use these fields to correlate routing, dialog identity, transaction sequencing, registration/session state, security context, and media negotiation for this part of the procedure.

    Hello

    -------RgGcYXJW2nHr$

    This MSRP SEND clip highlights `To-Path`, `From-Path`, `Message-ID`, `Byte-Range`, CPIM `From`, CPIM `To`, `imdn.Message-ID`, `imdn.Disposition-Notification`, `Content-Type`, and `Content-Length`. These fields route the message, identify the payload chunk, request delivery/display reporting, and carry the text body.

(9) 200 OK

This MSRP 200 OK acknowledges receipt of the user-message SEND request.

    MSRP RgGcYXJW2nHr 200

    To-Path: msrp://[2001::1:4c16:9c0f:4986:9e6d]:8880/FmnP;tcp

    From-Path: msrp://[2001:0000:0000:0001:0000:0000:0000:0002]:16000/558f02b9d0;tcp

    -------RgGcYXJW2nHr$

    This MSRP 200 OK clip highlights `To-Path` and `From-Path`, confirming the previous user-message SEND on the negotiated MSRP path.

(10) SEND

This SEND carries the delivery notification payload using message/imdn+xml to report delivery status for the previous user message.

    MSRP 69172e29 SEND

    To-Path: msrp://[2001:0000:0000:0001:4C16:9C0F:4986:9E6D]:8880/FmnP;tcp

    From-Path: msrp://[2001:0000:0000:0001:0000:0000:0000:0002]:16000/558f02b9d0;tcp

    Message-ID: fd2f8f3e7c

    Byte-Range: 1-500/500

    Content-Type: message/cpim

    From: <sip:anonymous@anonymous.invalid>

    To: <sip:anonymous@anonymous.invalid>

    This MSRP message clip highlights the following parameters: From, To, Content-Type. Use these fields to correlate routing, dialog identity, transaction sequencing, registration/session state, security context, and media negotiation for this part of the procedure.

    DateTime: 2015-02-24T06:48:10.7749079Z

    NS: imdn <urn:ietf:params:imdn>

    imdn.Message-ID: 2252a2757d

    Content-Type: message/imdn+xml

    This MSRP message clip highlights the following parameters: Content-Type. Use these fields to correlate routing, dialog identity, transaction sequencing, registration/session state, security context, and media negotiation for this part of the procedure.

    Content-Disposition: notification

    <?xml version="1.0" encoding="utf-8"?>

    <imdn xmlns="urn:ietf:params:xml:ns:imdn">

      <message-id>wYcJuXBbGOfCtBqIPQqz0I</message-id>

      <delivery-notification>

        <status>

          <delivered />

        </status>

      </delivery-notification>

    </imdn>

    -------69172e29$

    This MSRP SEND clip highlights `To-Path`, `From-Path`, `Message-ID`, `Byte-Range`, `Content-Type: message/imdn+xml`, `Content-Disposition`, and the IMDN XML body. These fields identify the delivery-notification message and report the delivered status for the original message ID.

(11) 200 OK

The final MSRP 200 OK acknowledges the delivery-notification SEND request.

    MSRP 69172e29 200 OK

    To-Path: msrp://[2001:0000:0000:0001:0000:0000:0000:0002]:16000/558f02b9d0;tcp

    From-Path: msrp://[2001::1:4c16:9c0f:4986:9e6d]:8880/FmnP;tcp

    Message-ID: fd2f8f3e7c

    -------69172e29$

    This MSRP 200 OK clip highlights `To-Path`, `From-Path`, and `Message-ID`, confirming the delivery-notification SEND transaction.