API Version: 6.5

IPCortex.PBX.Auth Object

Methods needed for logging in to the PBX. The Auth object holds the login authentication related methods.
Kind: static object IPCortex.PBX.Auth

IPCortex.PBX.Auth.login(options) ⇒ Promise

IPCortex.PBX.Auth.login(callback, options)

Kind: static method of IPCortex.PBX.Auth Returns: Promise - Resolves with no data.
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)
NOTE: See detailed page on Authentication which also mentions options

IPCortex.PBX.Auth.logout()

Kind: static method of IPCortex.PBX.Auth Returns: Promise - Resolves with no data.
Log out of PBX. This also stops the live data feed.

IPCortex.PBX.Auth.exit([options])

Kind: static method of IPCortex.PBX.Auth Returns: Promise - Resolves with no data.
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

IPCortex.PBX.Auth.getSubID()

Kind: static method of IPCortex.PBX.Auth Returns: String - A unique session sub-ID.
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.

IPCortex.PBX.Auth.setHost(uri)

Kind: static method of IPCortex.PBX.Auth Returns: Promise - Resolves with no data.
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

IPCortex.PBX.Auth.setWSHost(uri)

Kind: static method of IPCortex.PBX.Auth Returns: Promise - Resolves with no data.
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

IPCortex.PBX.Auth.rtcReset([getnew])

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.

IPCortex.PBX.Auth.selCompany(company)

Kind: static method of IPCortex.PBX.Auth Returns: Promise - Resolves with no data.
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.