|
| 1 | +"use strict"; |
| 2 | +Object.defineProperty(exports, "__esModule", { value: true }); |
| 3 | +// tslint:disable-next-line:no-var-requires |
| 4 | +var pkg = require("../package.json"); |
| 5 | +var C; |
| 6 | +(function (C) { |
| 7 | + C.USER_AGENT = pkg.title + "/" + pkg.version; |
| 8 | + // SIP scheme |
| 9 | + C.SIP = "sip"; |
| 10 | + C.SIPS = "sips"; |
| 11 | + // End and Failure causes |
| 12 | + var causes; |
| 13 | + (function (causes) { |
| 14 | + // Generic error causes |
| 15 | + causes["CONNECTION_ERROR"] = "Connection Error"; |
| 16 | + causes["INTERNAL_ERROR"] = "Internal Error"; |
| 17 | + causes["REQUEST_TIMEOUT"] = "Request Timeout"; |
| 18 | + causes["SIP_FAILURE_CODE"] = "SIP Failure Code"; |
| 19 | + // SIP error causes |
| 20 | + causes["ADDRESS_INCOMPLETE"] = "Address Incomplete"; |
| 21 | + causes["AUTHENTICATION_ERROR"] = "Authentication Error"; |
| 22 | + causes["BUSY"] = "Busy"; |
| 23 | + causes["DIALOG_ERROR"] = "Dialog Error"; |
| 24 | + causes["INCOMPATIBLE_SDP"] = "Incompatible SDP"; |
| 25 | + causes["NOT_FOUND"] = "Not Found"; |
| 26 | + causes["REDIRECTED"] = "Redirected"; |
| 27 | + causes["REJECTED"] = "Rejected"; |
| 28 | + causes["UNAVAILABLE"] = "Unavailable"; |
| 29 | + // Session error causes |
| 30 | + causes["BAD_MEDIA_DESCRIPTION"] = "Bad Media Description"; |
| 31 | + causes["CANCELED"] = "Canceled"; |
| 32 | + causes["EXPIRES"] = "Expires"; |
| 33 | + causes["NO_ACK"] = "No ACK"; |
| 34 | + causes["NO_ANSWER"] = "No Answer"; |
| 35 | + causes["NO_PRACK"] = "No PRACK"; |
| 36 | + causes["RTP_TIMEOUT"] = "RTP Timeout"; |
| 37 | + causes["USER_DENIED_MEDIA_ACCESS"] = "User Denied Media Access"; |
| 38 | + causes["WEBRTC_ERROR"] = "WebRTC Error"; |
| 39 | + causes["WEBRTC_NOT_SUPPORTED"] = "WebRTC Not Supported"; |
| 40 | + })(causes = C.causes || (C.causes = {})); |
| 41 | + var supported; |
| 42 | + (function (supported) { |
| 43 | + supported["REQUIRED"] = "required"; |
| 44 | + supported["SUPPORTED"] = "supported"; |
| 45 | + supported["UNSUPPORTED"] = "none"; |
| 46 | + })(supported = C.supported || (C.supported = {})); |
| 47 | + C.SIP_ERROR_CAUSES = { |
| 48 | + ADDRESS_INCOMPLETE: [484], |
| 49 | + AUTHENTICATION_ERROR: [401, 407], |
| 50 | + BUSY: [486, 600], |
| 51 | + INCOMPATIBLE_SDP: [488, 606], |
| 52 | + NOT_FOUND: [404, 604], |
| 53 | + REDIRECTED: [300, 301, 302, 305, 380], |
| 54 | + REJECTED: [403, 603], |
| 55 | + UNAVAILABLE: [480, 410, 408, 430] |
| 56 | + }; |
| 57 | + // SIP Methods |
| 58 | + C.ACK = "ACK"; |
| 59 | + C.BYE = "BYE"; |
| 60 | + C.CANCEL = "CANCEL"; |
| 61 | + C.INFO = "INFO"; |
| 62 | + C.INVITE = "INVITE"; |
| 63 | + C.MESSAGE = "MESSAGE"; |
| 64 | + C.NOTIFY = "NOTIFY"; |
| 65 | + C.OPTIONS = "OPTIONS"; |
| 66 | + C.REGISTER = "REGISTER"; |
| 67 | + C.UPDATE = "UPDATE"; |
| 68 | + C.SUBSCRIBE = "SUBSCRIBE"; |
| 69 | + C.PUBLISH = "PUBLISH"; |
| 70 | + C.REFER = "REFER"; |
| 71 | + C.PRACK = "PRACK"; |
| 72 | + /* SIP Response Reasons |
| 73 | + * DOC: http://www.iana.org/assignments/sip-parameters |
| 74 | + * Copied from https://github.com/versatica/OverSIP/blob/master/lib/oversip/sip/constants.rb#L7 |
| 75 | + */ |
| 76 | + C.REASON_PHRASE = { |
| 77 | + 100: "Trying", |
| 78 | + 180: "Ringing", |
| 79 | + 181: "Call Is Being Forwarded", |
| 80 | + 182: "Queued", |
| 81 | + 183: "Session Progress", |
| 82 | + 199: "Early Dialog Terminated", |
| 83 | + 200: "OK", |
| 84 | + 202: "Accepted", |
| 85 | + 204: "No Notification", |
| 86 | + 300: "Multiple Choices", |
| 87 | + 301: "Moved Permanently", |
| 88 | + 302: "Moved Temporarily", |
| 89 | + 305: "Use Proxy", |
| 90 | + 380: "Alternative Service", |
| 91 | + 400: "Bad Request", |
| 92 | + 401: "Unauthorized", |
| 93 | + 402: "Payment Required", |
| 94 | + 403: "Forbidden", |
| 95 | + 404: "Not Found", |
| 96 | + 405: "Method Not Allowed", |
| 97 | + 406: "Not Acceptable", |
| 98 | + 407: "Proxy Authentication Required", |
| 99 | + 408: "Request Timeout", |
| 100 | + 410: "Gone", |
| 101 | + 412: "Conditional Request Failed", |
| 102 | + 413: "Request Entity Too Large", |
| 103 | + 414: "Request-URI Too Long", |
| 104 | + 415: "Unsupported Media Type", |
| 105 | + 416: "Unsupported URI Scheme", |
| 106 | + 417: "Unknown Resource-Priority", |
| 107 | + 420: "Bad Extension", |
| 108 | + 421: "Extension Required", |
| 109 | + 422: "Session Interval Too Small", |
| 110 | + 423: "Interval Too Brief", |
| 111 | + 428: "Use Identity Header", |
| 112 | + 429: "Provide Referrer Identity", |
| 113 | + 430: "Flow Failed", |
| 114 | + 433: "Anonymity Disallowed", |
| 115 | + 436: "Bad Identity-Info", |
| 116 | + 437: "Unsupported Certificate", |
| 117 | + 438: "Invalid Identity Header", |
| 118 | + 439: "First Hop Lacks Outbound Support", |
| 119 | + 440: "Max-Breadth Exceeded", |
| 120 | + 469: "Bad Info Package", |
| 121 | + 470: "Consent Needed", |
| 122 | + 478: "Unresolvable Destination", |
| 123 | + 480: "Temporarily Unavailable", |
| 124 | + 481: "Call/Transaction Does Not Exist", |
| 125 | + 482: "Loop Detected", |
| 126 | + 483: "Too Many Hops", |
| 127 | + 484: "Address Incomplete", |
| 128 | + 485: "Ambiguous", |
| 129 | + 486: "Busy Here", |
| 130 | + 487: "Request Terminated", |
| 131 | + 488: "Not Acceptable Here", |
| 132 | + 489: "Bad Event", |
| 133 | + 491: "Request Pending", |
| 134 | + 493: "Undecipherable", |
| 135 | + 494: "Security Agreement Required", |
| 136 | + 500: "Internal Server Error", |
| 137 | + 501: "Not Implemented", |
| 138 | + 502: "Bad Gateway", |
| 139 | + 503: "Service Unavailable", |
| 140 | + 504: "Server Time-out", |
| 141 | + 505: "Version Not Supported", |
| 142 | + 513: "Message Too Large", |
| 143 | + 580: "Precondition Failure", |
| 144 | + 600: "Busy Everywhere", |
| 145 | + 603: "Decline", |
| 146 | + 604: "Does Not Exist Anywhere", |
| 147 | + 606: "Not Acceptable" |
| 148 | + }; |
| 149 | + /* SIP Option Tags |
| 150 | + * DOC: http://www.iana.org/assignments/sip-parameters/sip-parameters.xhtml#sip-parameters-4 |
| 151 | + */ |
| 152 | + C.OPTION_TAGS = { |
| 153 | + "100rel": true, |
| 154 | + "199": true, |
| 155 | + "answermode": true, |
| 156 | + "early-session": true, |
| 157 | + "eventlist": true, |
| 158 | + "explicitsub": true, |
| 159 | + "from-change": true, |
| 160 | + "geolocation-http": true, |
| 161 | + "geolocation-sip": true, |
| 162 | + "gin": true, |
| 163 | + "gruu": true, |
| 164 | + "histinfo": true, |
| 165 | + "ice": true, |
| 166 | + "join": true, |
| 167 | + "multiple-refer": true, |
| 168 | + "norefersub": true, |
| 169 | + "nosub": true, |
| 170 | + "outbound": true, |
| 171 | + "path": true, |
| 172 | + "policy": true, |
| 173 | + "precondition": true, |
| 174 | + "pref": true, |
| 175 | + "privacy": true, |
| 176 | + "recipient-list-invite": true, |
| 177 | + "recipient-list-message": true, |
| 178 | + "recipient-list-subscribe": true, |
| 179 | + "replaces": true, |
| 180 | + "resource-priority": true, |
| 181 | + "sdp-anat": true, |
| 182 | + "sec-agree": true, |
| 183 | + "tdialog": true, |
| 184 | + "timer": true, |
| 185 | + "uui": true // RFC 7433 |
| 186 | + }; |
| 187 | + var dtmfType; |
| 188 | + (function (dtmfType) { |
| 189 | + dtmfType["INFO"] = "info"; |
| 190 | + dtmfType["RTP"] = "rtp"; |
| 191 | + })(dtmfType = C.dtmfType || (C.dtmfType = {})); |
| 192 | +})(C = exports.C || (exports.C = {})); |
0 commit comments