@twilio/voice-sdk
Version:
Twilio's JavaScript Voice SDK
996 lines • 97.3 kB
JavaScript
"use strict";
/* tslint:disable max-classes-per-file max-line-length */
/**
* @packageDocumentation
* @module Voice
* @internalapi
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.errorsByCode = exports.MediaErrors = exports.SignalingErrors = exports.UserMediaErrors = exports.MalformedRequestErrors = exports.GeneralErrors = exports.SIPServerErrors = exports.ClientErrors = exports.SignatureValidationErrors = exports.AuthorizationErrors = exports.TwilioError = void 0;
/**
* This is a generated file. Any modifications here will be overwritten. See scripts/errors.js.
*/
var twilioError_1 = require("./twilioError");
exports.TwilioError = twilioError_1.default;
var AuthorizationErrors;
(function (AuthorizationErrors) {
var AccessTokenInvalid = /** @class */ (function (_super) {
__extends(AccessTokenInvalid, _super);
function AccessTokenInvalid(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 20101;
_this.description = 'Invalid access token';
_this.explanation = 'Twilio was unable to validate your Access Token';
_this.name = 'AccessTokenInvalid';
_this.solutions = [];
Object.setPrototypeOf(_this, AuthorizationErrors.AccessTokenInvalid.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return AccessTokenInvalid;
}(twilioError_1.default));
AuthorizationErrors.AccessTokenInvalid = AccessTokenInvalid;
var AccessTokenExpired = /** @class */ (function (_super) {
__extends(AccessTokenExpired, _super);
function AccessTokenExpired(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 20104;
_this.description = 'Access token expired or expiration date invalid';
_this.explanation = 'The Access Token provided to the Twilio API has expired, the expiration time specified in the token was invalid, or the expiration time specified was too far in the future';
_this.name = 'AccessTokenExpired';
_this.solutions = [];
Object.setPrototypeOf(_this, AuthorizationErrors.AccessTokenExpired.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return AccessTokenExpired;
}(twilioError_1.default));
AuthorizationErrors.AccessTokenExpired = AccessTokenExpired;
var AuthenticationFailed = /** @class */ (function (_super) {
__extends(AuthenticationFailed, _super);
function AuthenticationFailed(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 20151;
_this.description = 'Authentication Failed';
_this.explanation = 'The Authentication with the provided JWT failed';
_this.name = 'AuthenticationFailed';
_this.solutions = [];
Object.setPrototypeOf(_this, AuthorizationErrors.AuthenticationFailed.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return AuthenticationFailed;
}(twilioError_1.default));
AuthorizationErrors.AuthenticationFailed = AuthenticationFailed;
})(AuthorizationErrors = exports.AuthorizationErrors || (exports.AuthorizationErrors = {}));
var SignatureValidationErrors;
(function (SignatureValidationErrors) {
var AccessTokenSignatureValidationFailed = /** @class */ (function (_super) {
__extends(AccessTokenSignatureValidationFailed, _super);
function AccessTokenSignatureValidationFailed(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'The access token has an invalid Account SID, API Key, or API Key Secret.',
];
_this.code = 31202;
_this.description = 'Signature validation failed.';
_this.explanation = 'The provided access token failed signature validation.';
_this.name = 'AccessTokenSignatureValidationFailed';
_this.solutions = [
'Ensure the Account SID, API Key, and API Key Secret are valid when generating your access token.',
];
Object.setPrototypeOf(_this, SignatureValidationErrors.AccessTokenSignatureValidationFailed.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return AccessTokenSignatureValidationFailed;
}(twilioError_1.default));
SignatureValidationErrors.AccessTokenSignatureValidationFailed = AccessTokenSignatureValidationFailed;
})(SignatureValidationErrors = exports.SignatureValidationErrors || (exports.SignatureValidationErrors = {}));
var ClientErrors;
(function (ClientErrors) {
var BadRequest = /** @class */ (function (_super) {
__extends(BadRequest, _super);
function BadRequest(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31400;
_this.description = 'Bad Request (HTTP/SIP)';
_this.explanation = 'The request could not be understood due to malformed syntax.';
_this.name = 'BadRequest';
_this.solutions = [];
Object.setPrototypeOf(_this, ClientErrors.BadRequest.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return BadRequest;
}(twilioError_1.default));
ClientErrors.BadRequest = BadRequest;
var NotFound = /** @class */ (function (_super) {
__extends(NotFound, _super);
function NotFound(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'The outbound call was made to an invalid phone number.',
'The TwiML application sid is missing a Voice URL.',
];
_this.code = 31404;
_this.description = 'Not Found (HTTP/SIP)';
_this.explanation = 'The server has not found anything matching the request.';
_this.name = 'NotFound';
_this.solutions = [
'Ensure the phone number dialed is valid.',
'Ensure the TwiML application is configured correctly with a Voice URL link.',
];
Object.setPrototypeOf(_this, ClientErrors.NotFound.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return NotFound;
}(twilioError_1.default));
ClientErrors.NotFound = NotFound;
var TemporarilyUnavailable = /** @class */ (function (_super) {
__extends(TemporarilyUnavailable, _super);
function TemporarilyUnavailable(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31480;
_this.description = 'Temporarily Unavailable (SIP)';
_this.explanation = 'The callee is currently unavailable.';
_this.name = 'TemporarilyUnavailable';
_this.solutions = [];
Object.setPrototypeOf(_this, ClientErrors.TemporarilyUnavailable.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return TemporarilyUnavailable;
}(twilioError_1.default));
ClientErrors.TemporarilyUnavailable = TemporarilyUnavailable;
var BusyHere = /** @class */ (function (_super) {
__extends(BusyHere, _super);
function BusyHere(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31486;
_this.description = 'Busy Here (SIP)';
_this.explanation = 'The callee is busy.';
_this.name = 'BusyHere';
_this.solutions = [];
Object.setPrototypeOf(_this, ClientErrors.BusyHere.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return BusyHere;
}(twilioError_1.default));
ClientErrors.BusyHere = BusyHere;
})(ClientErrors = exports.ClientErrors || (exports.ClientErrors = {}));
var SIPServerErrors;
(function (SIPServerErrors) {
var Decline = /** @class */ (function (_super) {
__extends(Decline, _super);
function Decline(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31603;
_this.description = 'Decline (SIP)';
_this.explanation = 'The callee does not wish to participate in the call.';
_this.name = 'Decline';
_this.solutions = [];
Object.setPrototypeOf(_this, SIPServerErrors.Decline.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return Decline;
}(twilioError_1.default));
SIPServerErrors.Decline = Decline;
})(SIPServerErrors = exports.SIPServerErrors || (exports.SIPServerErrors = {}));
var GeneralErrors;
(function (GeneralErrors) {
var UnknownError = /** @class */ (function (_super) {
__extends(UnknownError, _super);
function UnknownError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31000;
_this.description = 'Unknown Error';
_this.explanation = 'An unknown error has occurred. See error details for more information.';
_this.name = 'UnknownError';
_this.solutions = [];
Object.setPrototypeOf(_this, GeneralErrors.UnknownError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return UnknownError;
}(twilioError_1.default));
GeneralErrors.UnknownError = UnknownError;
var ApplicationNotFoundError = /** @class */ (function (_super) {
__extends(ApplicationNotFoundError, _super);
function ApplicationNotFoundError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31001;
_this.description = 'Application Not Found';
_this.explanation = '';
_this.name = 'ApplicationNotFoundError';
_this.solutions = [];
Object.setPrototypeOf(_this, GeneralErrors.ApplicationNotFoundError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return ApplicationNotFoundError;
}(twilioError_1.default));
GeneralErrors.ApplicationNotFoundError = ApplicationNotFoundError;
var ConnectionDeclinedError = /** @class */ (function (_super) {
__extends(ConnectionDeclinedError, _super);
function ConnectionDeclinedError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31002;
_this.description = 'Connection Declined';
_this.explanation = '';
_this.name = 'ConnectionDeclinedError';
_this.solutions = [];
Object.setPrototypeOf(_this, GeneralErrors.ConnectionDeclinedError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return ConnectionDeclinedError;
}(twilioError_1.default));
GeneralErrors.ConnectionDeclinedError = ConnectionDeclinedError;
var ConnectionTimeoutError = /** @class */ (function (_super) {
__extends(ConnectionTimeoutError, _super);
function ConnectionTimeoutError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31003;
_this.description = 'Connection Timeout';
_this.explanation = 'The server could not produce a response within a suitable amount of time.';
_this.name = 'ConnectionTimeoutError';
_this.solutions = [];
Object.setPrototypeOf(_this, GeneralErrors.ConnectionTimeoutError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return ConnectionTimeoutError;
}(twilioError_1.default));
GeneralErrors.ConnectionTimeoutError = ConnectionTimeoutError;
var ConnectionError = /** @class */ (function (_super) {
__extends(ConnectionError, _super);
function ConnectionError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31005;
_this.description = 'Connection error';
_this.explanation = 'A connection error occurred during the call';
_this.name = 'ConnectionError';
_this.solutions = [];
Object.setPrototypeOf(_this, GeneralErrors.ConnectionError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return ConnectionError;
}(twilioError_1.default));
GeneralErrors.ConnectionError = ConnectionError;
var CallCancelledError = /** @class */ (function (_super) {
__extends(CallCancelledError, _super);
function CallCancelledError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'The incoming call was cancelled because it was not answered in time or it was accepted/rejected by another application instance registered with the same identity.',
];
_this.code = 31008;
_this.description = 'Call cancelled';
_this.explanation = 'Unable to answer because the call has ended';
_this.name = 'CallCancelledError';
_this.solutions = [];
Object.setPrototypeOf(_this, GeneralErrors.CallCancelledError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return CallCancelledError;
}(twilioError_1.default));
GeneralErrors.CallCancelledError = CallCancelledError;
var TransportError = /** @class */ (function (_super) {
__extends(TransportError, _super);
function TransportError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31009;
_this.description = 'Transport error';
_this.explanation = 'No transport available to send or receive messages';
_this.name = 'TransportError';
_this.solutions = [];
Object.setPrototypeOf(_this, GeneralErrors.TransportError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return TransportError;
}(twilioError_1.default));
GeneralErrors.TransportError = TransportError;
})(GeneralErrors = exports.GeneralErrors || (exports.GeneralErrors = {}));
var MalformedRequestErrors;
(function (MalformedRequestErrors) {
var MalformedRequestError = /** @class */ (function (_super) {
__extends(MalformedRequestError, _super);
function MalformedRequestError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'Invalid content or MessageType passed to sendMessage method.',
];
_this.code = 31100;
_this.description = 'The request had malformed syntax.';
_this.explanation = 'The request could not be understood due to malformed syntax.';
_this.name = 'MalformedRequestError';
_this.solutions = [
'Ensure content and MessageType passed to sendMessage method are valid.',
];
Object.setPrototypeOf(_this, MalformedRequestErrors.MalformedRequestError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return MalformedRequestError;
}(twilioError_1.default));
MalformedRequestErrors.MalformedRequestError = MalformedRequestError;
var MissingParameterArrayError = /** @class */ (function (_super) {
__extends(MissingParameterArrayError, _super);
function MissingParameterArrayError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31101;
_this.description = 'Missing parameter array in request';
_this.explanation = '';
_this.name = 'MissingParameterArrayError';
_this.solutions = [];
Object.setPrototypeOf(_this, MalformedRequestErrors.MissingParameterArrayError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return MissingParameterArrayError;
}(twilioError_1.default));
MalformedRequestErrors.MissingParameterArrayError = MissingParameterArrayError;
var AuthorizationTokenMissingError = /** @class */ (function (_super) {
__extends(AuthorizationTokenMissingError, _super);
function AuthorizationTokenMissingError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31102;
_this.description = 'Authorization token missing in request.';
_this.explanation = '';
_this.name = 'AuthorizationTokenMissingError';
_this.solutions = [];
Object.setPrototypeOf(_this, MalformedRequestErrors.AuthorizationTokenMissingError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return AuthorizationTokenMissingError;
}(twilioError_1.default));
MalformedRequestErrors.AuthorizationTokenMissingError = AuthorizationTokenMissingError;
var MaxParameterLengthExceededError = /** @class */ (function (_super) {
__extends(MaxParameterLengthExceededError, _super);
function MaxParameterLengthExceededError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31103;
_this.description = 'Maximum parameter length has been exceeded.';
_this.explanation = 'Length of parameters cannot exceed MAX_PARAM_LENGTH.';
_this.name = 'MaxParameterLengthExceededError';
_this.solutions = [];
Object.setPrototypeOf(_this, MalformedRequestErrors.MaxParameterLengthExceededError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return MaxParameterLengthExceededError;
}(twilioError_1.default));
MalformedRequestErrors.MaxParameterLengthExceededError = MaxParameterLengthExceededError;
var InvalidBridgeTokenError = /** @class */ (function (_super) {
__extends(InvalidBridgeTokenError, _super);
function InvalidBridgeTokenError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31104;
_this.description = 'Invalid bridge token';
_this.explanation = '';
_this.name = 'InvalidBridgeTokenError';
_this.solutions = [];
Object.setPrototypeOf(_this, MalformedRequestErrors.InvalidBridgeTokenError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return InvalidBridgeTokenError;
}(twilioError_1.default));
MalformedRequestErrors.InvalidBridgeTokenError = InvalidBridgeTokenError;
var InvalidClientNameError = /** @class */ (function (_super) {
__extends(InvalidClientNameError, _super);
function InvalidClientNameError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'Client name contains invalid characters.',
];
_this.code = 31105;
_this.description = 'Invalid client name';
_this.explanation = 'Client name should not contain control, space, delims, or unwise characters.';
_this.name = 'InvalidClientNameError';
_this.solutions = [
'Make sure that client name does not contain any of the invalid characters.',
];
Object.setPrototypeOf(_this, MalformedRequestErrors.InvalidClientNameError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return InvalidClientNameError;
}(twilioError_1.default));
MalformedRequestErrors.InvalidClientNameError = InvalidClientNameError;
var ReconnectParameterInvalidError = /** @class */ (function (_super) {
__extends(ReconnectParameterInvalidError, _super);
function ReconnectParameterInvalidError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31107;
_this.description = 'The reconnect parameter is invalid';
_this.explanation = '';
_this.name = 'ReconnectParameterInvalidError';
_this.solutions = [];
Object.setPrototypeOf(_this, MalformedRequestErrors.ReconnectParameterInvalidError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return ReconnectParameterInvalidError;
}(twilioError_1.default));
MalformedRequestErrors.ReconnectParameterInvalidError = ReconnectParameterInvalidError;
})(MalformedRequestErrors = exports.MalformedRequestErrors || (exports.MalformedRequestErrors = {}));
(function (AuthorizationErrors) {
var AuthorizationError = /** @class */ (function (_super) {
__extends(AuthorizationError, _super);
function AuthorizationError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31201;
_this.description = 'Authorization error';
_this.explanation = 'The request requires user authentication. The server understood the request, but is refusing to fulfill it.';
_this.name = 'AuthorizationError';
_this.solutions = [];
Object.setPrototypeOf(_this, AuthorizationErrors.AuthorizationError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return AuthorizationError;
}(twilioError_1.default));
AuthorizationErrors.AuthorizationError = AuthorizationError;
var NoValidAccountError = /** @class */ (function (_super) {
__extends(NoValidAccountError, _super);
function NoValidAccountError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31203;
_this.description = 'No valid account';
_this.explanation = '';
_this.name = 'NoValidAccountError';
_this.solutions = [];
Object.setPrototypeOf(_this, AuthorizationErrors.NoValidAccountError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return NoValidAccountError;
}(twilioError_1.default));
AuthorizationErrors.NoValidAccountError = NoValidAccountError;
var InvalidJWTTokenError = /** @class */ (function (_super) {
__extends(InvalidJWTTokenError, _super);
function InvalidJWTTokenError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31204;
_this.description = 'Invalid JWT token';
_this.explanation = '';
_this.name = 'InvalidJWTTokenError';
_this.solutions = [];
Object.setPrototypeOf(_this, AuthorizationErrors.InvalidJWTTokenError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return InvalidJWTTokenError;
}(twilioError_1.default));
AuthorizationErrors.InvalidJWTTokenError = InvalidJWTTokenError;
var JWTTokenExpiredError = /** @class */ (function (_super) {
__extends(JWTTokenExpiredError, _super);
function JWTTokenExpiredError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31205;
_this.description = 'JWT token expired';
_this.explanation = '';
_this.name = 'JWTTokenExpiredError';
_this.solutions = [];
Object.setPrototypeOf(_this, AuthorizationErrors.JWTTokenExpiredError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return JWTTokenExpiredError;
}(twilioError_1.default));
AuthorizationErrors.JWTTokenExpiredError = JWTTokenExpiredError;
var RateExceededError = /** @class */ (function (_super) {
__extends(RateExceededError, _super);
function RateExceededError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'Rate limit exceeded.',
];
_this.code = 31206;
_this.description = 'Rate exceeded authorized limit.';
_this.explanation = 'The request performed exceeds the authorized limit.';
_this.name = 'RateExceededError';
_this.solutions = [
'Ensure message send rate does not exceed authorized limits.',
];
Object.setPrototypeOf(_this, AuthorizationErrors.RateExceededError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return RateExceededError;
}(twilioError_1.default));
AuthorizationErrors.RateExceededError = RateExceededError;
var JWTTokenExpirationTooLongError = /** @class */ (function (_super) {
__extends(JWTTokenExpirationTooLongError, _super);
function JWTTokenExpirationTooLongError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31207;
_this.description = 'JWT token expiration too long';
_this.explanation = '';
_this.name = 'JWTTokenExpirationTooLongError';
_this.solutions = [];
Object.setPrototypeOf(_this, AuthorizationErrors.JWTTokenExpirationTooLongError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return JWTTokenExpirationTooLongError;
}(twilioError_1.default));
AuthorizationErrors.JWTTokenExpirationTooLongError = JWTTokenExpirationTooLongError;
var ReconnectAttemptError = /** @class */ (function (_super) {
__extends(ReconnectAttemptError, _super);
function ReconnectAttemptError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 31209;
_this.description = 'Reconnect attempt is not authorized.';
_this.explanation = '';
_this.name = 'ReconnectAttemptError';
_this.solutions = [];
Object.setPrototypeOf(_this, AuthorizationErrors.ReconnectAttemptError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return ReconnectAttemptError;
}(twilioError_1.default));
AuthorizationErrors.ReconnectAttemptError = ReconnectAttemptError;
var CallMessageEventTypeInvalidError = /** @class */ (function (_super) {
__extends(CallMessageEventTypeInvalidError, _super);
function CallMessageEventTypeInvalidError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'The Call Message Event Type is invalid and is not understood by Twilio Voice.',
];
_this.code = 31210;
_this.description = 'Call Message Event Type is invalid.';
_this.explanation = 'The Call Message Event Type is invalid and is not understood by Twilio Voice.';
_this.name = 'CallMessageEventTypeInvalidError';
_this.solutions = [
'Ensure the Call Message Event Type is Valid and understood by Twilio Voice and try again.',
];
Object.setPrototypeOf(_this, AuthorizationErrors.CallMessageEventTypeInvalidError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return CallMessageEventTypeInvalidError;
}(twilioError_1.default));
AuthorizationErrors.CallMessageEventTypeInvalidError = CallMessageEventTypeInvalidError;
var PayloadSizeExceededError = /** @class */ (function (_super) {
__extends(PayloadSizeExceededError, _super);
function PayloadSizeExceededError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'The payload size of Call Message Event exceeds the authorized limit.',
];
_this.code = 31212;
_this.description = 'Call Message Event Payload size exceeded authorized limit.';
_this.explanation = 'The request performed to send a Call Message Event exceeds the payload size authorized limit';
_this.name = 'PayloadSizeExceededError';
_this.solutions = [
'Reduce payload size of Call Message Event to be within the authorized limit and try again.',
];
Object.setPrototypeOf(_this, AuthorizationErrors.PayloadSizeExceededError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return PayloadSizeExceededError;
}(twilioError_1.default));
AuthorizationErrors.PayloadSizeExceededError = PayloadSizeExceededError;
})(AuthorizationErrors = exports.AuthorizationErrors || (exports.AuthorizationErrors = {}));
var UserMediaErrors;
(function (UserMediaErrors) {
var PermissionDeniedError = /** @class */ (function (_super) {
__extends(PermissionDeniedError, _super);
function PermissionDeniedError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'The user denied the getUserMedia request.',
'The browser denied the getUserMedia request.',
];
_this.code = 31401;
_this.description = 'UserMedia Permission Denied Error';
_this.explanation = 'The browser or end-user denied permissions to user media. Therefore we were unable to acquire input audio.';
_this.name = 'PermissionDeniedError';
_this.solutions = [
'The user should accept the request next time prompted. If the browser saved the deny, the user should change that permission in their browser.',
'The user should to verify that the browser has permission to access the microphone at this address.',
];
Object.setPrototypeOf(_this, UserMediaErrors.PermissionDeniedError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return PermissionDeniedError;
}(twilioError_1.default));
UserMediaErrors.PermissionDeniedError = PermissionDeniedError;
var AcquisitionFailedError = /** @class */ (function (_super) {
__extends(AcquisitionFailedError, _super);
function AcquisitionFailedError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'NotFoundError - The deviceID specified was not found.',
'The getUserMedia constraints were overconstrained and no devices matched.',
];
_this.code = 31402;
_this.description = 'UserMedia Acquisition Failed Error';
_this.explanation = 'The browser and end-user allowed permissions, however getting the media failed. Usually this is due to bad constraints, but can sometimes fail due to browser, OS or hardware issues.';
_this.name = 'AcquisitionFailedError';
_this.solutions = [
'Ensure the deviceID being specified exists.',
'Try acquiring media with fewer constraints.',
];
Object.setPrototypeOf(_this, UserMediaErrors.AcquisitionFailedError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return AcquisitionFailedError;
}(twilioError_1.default));
UserMediaErrors.AcquisitionFailedError = AcquisitionFailedError;
})(UserMediaErrors = exports.UserMediaErrors || (exports.UserMediaErrors = {}));
var SignalingErrors;
(function (SignalingErrors) {
var ConnectionError = /** @class */ (function (_super) {
__extends(ConnectionError, _super);
function ConnectionError(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [];
_this.code = 53000;
_this.description = 'Signaling connection error';
_this.explanation = 'Raised whenever a signaling connection error occurs that is not covered by a more specific error code.';
_this.name = 'ConnectionError';
_this.solutions = [];
Object.setPrototypeOf(_this, SignalingErrors.ConnectionError.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return ConnectionError;
}(twilioError_1.default));
SignalingErrors.ConnectionError = ConnectionError;
var ConnectionDisconnected = /** @class */ (function (_super) {
__extends(ConnectionDisconnected, _super);
function ConnectionDisconnected(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'The device running your application lost its Internet connection.',
];
_this.code = 53001;
_this.description = 'Signaling connection disconnected';
_this.explanation = 'Raised whenever the signaling connection is unexpectedly disconnected.';
_this.name = 'ConnectionDisconnected';
_this.solutions = [
'Ensure the device running your application has access to a stable Internet connection.',
];
Object.setPrototypeOf(_this, SignalingErrors.ConnectionDisconnected.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return ConnectionDisconnected;
}(twilioError_1.default));
SignalingErrors.ConnectionDisconnected = ConnectionDisconnected;
})(SignalingErrors = exports.SignalingErrors || (exports.SignalingErrors = {}));
var MediaErrors;
(function (MediaErrors) {
var ClientLocalDescFailed = /** @class */ (function (_super) {
__extends(ClientLocalDescFailed, _super);
function ClientLocalDescFailed(messageOrError, error) {
var _this = _super.call(this, messageOrError, error) || this;
_this.causes = [
'The Client may not be using a supported WebRTC implementation.',
'The Client may not have the necessary resources to create or apply a new media description.',
];
_this.code = 53400;
_this.description = 'Client is unable to create or apply a local media description';
_this.explanation = 'Raised whenever a Client is unable to create or apply a local media description.';
_this.name = 'ClientLocalDescFailed';
_this.solutions = [
'If you are experiencing this error using the JavaScript SDK, ensure you are running it with a supported WebRTC implementation.',
];
Object.setPrototypeOf(_this, MediaErrors.ClientLocalDescFailed.prototype);
var message = typeof messageOrError === 'string'
? messageOrError
: _this.explanation;
var originalError = typeof messageOrError === 'object'
? messageOrError
: error;
_this.message = _this.name + " (" + _this.code + "): " + message;
_this.originalError = originalError;
return _this;
}
return ClientLocalDescFailed;
}(twilioError_1.default));
MediaErrors.ClientLocalDescFailed = ClientLocalDescFailed