Reference13r3:Concept Chat

From innovaphone wiki
Jump to navigation Jump to search

Instant Messaging is a standard functionality of the innovaphone PBX. The messages are sent using instant messages calls with standard SIP method or proprietary H.323/H.450 facilities. The myApps Chat App is provided by the PBX as a user interface for chat. The PBX itself only provides the instant messaging calls and forwarding of the messages. No storing of the messages is provided.

To add additional functionality to chat like storing of chats, group chats or file attachments, the PBX provides an API with the Messages App Object, so that this functionality can be added by an additional App Service. Access to this functionality is also provided to the Chat App by an API. The Chat App can detect the presence of this API. The use of this API must be enabled by a license.

The Chat App

The Chat App is the client App for instant messaging. It is provided by the PBX itself. No external App Service is required. A user can be granted acccess to the Chat App by setting the 'chat' checkmark in the Apps Tab of the Advanced UI.

Features without license

The Chat App works without license. Features without license include the following:

volatile chat
Chat to other users, if these other users are online and respond to the incoming chat call
Some emojiis can be seleceted to be included in the message. The emojiis are sent as standard unicode characters

Additional Features with license

If the user has a chat license, additional features are available, which need the external Messages service:

Storing of Chats
No need to the destination of a chat to be online. The message can be sent and read asynchronously
Badge Count
A badge count is displayed for unread messages. To clear the badgecount the chats containing new messages must be opened
Group Chats
Groups can be defined and Messages sent to these groups
File Attachments
File attachments can be added to chat messages

The Badge Count

The Badge Count on the Chat App inside myApps is used to indicate the number of unread incoming chat messages. A chat message is considered read if the chat discussion is already open and the input field for a new message has the focus when the chat message arrives or if the chat discussion is opened. If a discussion inside the Chat App is opened all messages of this discussion are considered read. If the Chat App is opened, but the discussion with unread messages is not opened, the badge count will not be reset to make sure this message is not overlooked. These rules result in the following sequences, when a chat message arrives:

Chat App closed
The Chat App is loaded (if set as default chat app) and a badge count is set. When the Chat App is opened a badge count is displayed at the respective discussion. The badge count is cleared when the chat app and the respective discussion inside the chat app is opened.
The Chat App is opened with a different dicussion
A badge count is set at the Chat App and at the respective discussion. The badge count is cleared when the discussion is opened.
The Chat App is opened with the same discussion but message input does not have focus
Badge Count is set at the Chat App and at the discussion. The badge count is reset as soon as the message input gets the focus
The Chat App is opened with the same discussion and message input has focus
No badge count is set
Chat message is read on a different device
Badge count is reset on Chat App and on the respective discussion

Technical Details

Client APIs

The client uses published PBX APIs to provide the service.

This is the API for signaling using Websocket/Json protocol. The Chat App uses the flag 'NO_MEDIA_CALL' when doing the register, so that no media call is sent to the Chat App. To mark a call as instant messaging call the facility 'im_setup' is used. Messages are transfered with the facility 'im_message'
This API provides access to an external Messages App Service. If a chat licenses is assigned to the user, the Chat App established a Session on the PbxMessages API.

API of Messages App Service

The PBX Objekt Messages establishes a AppWebsocket connection to the external Messages App Service. Documeneted messages on this connection are used for the additional services.

File Attachments

To attach a files to a chat message, the client uses a method 'CreateFileBuffer' of 'PbxMessages' to create a temporariy buffer for a file in the Messages App Service. The file is sent via HTTP POST to this buffer and a URL to the file is included in the im_message facility. The recepient of the message can read the file from this buffer, if online while the message was sent. After the message was sent, the file attachments are copied into permanent buffers on the sender and on the received side. To access these buffers other URLs then the URLs for the temporariy buffers are used.

Text Format

The texts are sent as plain HTML coded as UTF-8. Plain HTML means that no attributes for HTML elements may be used. This is enforced by the PBX to make sure no malicious content can be sent. The styling of the HTML is up to the receiver of the message.

Tracing and logging

The following trace flags can be activated at Maintenance/Diagnostics/Tracing.

communication between the PBX and the myApps client
WebSocket communication between PBX and myAPPS client and also App Service. To enable this trace flag it's necessary to go to the debug.xml page.

Additionally, you can enable the following trace flags at the myApps client.

general information from the APP
Browser Console
information from the client/browser side.

In case we use the additional features with license, there is an APP called "Messages" at APP Platform and we can enable the following trace flags for the instance "messages".

general information from the APP Messages
information from APP database.
App Websocket
information from APP to PBX regarding websocket.
information of signalling between App Messages to PBX