IPCortex.PBX.Auth.getSubID()

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)

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.