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 is as follows:
Users A and B launch their softphones (IM clients like PortaPhone). Users are identified by an address (e.g., “John Smith” sip:email@example.com>) that corresponds to an individual account in PortaBilling. To register, IM clients send a SIP REGISTER message to PortaSIP.
- User A sends a message to user B using a softphone (IM client). The MESSAGE request arrives at the PortaSIP dispatching node.
- The dispatching node forwards the request to the active IMGate. IMGate searches for a matching domain service policy (using a match pattern) that defines how the instant message must be processed.
- IMGate authorizes the message in PortaBilling. Upon successful authorization, IMGate receives a route list for further message delivery.
- IMGate checks whether the message recipient is registered in the network. If so, IMGate forwards the message to the dispatching node informing it about the first route in the route list received at step 3 – this route should be used to deliver the message. If the recipient’s IM client is not registered, IMGate stores the message for one hour waiting for the recipient’s IM client to register.
- The dispatching node sends the message to the IM client of user B.
- Once the message is delivered (which doesn’t necessarily mean the message has been read), the IM client of user B responds to the dispatching node with 200 OK to confirm the message delivery.
- The dispatching node forwards the 200 OK response to IMGate.
- IMGate sends accounting records to PortaBilling to charge user A for the outgoing message.
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.