PbxMessages

The PbxMessages protocol is available on AppWebsocket connections to innovaphone PBX objects, if the object is enabled for the PbxMessages api. It allows an application to send requests to the Messages instance, which is configured at the object.

These requests are forwarded to the Messages instance using the AppWebsocket connection which is established by the Messages PBX object to the Messages instance.

Chat applications may use this Api to connect to messages and read stored chat messages

General structure

{
    "api": "PbxMessages",
    "src": string,
    "mt": string,
}

api
To address this interface the value "PbxMessages" has tp be used for the api property
src
The AppWebsocket src mechanism is supported on the interface. So a src property may be used
mt
The message type identifies the requested operation

Any message with a "mt" property not being "Session" is forwarded to Messages, if a session is already established with the "Session" message. When the message is forwarded the following operations are performed on the message

Messages to the PBX Messages from the PBX

Session

{
    "api": "PbxMessages",
    "mt": "Session",
    "src": string,
    "flags": string
}

This message initiates a session to the messages instance. A unique session_id is generated on the PBX. In addition to the normal operations on messages a property "dn" is added for the display name of the object using this api and the message is forwarded to Messages.

SessionResult

{
    "api": "PbxMessages",
    "mt": "SessionResult",
    "src": string,
    "session": ulong64
}

Returns the session id

Error

{
    "api": "PbxMessages",
    "mt": "Error",
}

Indicates that an error happened and the session is not valid anymore. A new Session Message is needed to re-establish the session. A timeout before re-establishing the session is recommened, because Error may be sent as response to Session.