Table of Contents
onAuthenticateFailed()
wrtc.onAuthenticateFailed() is an event function called when RTCgate or SIP authentication has failed.
You must write your own wrtc.onAuthenticateFailed() function to be able to inform user about authentication failure.
Arguments
wrtc.onAuthenticateFailed(obj, err)
- obj - line object that raised the event
- err - JSON structure containing information about the error:
- errorCode - error number
- errorMsg - string containing informative description of the error
| errorCode | errorMsg | Description: |
|---|---|---|
| 423 | "expired" | REST authentication token expired (wrtc_kit will now automatically try to fetch a new one) |
| 401 | "rejected (sub)" | authentication attempt rejected, sub indicates error subcode (see table below) |
| other error codes may also occur | ||
Error 401 subcodes:
| sub | Description: |
|---|---|
| 0 | rejected by SIP server (most probably dure incorrect password) |
| -1001 | REST token received but not REST token authentication mode |
| -1002 | REST token empty |
| -1003 | REST token wrong checksum |
| -1004 | REST token attempted to select disabled/illegal template |
| -1010 | websocket origin blocked by template (occurs after obj.authenticate()) |
| -1100 | websocket origin blocked by template (occurs after wrtc.changeCredentials()) |
| -1200 | no SIP address specified (no @ in wrtc.addressName) |
| -1201 | SIP address blocked by template |
| -1301 | disabled/illegal template number specified in wrtc.adv.template |
| -9999 | unspecified error |
| other error subcodes may also occur | |
Return value
Ignored.
Example
wrtc.onAuthenticateFailed = function(obj, err) {
window.alert("Authentication failed: " + err.errorCode + ": " + err.errorMsg);
}