API Version: Development

IPCortex.Types.Address

An Address instance represents one of a PABX user, an address book name/number or an external XMPP user. It tracks "call-ability" and “chat-ability” of each addressbook entity.
An Address instance is a "super-contact" which hides the relaite complexities of the different contact types from the API user. An Address will be one of:
  • A Contact - which is a PABX user which must have an extension number, and probably has a phone associated. The extension number and the state of the Contact's phone(s) will determine callability.
  • An Xmpp instance - a special type of addressbook entry which represents an external Xmpp user. Incidentally, each internal PABX user will have an Xmpp instance assigned to then to represent their Chat Presence status - This is similarly hidden.
  • A plain Address - will have only a name and a Number, and are collected from various personal addressbooks, company addressbooks and CSV uploads on the PABX.
  • A keevio Address - The same as a plain Address, but has been created via the API, so may be edited via the API.
All Address types should be queryable for callability, chatability, presence state and BLF state, and will return an appropriate value regardless of the underlying contact type.
Due to the system load involved in collecting sending and aggregating these Address objects, they are enabled separately with IPCortex.PBX.getAddressbook()

Properties

Name Type Description
name String Friendly name/label.
number String Contact number.
group String System determined 'group' that this address is in
  • system - Auto generated from extensions
  • company - Per company address entries
  • personal - User address entries
email String Email address or empty string if not set.
key String Unique identifer, mainly used for addition and removal.
isMe Boolean True if the address is the logged-in user.
canCall Boolean True if the address is callable.
canChat Boolean True if the address is online for chat.
canEdit Boolean True if the address is editable using the edit() method.
canTag Boolean True if the address allows its tags to be edited by the current user.
chatID String Unique identifier for matching with room members, xmpp ID or contact ID.
tags Array A (possibly empty) list of tags for this address, or null if the contact cannot be tagged
states Object A keyed-list of states by online resources. An address may be online in multiple places (eg. xmpp + keevio) and may have several levels of online/offline states as a result. This objects represents all of those states. The object key is the unique id ('resource') of the remote connection.
show String Addresses most online state. (determined from states)
  • online - Online
  • away - Online but set as 'Away'
  • dnd - Online but set as 'Do Not Disturb'
  • offline - Offline
blf Number This is a "Relevant" BLF value. Owned/WebRTC/Hotdesk phone state indication for a contact otherwise, extension number BLF where possible.
  • 0 - available
  • 1 - on call
  • 2 - ringing
  • 3 - on call and ringing
blfExt Number Extension number BLF where possible. Or falls back to blf property if not. 6.3+
  • 0 - available
  • 1 - on call
  • 2 - ringing
  • 3 - on call and ringing
blfAll Number Rolled-up call state indication, showing combination of blf and blfExt. 6.2.17+
  • 0 - available
  • 1 - on call
  • 2 - ringing
  • 3 - on call and ringing

Methods

address.dial(device, [callback]) ⇒ Promise

Kind: class method of IPCortex.Types.Address
Dial the number on this Address using Device of device. See the Device.dial() documentation for further detail or more advanced dial options.
Parameter Type Description
device Device Device to dial on.
Equivalent to device.dial(address, callback)

address.chat(callback) ⇒ Promise

Kind: class method of IPCortex.Types.Address
Returns: Promise
Open a chat room with the address.
Equivalent to using IPCortex.PBX.chatInvite(address, callback)

address.edit(fields, callback)

Kind: class method of IPCortex.Types.Address
Modify the address.

address.remove(callback)

Kind: class method of IPCortex.Types.Address
Remove the address entry. This only applies to non-system entries.

address.compare(Address)

Kind: class method of IPCortex.Types.Address
Compare two address entries.

address.sortFn(address) ⇒ Number(-1 | 0 | +1)

Kind: class method of IPCortex.Types.Address
Returns: -1, 0, +1 suitable for sort algorithms.
a.sortFn(b) returns values suitable for use in the JavaScript sort() method.
Parameter Type Description
address Address Address object to compare this to.

address.xmppReq()

Kind: class method of IPCortex.Types.Address
Request a chat relationship with the address.

address.xmppAuth()

Kind: class method of IPCortex.Types.Address
Accept a chat relationship request.

address.xmppDel()

Kind: class method of IPCortex.Types.Address
Remove a chat relationship.

address.photo(size) ⇒ Promise

address.photo(options) ⇒ Promise 6.4.21+

Kind: class method of IPCortex.Types.Address Returns: Promise
Fetch a profile picture.
Return a promise which always resolves to either an encoded PNG, suitable for insertion into an img src tag, or a placeholder SVG.
Requests to this method put a heavy load on the database, so are serialised and may be fulfilled slowly as a result. It is recommended that the return value should be cached for a while, and loaded/refreshed only at the point where it is needed.
Parameter Type Description
size Number (Optional) Size of image to retrieve - null for 128 pixel.
options Object May contain a size attribute. May contain and allownull bool to disable the placeholder image

address.addListener(event, callback)

Kind: class method of IPCortex.Types.Address
Add listener method, inherited from Api base class and common to all classes.
Parameter Type Description
event String Name of event, e.g. 'update'
callback Function Callback which is passed a reference to the updated Class object

address.removeListener(event, callback)

Kind: class method of IPCortex.Types.Address
Remove listener method, inherited from Api base class and common to all classes. event and callback must be identical to those used in addListener() in order for the remove to succeed.
Parameter Type Description
event String Name of event, e.g. 'update'
callback Function Callback which is passed a reference to the updated Class object

Events

  • new - A new address is created
  • update - The address, call, or IM state has changed.
  • delete - The address entry has been deleted.