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.
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. |
chatID |
String |
Unique identifier for matching with room members, xmpp ID or contact ID. |
states |
Object |
A keyed-list of
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 |
Owned/WebRTC phone state indication. - 0 - available
- 1 - on call
- 2 - ringing
- 3 - on call and ringing
|
Methods
address.dial(device, [callback])
Parameter |
Type |
Description |
device |
Device |
Device to dial on. |
Equivalent to device.dial(address, callback)
address.chat(callback) ⇒ Promise
Open a chat room with the address.
Equivalent to using IPCortex.PBX.chatInvite(address, callback)
address.edit(fields, callback)
Modify the address.
address.remove(callback)
Remove the address entry. This only applies to non-system entries.
address.compare(Address)
Compare two address entries.
address.sortFn(address) ⇒ Number(-1 | 0 | +1)
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()
Request a chat relationship with the address.
address.xmppAuth()
Accept a chat relationship request.
address.xmppDel()
Remove a chat relationship.
address.photo(size) ⇒ 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.
address.addListener(event, callback)
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)
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, aall, or IM state has changed.
- delete - The address entry has been deleted.