Skip to content

Commit

Permalink
dist/ lib/ files for 0.14.2
Browse files Browse the repository at this point in the history
  • Loading branch information
James Criscuolo committed Jun 4, 2019
1 parent a74efe2 commit 57e5bc6
Show file tree
Hide file tree
Showing 244 changed files with 62,811 additions and 0 deletions.
19,888 changes: 19,888 additions & 0 deletions dist/sip-0.14.2.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

19,888 changes: 19,888 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.

23 changes: 23 additions & 0 deletions lib/ClientContext.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/// <reference types="node" />
import { EventEmitter } from "events";
import { IncomingResponseMessage, Logger, NameAddrHeader, OutgoingRequestMessage, URI } from "./core";
import { TypeStrings } from "./Enums";
import { BodyObj } from "./session-description-handler";
import { UA } from "./UA";
export declare class ClientContext extends EventEmitter {
static initializer(objToConstruct: ClientContext, ua: UA, method: string, originalTarget: string | URI, options?: any): void;
type: TypeStrings;
data: any;
ua: UA;
logger: Logger;
request: OutgoingRequestMessage;
method: string;
body: BodyObj | undefined;
localIdentity: NameAddrHeader;
remoteIdentity: NameAddrHeader;
constructor(ua: UA, method: string, target: string | URI, options?: any);
send(): this;
receiveResponse(response: IncomingResponseMessage): void;
onRequestTimeout(): void;
onTransportError(): void;
}
101 changes: 101 additions & 0 deletions lib/ClientContext.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var events_1 = require("events");
var Constants_1 = require("./Constants");
var Enums_1 = require("./Enums");
var Utils_1 = require("./Utils");
var ClientContext = /** @class */ (function (_super) {
tslib_1.__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);
var extraHeaders = (options.extraHeaders || []).slice();
var params = options.params || {};
var bodyObj;
if (options.body) {
bodyObj = {
body: options.body,
contentType: options.contentType ? options.contentType : "application/sdp"
};
objToConstruct.body = bodyObj;
}
var body;
if (bodyObj) {
body = Utils_1.Utils.fromBodyObj(bodyObj);
}
// Build the request
objToConstruct.request = ua.userAgentCore.makeOutgoingRequestMessage(method, target, params.fromUri ? params.fromUri : ua.userAgentCore.configuration.aor, params.toUri ? params.toUri : target, params, extraHeaders, 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 _this = this;
this.ua.userAgentCore.request(this.request, {
onAccept: function (response) { return _this.receiveResponse(response.message); },
onProgress: function (response) { return _this.receiveResponse(response.message); },
onRedirect: function (response) { return _this.receiveResponse(response.message); },
onReject: function (response) { return _this.receiveResponse(response.message); },
onTrying: function (response) { return _this.receiveResponse(response.message); }
});
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;
62 changes: 62 additions & 0 deletions lib/Constants.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
export declare namespace C {
const USER_AGENT: string;
const SIP = "sip";
const SIPS = "sips";
enum causes {
CONNECTION_ERROR = "Connection Error",
INTERNAL_ERROR = "Internal Error",
REQUEST_TIMEOUT = "Request Timeout",
SIP_FAILURE_CODE = "SIP Failure Code",
ADDRESS_INCOMPLETE = "Address Incomplete",
AUTHENTICATION_ERROR = "Authentication Error",
BUSY = "Busy",
DIALOG_ERROR = "Dialog Error",
INCOMPATIBLE_SDP = "Incompatible SDP",
NOT_FOUND = "Not Found",
REDIRECTED = "Redirected",
REJECTED = "Rejected",
UNAVAILABLE = "Unavailable",
BAD_MEDIA_DESCRIPTION = "Bad Media Description",
CANCELED = "Canceled",
EXPIRES = "Expires",
NO_ACK = "No ACK",
NO_ANSWER = "No Answer",
NO_PRACK = "No PRACK",
RTP_TIMEOUT = "RTP Timeout",
USER_DENIED_MEDIA_ACCESS = "User Denied Media Access",
WEBRTC_ERROR = "WebRTC Error",
WEBRTC_NOT_SUPPORTED = "WebRTC Not Supported"
}
enum supported {
REQUIRED = "required",
SUPPORTED = "supported",
UNSUPPORTED = "none"
}
const SIP_ERROR_CAUSES: {
[name: string]: Array<number>;
};
const ACK = "ACK";
const BYE = "BYE";
const CANCEL = "CANCEL";
const INFO = "INFO";
const INVITE = "INVITE";
const MESSAGE = "MESSAGE";
const NOTIFY = "NOTIFY";
const OPTIONS = "OPTIONS";
const REGISTER = "REGISTER";
const UPDATE = "UPDATE";
const SUBSCRIBE = "SUBSCRIBE";
const PUBLISH = "PUBLISH";
const REFER = "REFER";
const PRACK = "PRACK";
const REASON_PHRASE: {
[code: number]: string;
};
const OPTION_TAGS: {
[option: string]: boolean;
};
enum dtmfType {
INFO = "info",
RTP = "rtp"
}
}
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 57e5bc6

Please sign in to comment.