IPCortex.PBX.Auth Object
Methods needed for logging in to the PBX. The Auth object holds the login authentication related methods.
Parameter |
Type |
Description |
options |
Object |
Valid attributes are: username , password , checkonly , subid (see link below for more detail) |
callback |
Function |
Called back to indicate success/failure as Function(Bool success, String message) |
Log out of PBX. This also stops the live data feed.
Parameter |
Type |
Description |
options |
Object |
(Optional) May set {logout: true} to include logout function |
This method tries to carry out a super-logout by combining the following:
- logout (if requested by setting
option = {logout: true}
)
- set chat offline
- save call history
- release the keevio phone password
The login mechanism will always isolate login sessions between discrete users of the API, so logging in to two API 'consumers' at the same time, but as different users, is both possible and automatic.
Because sessions are shared between browser tabs by default, if the same application is loaded twice, or if multiple applications are in fact loaded from the same source (eg. loaded from the PABX), then a clash may occur between these sessions. To work around this, it is possible to log in with a unique
subid
option when calling
IPCortex.PBX.Auth.login()
See Authentication discussion.
It may be that cross-tab sessions are desired, so this option is NOT enabled by default, but if required a subid
may be initialised by calling IPCortex.PBX.Auth.getSubID()
which generates, activates and returns a random session sub-ID. Assuming the browser in use supports session storage, calling this method multiple times per session will consistently return the same value.
SUMMARY: API Sessions loaded from the same server into a single browser will default to sharing their login session/context. If an application does not desire this behaviour, it may call IPCortex.PBX.Auth.getSubID()
before calling IPCortex.PBX.Auth.login()
which will isolate that 'tab' from other tabs.
If the API is running on one host and the PBX is separate, the API must be told how to access the PBX. Much of the time, this will happen automatically using the source of the original request for API files. In the exceptional case, this call can be used to override the target.
Parameter |
Type |
Description |
uri |
String |
For example: https://pabx.phone.voipcortex.co.uk |
Like IPCortex.PBX.Auth.setHost
above, but allows the WebSocket address for live feed data to be separate.
Parameter |
Type |
Description |
uri |
String |
For example: wss://pabx.phone.voipcortex.co.uk |
Kind: static method of
IPCortex.PBX.Auth
Returns:
Promise
- Resolves with requested data.
Reset (release and randomise) the keevio phone password.
Parameter |
Type |
Description |
[getnew] |
Bool |
Specify that you wish to be given the new password. The default is to 'give-up' the password. |
Sets the current company for a logged in user who can administer multiple companies.
Parameter |
Type |
Description |
company |
String |
The ID of the selected company. |
Parameter |
Type |
Description |
id |
null or Number |
The ID of the current user. |
name |
String |
The name of the current user. |
login |
String |
Login-id of the current user. |
home |
String |
The home-company of the current user. |
company |
String |
The currently selected company (defaulast to home company) |
companies |
Array |
Companies available to be selected by current user / admin companies |
container |
Array |
List of companies in the user's company's container. |
perms |
Object |
Leyed list of user's permissions. |