Skip to content

Commit

Permalink
dist/ lib/ files for 0.13.1
Browse files Browse the repository at this point in the history
  • Loading branch information
James Criscuolo committed Feb 5, 2019
1 parent 0e3474a commit 4840ce6
Show file tree
Hide file tree
Showing 39 changed files with 76,932 additions and 0 deletions.
26,048 changes: 26,048 additions & 0 deletions dist/sip-0.13.1.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/sip-0.13.1.min.js

Large diffs are not rendered by default.

26,048 changes: 26,048 additions & 0 deletions dist/sip.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/sip.min.js

Large diffs are not rendered by default.

104 changes: 104 additions & 0 deletions lib/ClientContext.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
"use strict";
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 (b.hasOwnProperty(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 });
var events_1 = require("events");
var Constants_1 = require("./Constants");
var Enums_1 = require("./Enums");
var RequestSender_1 = require("./RequestSender");
var SIPMessage_1 = require("./SIPMessage");
var Utils_1 = require("./Utils");
var ClientContext = /** @class */ (function (_super) {
__extends(ClientContext, _super);
function ClientContext(ua, method, target, options) {
var _this = _super.call(this) || this;
_this.data = {};
ClientContext.initializer(_this, ua, method, target, options);
return _this;
}
ClientContext.initializer = function (objToConstruct, ua, method, originalTarget, options) {
objToConstruct.type = Enums_1.TypeStrings.ClientContext;
// Validate arguments
if (originalTarget === undefined) {
throw new TypeError("Not enough arguments");
}
objToConstruct.ua = ua;
objToConstruct.logger = ua.getLogger("sip.clientcontext");
objToConstruct.method = method;
var target = ua.normalizeTarget(originalTarget);
if (!target) {
throw new TypeError("Invalid target: " + originalTarget);
}
/* Options
* - extraHeaders
* - params
* - contentType
* - body
*/
options = Object.create(options || Object.prototype);
options.extraHeaders = (options.extraHeaders || []).slice();
// Build the request
objToConstruct.request = new SIPMessage_1.OutgoingRequest(objToConstruct.method, target, objToConstruct.ua, options.params, options.extraHeaders);
if (options.body) {
objToConstruct.body = {};
objToConstruct.body.body = options.body;
if (options.contentType) {
objToConstruct.body.contentType = options.contentType;
}
objToConstruct.request.body = objToConstruct.body;
}
/* Set other properties from the request */
if (objToConstruct.request.from) {
objToConstruct.localIdentity = objToConstruct.request.from;
}
if (objToConstruct.request.to) {
objToConstruct.remoteIdentity = objToConstruct.request.to;
}
};
ClientContext.prototype.send = function () {
var sender = new RequestSender_1.RequestSender(this, this.ua);
sender.send();
return this;
};
ClientContext.prototype.receiveResponse = function (response) {
var statusCode = response.statusCode || 0;
var cause = Utils_1.Utils.getReasonPhrase(statusCode);
switch (true) {
case /^1[0-9]{2}$/.test(statusCode.toString()):
this.emit("progress", response, cause);
break;
case /^2[0-9]{2}$/.test(statusCode.toString()):
if (this.ua.applicants[this.toString()]) {
delete this.ua.applicants[this.toString()];
}
this.emit("accepted", response, cause);
break;
default:
if (this.ua.applicants[this.toString()]) {
delete this.ua.applicants[this.toString()];
}
this.emit("rejected", response, cause);
this.emit("failed", response, cause);
break;
}
};
ClientContext.prototype.onRequestTimeout = function () {
this.emit("failed", undefined, Constants_1.C.causes.REQUEST_TIMEOUT);
};
ClientContext.prototype.onTransportError = function () {
this.emit("failed", undefined, Constants_1.C.causes.CONNECTION_ERROR);
};
return ClientContext;
}(events_1.EventEmitter));
exports.ClientContext = ClientContext;
192 changes: 192 additions & 0 deletions lib/Constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// tslint:disable-next-line:no-var-requires
var pkg = require("../package.json");
var C;
(function (C) {
C.USER_AGENT = pkg.title + "/" + pkg.version;
// SIP scheme
C.SIP = "sip";
C.SIPS = "sips";
// End and Failure causes
var causes;
(function (causes) {
// Generic error causes
causes["CONNECTION_ERROR"] = "Connection Error";
causes["INTERNAL_ERROR"] = "Internal Error";
causes["REQUEST_TIMEOUT"] = "Request Timeout";
causes["SIP_FAILURE_CODE"] = "SIP Failure Code";
// SIP error causes
causes["ADDRESS_INCOMPLETE"] = "Address Incomplete";
causes["AUTHENTICATION_ERROR"] = "Authentication Error";
causes["BUSY"] = "Busy";
causes["DIALOG_ERROR"] = "Dialog Error";
causes["INCOMPATIBLE_SDP"] = "Incompatible SDP";
causes["NOT_FOUND"] = "Not Found";
causes["REDIRECTED"] = "Redirected";
causes["REJECTED"] = "Rejected";
causes["UNAVAILABLE"] = "Unavailable";
// Session error causes
causes["BAD_MEDIA_DESCRIPTION"] = "Bad Media Description";
causes["CANCELED"] = "Canceled";
causes["EXPIRES"] = "Expires";
causes["NO_ACK"] = "No ACK";
causes["NO_ANSWER"] = "No Answer";
causes["NO_PRACK"] = "No PRACK";
causes["RTP_TIMEOUT"] = "RTP Timeout";
causes["USER_DENIED_MEDIA_ACCESS"] = "User Denied Media Access";
causes["WEBRTC_ERROR"] = "WebRTC Error";
causes["WEBRTC_NOT_SUPPORTED"] = "WebRTC Not Supported";
})(causes = C.causes || (C.causes = {}));
var supported;
(function (supported) {
supported["REQUIRED"] = "required";
supported["SUPPORTED"] = "supported";
supported["UNSUPPORTED"] = "none";
})(supported = C.supported || (C.supported = {}));
C.SIP_ERROR_CAUSES = {
ADDRESS_INCOMPLETE: [484],
AUTHENTICATION_ERROR: [401, 407],
BUSY: [486, 600],
INCOMPATIBLE_SDP: [488, 606],
NOT_FOUND: [404, 604],
REDIRECTED: [300, 301, 302, 305, 380],
REJECTED: [403, 603],
UNAVAILABLE: [480, 410, 408, 430]
};
// SIP Methods
C.ACK = "ACK";
C.BYE = "BYE";
C.CANCEL = "CANCEL";
C.INFO = "INFO";
C.INVITE = "INVITE";
C.MESSAGE = "MESSAGE";
C.NOTIFY = "NOTIFY";
C.OPTIONS = "OPTIONS";
C.REGISTER = "REGISTER";
C.UPDATE = "UPDATE";
C.SUBSCRIBE = "SUBSCRIBE";
C.PUBLISH = "PUBLISH";
C.REFER = "REFER";
C.PRACK = "PRACK";
/* SIP Response Reasons
* DOC: http://www.iana.org/assignments/sip-parameters
* Copied from https://github.com/versatica/OverSIP/blob/master/lib/oversip/sip/constants.rb#L7
*/
C.REASON_PHRASE = {
100: "Trying",
180: "Ringing",
181: "Call Is Being Forwarded",
182: "Queued",
183: "Session Progress",
199: "Early Dialog Terminated",
200: "OK",
202: "Accepted",
204: "No Notification",
300: "Multiple Choices",
301: "Moved Permanently",
302: "Moved Temporarily",
305: "Use Proxy",
380: "Alternative Service",
400: "Bad Request",
401: "Unauthorized",
402: "Payment Required",
403: "Forbidden",
404: "Not Found",
405: "Method Not Allowed",
406: "Not Acceptable",
407: "Proxy Authentication Required",
408: "Request Timeout",
410: "Gone",
412: "Conditional Request Failed",
413: "Request Entity Too Large",
414: "Request-URI Too Long",
415: "Unsupported Media Type",
416: "Unsupported URI Scheme",
417: "Unknown Resource-Priority",
420: "Bad Extension",
421: "Extension Required",
422: "Session Interval Too Small",
423: "Interval Too Brief",
428: "Use Identity Header",
429: "Provide Referrer Identity",
430: "Flow Failed",
433: "Anonymity Disallowed",
436: "Bad Identity-Info",
437: "Unsupported Certificate",
438: "Invalid Identity Header",
439: "First Hop Lacks Outbound Support",
440: "Max-Breadth Exceeded",
469: "Bad Info Package",
470: "Consent Needed",
478: "Unresolvable Destination",
480: "Temporarily Unavailable",
481: "Call/Transaction Does Not Exist",
482: "Loop Detected",
483: "Too Many Hops",
484: "Address Incomplete",
485: "Ambiguous",
486: "Busy Here",
487: "Request Terminated",
488: "Not Acceptable Here",
489: "Bad Event",
491: "Request Pending",
493: "Undecipherable",
494: "Security Agreement Required",
500: "Internal Server Error",
501: "Not Implemented",
502: "Bad Gateway",
503: "Service Unavailable",
504: "Server Time-out",
505: "Version Not Supported",
513: "Message Too Large",
580: "Precondition Failure",
600: "Busy Everywhere",
603: "Decline",
604: "Does Not Exist Anywhere",
606: "Not Acceptable"
};
/* SIP Option Tags
* DOC: http://www.iana.org/assignments/sip-parameters/sip-parameters.xhtml#sip-parameters-4
*/
C.OPTION_TAGS = {
"100rel": true,
"199": true,
"answermode": true,
"early-session": true,
"eventlist": true,
"explicitsub": true,
"from-change": true,
"geolocation-http": true,
"geolocation-sip": true,
"gin": true,
"gruu": true,
"histinfo": true,
"ice": true,
"join": true,
"multiple-refer": true,
"norefersub": true,
"nosub": true,
"outbound": true,
"path": true,
"policy": true,
"precondition": true,
"pref": true,
"privacy": true,
"recipient-list-invite": true,
"recipient-list-message": true,
"recipient-list-subscribe": true,
"replaces": true,
"resource-priority": true,
"sdp-anat": true,
"sec-agree": true,
"tdialog": true,
"timer": true,
"uui": true // RFC 7433
};
var dtmfType;
(function (dtmfType) {
dtmfType["INFO"] = "info";
dtmfType["RTP"] = "rtp";
})(dtmfType = C.dtmfType || (C.dtmfType = {}));
})(C = exports.C || (exports.C = {}));
Loading

0 comments on commit 4840ce6

Please sign in to comment.