Instant messaging (IM) is defined as the exchange of text messages between two users in real time. Supported by a wide range of multimedia clients such as WhatsApp, instant messaging can easily be used to post messages from any computer or mobile device.
IMGate is a component of each PortaSIP processing node. IMGate enables online messaging and message storage for offline users (so they can receive messages later).
When a MESSAGE request arrives at the PortaSIP via SIP or SMPP, the dispatching node delivers it to the active IMGate.
If an active IMGate server becomes unavailable for some reason, the dispatching node activates the next IMGate server to handle MESSAGE request processing.
When an active IMGate server receives a request, it processes the message according to a defined configuration.
A basic instant message flow looks like this:
- Users connect to PortaSIP with user agents (IM clients). Users are identified by an address (e.g., “John Smith” sip:firstname.lastname@example.org>) that uniquely defines an individual within PortaSIP.
- To make themselves available for contact, user agents send a SIP REGISTER message to PortaSIP.
- User A sends an instant message. The MESSAGE request arrives at the PortaSIP dispatching node (1).
- The dispatching node forwards the request to the active IMGate (2).
- IMGate matches the corresponding domain service policy (using a match pattern) that defines how the instant message must be processed.
- Based on the results, IMGate authorizes the message in the billing engine and receives a routing list for further message delivery (3).
- IMGate checks whether the recipient is registered in the network. If he is, IMGate forwards the message to the dispatching node informing it about the route (4). If the recipient’s UA is not registered, IMGate stores the message until the recipient’s UA sends the REGISTER request to the PortaSIP processing node.
- The message is delivered to user B (5). When a message reaches its destination, a 200 OK response is returned (note that this does not necessarily mean the message has been read by its recipient).
- IMGate sends accounting records to the billing engine to charge user A for the outgoing message (6).
Inter-site messaging means that users registered on different geo-redundant installation sites (each with its own PortaSIP cluster configured), can exchange messages with each other. If a message recipient is offline or unavailable, the message will be sent to them as soon as they appear online, regardless of which site they are registered on.
While operating in stand-alone mode (because the main site is down or unavailable), messages are delivered only to users who are registered on the same site. However, as soon as the main site becomes available again, inter-site messaging is restored and undelivered messages are delivered to the recipients.
Inter-site messaging support facilitates the provisioning of messaging services and improves customer experience.
MIME types supported for instant messaging
A Multipurpose Internet Mail Extensions (MIME) type in the Content-Type header defines the content type inside a SIP MESSAGE request, e.g., HTML. PortaSIP supports the following MIME types:
- text/plain (default type) – to indicate plain “unformatted” text.
- message/cpim – to indicate the Common Presence and Instant Messaging (CPIM) message format.
- text/html* – to enable using HTML formatting such as bold or underlined text.
- application/im-iscomposing+xml* – to notify a user that the other one is typing a message. The sender is not charged for sending such service messages.
- application/x-acro-filetransfer+json* – to enable users of Acrobits applications to use the multimedia messaging service (mmmsg) that facilitates file transfer among them. Please refer to Acrobits for details.
* Note that this MIME type is supported for SIP-to-SIP (on-net) messages only. If SMPP protocol is used for message delivery, IMGate rejects SIP MESSAGE requests with this MIME type.