onServerError
Subscribe to any incoming server errors, which are global errors that usually affect the health of a whole system or a current agent authorization session. The list of known possible errors is described below.
Request
Syntax
| on('ON_SERVER_ERROR', handler: OnServerErrorHandler): void
type ServerErrorData = { code: ServerErrorCodes[keyof ServerErrorCodes] name: keyof ServerErrorCodes timestamp: number // Date.now() message?: string } type ServerErrorCodes = { forced_logout_by_other_client: 100 forced_logout_by_supervisor: 101 invalid_request: 102 phone_not_registered: 103 phone_not_in_dial_plan: 104 tenant_disabled: 105 destination_user_not_logged: 106 user_disabled_or_deleted: 107 user_already_logged_in: 108 invalid_credentials: 109 other_user_logged_with_phone: 110 invalid_token: 111 logged_users_limit_reached: 112 already_logged_in_with_the_same_session: 113 not_enough_privileges: 114 sip_server_error: 200 unknown_error: 300 } |
Parameters
| Parameter | Parameter Values | Data Type | Optional/Required | Description |
| errorData | ||||
| code | String | Required | The error code from the ServerErrorCodes object. | |
| name | String | Required | The error code name from the ServerErrorCodes object. | |
| timestamp | Number | Required | The timestamp from when the error message was received from server; uses the Date.now() method. | |
| message | String | Optional | The error text description |
Example Request
function serverErrorHandler(errorInfo: ServerErrorData) {
console.log("The error " + errorInfo.name + " occurred!");
}
adApi.on("ON_SERVER_ERROR", serverErrorHandler);
Return Value
(None)