« Previous - Version 3/29 (diff) - Next » - Current version
Anonymous, 02/29/2012 03:42 pm


= Gateway for Instant Messaging=

<acronym title="DesignXMPP_im, depth=2">TOC</acronym>

In XMPP there are several types of messages which lead to different semantics when exchanging XMPP ''message stanzas'' between 2 endpoints. This section focuses only on message types that allow 2 endpoints to send instant messages to each other.

Message types:

  • Normal: the default message type. A reply is not expected from the recipient.
  • Chat: This message type implies both parties have engaged a conversation.
  • Headline: An endpoint receiving this type of message should never reply, since it's meant to be used by servers or other entities to deliver announcements.

In SIP there are currently 2 ways of doing Instant Messaging:

  • SIP MESSAGE (RFC 3428)
  • MSRP (RFC 4975)

The first one is session-less and the latter is session based.

The mechanisms described here follow the currently available specifications for SIP-XMPP interoperability:

XMPP single message <-> SIP MESSAGE

XMPP single messages are mapped directly to SIP MESSAGE requests and ''vice versa''.

Image(xmppgq_im_normal.png)

=== Overview ===

The mechanism for translating XMPP normal message stanzas and SIP MESSAGE requests is straightforward, they map one to one. However, since SIP is used mainly with UDP as a transport, if a XMPP stanza is bigger than 1500 bytes it will be chunked into smaller pieces to avoid ethernet fragmentation related issues.

Since SIP MESSAGE is a non INVITE transaction, it has to be replied immediately, because there is no way to avoid retransmissions. This means that the SIP-XMPP gateway will reply on the SIP side before knowing if the message was actually delivered to the XMPP side. In order to express this a "202 Accepted" reply will be sent to the SIP request instead of a "200 OK".

On the other hand, when an XMPP stanza is translated into a SIP MESSAGE request the SIP-XMPP gateway is able to report back the result (in case of error) by using a message stanza of type ''error''. This is possible because of the asynchronous nature of stanza processing in the XMPP protocol.