API Version: Development

IPCortex.PBX Object

Kind: static object IPCortex.PBX
This is the top level container for PBX API methods.

Chat related operations

IPCortex.PBX.enableChat(roomCB, presenceCB, settings) ⇒ Bool

Kind: static method of IPCortex.PBX
Returns: Bool - Success/Failure indication.
A top-level switch to enable Chat Room functionality. This method specifies to the API the callback to use for new Room creation events.
Parameter Type Description
roomCB Function (Optional) Callback for each new Room object created. Function(Room).
presenceCB Function (Optional) Called back with an Xmpp object to show logged-in user state.
settings Object (Optional) default to {autoseen: true}
  • autoseen (Bool) - If true, messages are assumed 'seen' when delivered to this client.
  • archive (Bool) - If true, persistent or archive rooms are enabled and will be seen by this client.
  • public (Bool) -If true, public rooms are enabled and will be seen by this client.

IPCortex.PBX.disableChat() ⇒ Bool

Kind: static method of IPCortex.PBX
Returns: Bool - Success/Failure indication.
Disable Chat functionality and stop callbacks.

IPCortex.PBX.setStatus(show, status) ⇒ Promise

Kind: static method of IPCortex.PBX
Returns: Promise - Resolves with no data.
Set the chat status for the logged in user.
Parameter Type Description
show String One of online, away, xa, dnd
status String Descriptive text for status, eg. User set reason.

IPCortex.PBX.chatInvite(contacts, [options], [callback], [callback2]) ⇒ Promise

Kind: static method of IPCortex.PBX
Returns: Promise - Resolves to Room class instance.
Create a chat room with one or more parties.
Parameter Type Description
contacts Array Array of members to invite. Each contact is either the unique contact ID of an internal party, or an Object describing an external user. Each array element may also be an Address or Contact.
[options] Object (Optional) Options for initial room creation
  • roomName (String) - Initial name given to a room if it is a multi-room.
  • multi (Bool) - If this evaluates to true then start the room as a multiroom even for 2 members.
  • archive (Bool) - If true, the room's contents will be stored to the database. 6.3.20+
  • public (Bool) -If true, the room will be created public. This implies archive and multi.
[callback] Function (Optional) A standard success/fail callback, Function(Bool success, String reason)
[callback2] Function (Optional) An additional callback regarding success/fail of any external invites, it will be called with a result once for each contact invited, so for simplicity it is probably best to call this with only one invite at a time.Function(Bool success, String reason) 6.3.10+
Definition: external user
NOTE: See also the Room method Room.add() which is also Promise aware, to add additional contacts.
Example:
Invite userID 123, and an external person with a mobile number to a new chat room with 'me' the currently logged-in user. Assuming the SMS settings have been configured, an invite link will be sent to the mobile number.
IPCortex.PBX.chatInvite(
    [
        123,
        {
            name: "Mr External Name",
            mobile: "07000123456",
            invite: true
        }
    ]
).then(
    function(room) {
        /* The room may be used to carry out
         * more changes once the room is open.
         * There may be a delay before the room
         * object appears for the client.
         */
    }
);
To fetch users from a room once opened, including an access link for external users.
room.members returns:
{
	123: {
		state: "online",
		desc: "Online",
		email: "",
		name: "Miss Internal User",
		uname: "username"
	},
	64325: {
		state: "offline",
		desc: "Offline",
		email: "",
		name: Mr External Name"",
		uname: "paqwOCvQnwEDYEsPpxKrw2GCouauB8V",
		url: "https://pabx.hostname/keevio/x/?key=paqwOCvQnwEDYEsPpxKrw2GCouauB8V"
	}
}
Notice the relationship between the uname and url fields. The url field is useful only for keevio use.

IPCortex.PBX.createRoom(contacts, [options], [callback], [callback2]) ⇒ Promise

Kind: static method of IPCortex.PBX
Returns: Promise - Resolves to Room class instance.
Create a chat room with one or more parties. Unlike chatInvite(), createRoom() does not need to include the caller in the room as long as they have the api_chat action included in their user role (This is part of the core permission model, set by the system administrator). The list of users in the room will be validated based on the permissions of the creating user.
NOTE: If none of the invited users are online, then the room is likely to be destroyed instantly.
Parameter Type Description
contacts Array Array of members to invite. Each contact is either the unique contact ID of an internal party, or an Object describing an external user. Each array element may also be an Address or Contact.
[options] Object (Optional) Options for initial room creation
  • roomName (String) - Initial name given to a room if it is a multi-room.
  • multi (Bool) - Ignored, createRoom always creates multi-rooms.
  • archive (Bool) - If true, the room's contents will be stored to the database. 6.3.20+
[callback] Function (Optional) A standard success/fail callback, Function(Bool success, String reason)
[callback2] Function (Optional) An additional callback regarding success/fail of any external invites, it will be called with a result once for each contact invited, so for simplicity it is probably best to call this with only one invite at a time.Function(Bool success, String reason) 6.3.10+

IPCortex.PBX.joinRoom(roomID) ⇒ Promise

Kind: static method of IPCortex.PBX Returns: Promise - Resolves to Room class instance.
Reconnect to a room that the user has previously been joined to, but which they have left, or to a public room. Room IDs are typically be discovered using IPCortex.PBX.archiveRooms or IPCortex.PBX.publicRooms
Parameter Type Description
roomID Number The ID of the room to re-connect to.

IPCortex.PBX.enableFeature(featurename, callback, [transportList]) ⇒ null or Array

Kind: static method of IPCortex.PBX
Returns: null or Array of allowed transports.
Parameter Type Description
featurename String The name of the feature to enable.
callback Function Called whenever this feature is activated. eg. a file transfer. Function(Class)
[transportList] Array (Optional) A list of desired transports, or null for all.

IPCortex.PBX.disableFeature(featurename)

Kind: static method of IPCortex.PBX
Returns: null
Parameter Type Description
featurename String The name of the feature to enable.