ringcentral-softphone 1.3.3 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/call-session/inbound.cjs +41 -83
- package/dist/call-session/inbound.d.cts +10 -0
- package/dist/call-session/inbound.d.ts +8 -5
- package/dist/call-session/inbound.js +36 -49
- package/dist/call-session/index.cjs +212 -269
- package/dist/call-session/index.d.cts +48 -0
- package/dist/call-session/index.d.ts +44 -39
- package/dist/call-session/index.js +204 -239
- package/dist/call-session/outbound.cjs +56 -99
- package/dist/call-session/outbound.d.cts +13 -0
- package/dist/call-session/outbound.d.ts +11 -8
- package/dist/call-session/outbound.js +54 -68
- package/dist/call-session/streamer.cjs +66 -111
- package/dist/call-session/streamer.d.cts +19 -0
- package/dist/call-session/streamer.d.ts +16 -13
- package/dist/call-session/streamer.js +61 -79
- package/dist/codec.cjs +68 -84
- package/dist/codec.d.cts +17 -0
- package/dist/codec.d.ts +15 -12
- package/dist/codec.js +65 -63
- package/dist/dtmf.cjs +42 -64
- package/dist/dtmf.d.cts +9 -0
- package/dist/dtmf.d.ts +9 -7
- package/dist/dtmf.js +40 -44
- package/dist/index.cjs +166 -248
- package/dist/index.d.cts +31 -0
- package/dist/index.d.ts +28 -24
- package/dist/index.js +156 -224
- package/dist/sip-message/inbound/index.cjs +16 -50
- package/dist/sip-message/inbound/index.d.cts +7 -0
- package/dist/sip-message/inbound/index.d.ts +5 -2
- package/dist/sip-message/inbound/index.js +14 -19
- package/dist/sip-message/index.cjs +11 -49
- package/dist/sip-message/index.d.cts +6 -0
- package/dist/sip-message/index.d.ts +6 -5
- package/dist/sip-message/index.js +6 -12
- package/dist/sip-message/outbound/index.cjs +10 -40
- package/dist/sip-message/outbound/index.d.cts +7 -0
- package/dist/sip-message/outbound/index.d.ts +5 -2
- package/dist/sip-message/outbound/index.js +9 -10
- package/dist/sip-message/outbound/request.cjs +20 -61
- package/dist/sip-message/outbound/request.d.cts +9 -0
- package/dist/sip-message/outbound/request.d.ts +7 -4
- package/dist/sip-message/outbound/request.js +17 -29
- package/dist/sip-message/outbound/response.cjs +25 -54
- package/dist/sip-message/outbound/response.d.cts +8 -0
- package/dist/sip-message/outbound/response.d.ts +6 -3
- package/dist/sip-message/outbound/response.js +24 -24
- package/dist/sip-message/response-codes.cjs +80 -100
- package/dist/sip-message/response-codes.d.cts +5 -0
- package/dist/sip-message/response-codes.d.ts +4 -2
- package/dist/sip-message/response-codes.js +80 -81
- package/dist/sip-message/sip-message.cjs +25 -52
- package/dist/sip-message/sip-message.d.cts +12 -0
- package/dist/sip-message/sip-message.d.ts +11 -9
- package/dist/sip-message/sip-message.js +25 -33
- package/dist/types.cjs +0 -15
- package/dist/types.d.cts +12 -0
- package/dist/types.d.ts +11 -8
- package/dist/types.js +1 -0
- package/dist/utils.cjs +27 -73
- package/dist/utils.d.cts +12 -0
- package/dist/utils.d.ts +12 -8
- package/dist/utils.js +15 -31
- package/package.json +5 -5
|
@@ -1,83 +1,82 @@
|
|
|
1
|
+
//#region src/sip-message/response-codes.ts
|
|
1
2
|
const responseCodes = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
};
|
|
80
|
-
var response_codes_default = responseCodes;
|
|
81
|
-
export {
|
|
82
|
-
response_codes_default as default
|
|
3
|
+
100: "Trying",
|
|
4
|
+
180: "Ringing",
|
|
5
|
+
181: "Call is Being Forwarded",
|
|
6
|
+
182: "Queued",
|
|
7
|
+
183: "Session Progress",
|
|
8
|
+
199: "Early Dialog Terminated",
|
|
9
|
+
200: "OK",
|
|
10
|
+
202: "Accepted",
|
|
11
|
+
204: "No Notification",
|
|
12
|
+
300: "Multiple Choices",
|
|
13
|
+
301: "Moved Permanently",
|
|
14
|
+
302: "Moved Temporarily",
|
|
15
|
+
305: "Use Proxy",
|
|
16
|
+
380: "Alternative Service",
|
|
17
|
+
400: "Bad Request",
|
|
18
|
+
401: "Unauthorized",
|
|
19
|
+
402: "Payment Required",
|
|
20
|
+
403: "Forbidden",
|
|
21
|
+
404: "Not Found",
|
|
22
|
+
405: "Method Not Allowed",
|
|
23
|
+
406: "Not Acceptable",
|
|
24
|
+
407: "Proxy Authentication Required",
|
|
25
|
+
408: "Request Timeout",
|
|
26
|
+
409: "Conflict",
|
|
27
|
+
410: "Gone",
|
|
28
|
+
411: "Length Required",
|
|
29
|
+
412: "Conditional Request Failed",
|
|
30
|
+
413: "Request Entity Too Large",
|
|
31
|
+
414: "Request-URI Too Long",
|
|
32
|
+
415: "Unsupported Media Type",
|
|
33
|
+
416: "Unsupported URI Scheme",
|
|
34
|
+
417: "Unknown Resource-Priority",
|
|
35
|
+
420: "Bad Extension",
|
|
36
|
+
421: "Extension Required",
|
|
37
|
+
422: "Session Interval Too Small",
|
|
38
|
+
423: "Interval Too Brief",
|
|
39
|
+
424: "Bad Location Information",
|
|
40
|
+
425: "Bad Alert Message",
|
|
41
|
+
428: "Use Identity Header",
|
|
42
|
+
429: "Provide Referrer Identity",
|
|
43
|
+
430: "Flow Failed",
|
|
44
|
+
433: "Anonymity Disallowed",
|
|
45
|
+
436: "Bad Identity-Info",
|
|
46
|
+
437: "Unsupported Certificate",
|
|
47
|
+
438: "Invalid Identity Header",
|
|
48
|
+
439: "First Hop Lacks Outbound Support",
|
|
49
|
+
440: "Max-Breadth Exceeded",
|
|
50
|
+
469: "Bad Info Package",
|
|
51
|
+
470: "Consent Needed",
|
|
52
|
+
480: "Temporarily Unavailable",
|
|
53
|
+
481: "Call/Transaction Does Not Exist",
|
|
54
|
+
482: "Loop Detected",
|
|
55
|
+
483: "Too Many Hops",
|
|
56
|
+
484: "Address Incomplete",
|
|
57
|
+
485: "Ambiguous",
|
|
58
|
+
486: "Busy Here",
|
|
59
|
+
487: "Request Terminated",
|
|
60
|
+
488: "Not Acceptable Here",
|
|
61
|
+
489: "Bad Event",
|
|
62
|
+
491: "Request Pending",
|
|
63
|
+
493: "Undecipherable",
|
|
64
|
+
494: "Security Agreement Required",
|
|
65
|
+
500: "Server Internal Error",
|
|
66
|
+
501: "Not Implemented",
|
|
67
|
+
502: "Bad Gateway",
|
|
68
|
+
503: "Service Unavailable",
|
|
69
|
+
504: "Server Time-out",
|
|
70
|
+
505: "Version Not Supported",
|
|
71
|
+
513: "Message Too Large",
|
|
72
|
+
555: "Push Notification Service Not Supported",
|
|
73
|
+
580: "Precondition Failure",
|
|
74
|
+
600: "Busy Everywhere",
|
|
75
|
+
603: "Decline",
|
|
76
|
+
604: "Does Not Exist Anywhere",
|
|
77
|
+
606: "Not Acceptable",
|
|
78
|
+
607: "Unwanted",
|
|
79
|
+
608: "Rejected"
|
|
83
80
|
};
|
|
81
|
+
//#endregion
|
|
82
|
+
export { responseCodes as default };
|
|
@@ -1,53 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
//#region src/sip-message/sip-message.ts
|
|
2
|
+
var SipMessage = class {
|
|
3
|
+
subject;
|
|
4
|
+
headers;
|
|
5
|
+
body;
|
|
6
|
+
constructor(subject = "", headers = {}, body = "") {
|
|
7
|
+
this.subject = subject;
|
|
8
|
+
this.headers = headers;
|
|
9
|
+
this.body = body.trim().split(/[\r\n]+/).join("\r\n");
|
|
10
|
+
if (this.body.length > 0) this.body += "\r\n";
|
|
11
|
+
}
|
|
12
|
+
toString() {
|
|
13
|
+
return [
|
|
14
|
+
this.subject,
|
|
15
|
+
...Object.keys(this.headers).map((key) => `${key}: ${this.headers[key]}`),
|
|
16
|
+
"",
|
|
17
|
+
this.body
|
|
18
|
+
].join("\r\n");
|
|
19
|
+
}
|
|
20
|
+
getHeader(key) {
|
|
21
|
+
const foundKey = Object.keys(this.headers).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
22
|
+
if (foundKey) return this.headers[foundKey];
|
|
23
|
+
}
|
|
8
24
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var sip_message_exports = {};
|
|
19
|
-
__export(sip_message_exports, {
|
|
20
|
-
default: () => sip_message_default
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(sip_message_exports);
|
|
23
|
-
class SipMessage {
|
|
24
|
-
subject;
|
|
25
|
-
headers;
|
|
26
|
-
body;
|
|
27
|
-
constructor(subject = "", headers = {}, body = "") {
|
|
28
|
-
this.subject = subject;
|
|
29
|
-
this.headers = headers;
|
|
30
|
-
this.body = body.trim().split(/[\r\n]+/).join("\r\n");
|
|
31
|
-
if (this.body.length > 0) {
|
|
32
|
-
this.body += "\r\n";
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
toString() {
|
|
36
|
-
const r = [
|
|
37
|
-
this.subject,
|
|
38
|
-
...Object.keys(this.headers).map((key) => `${key}: ${this.headers[key]}`),
|
|
39
|
-
"",
|
|
40
|
-
this.body
|
|
41
|
-
].join("\r\n");
|
|
42
|
-
return r;
|
|
43
|
-
}
|
|
44
|
-
getHeader(key) {
|
|
45
|
-
const foundKey = Object.keys(this.headers).find(
|
|
46
|
-
(k) => k.toLowerCase() === key.toLowerCase()
|
|
47
|
-
);
|
|
48
|
-
if (foundKey) {
|
|
49
|
-
return this.headers[foundKey];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
var sip_message_default = SipMessage;
|
|
25
|
+
//#endregion
|
|
26
|
+
module.exports = SipMessage;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/sip-message/sip-message.d.ts
|
|
2
|
+
declare class SipMessage {
|
|
3
|
+
subject: string;
|
|
4
|
+
headers: {
|
|
5
|
+
[key: string]: string;
|
|
6
|
+
};
|
|
7
|
+
body: string;
|
|
8
|
+
constructor(subject?: string, headers?: {}, body?: string);
|
|
9
|
+
toString(): string;
|
|
10
|
+
getHeader(key: string): string | undefined;
|
|
11
|
+
}
|
|
12
|
+
export = SipMessage;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
//#region src/sip-message/sip-message.d.ts
|
|
1
2
|
declare class SipMessage {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
subject: string;
|
|
4
|
+
headers: {
|
|
5
|
+
[key: string]: string;
|
|
6
|
+
};
|
|
7
|
+
body: string;
|
|
8
|
+
constructor(subject?: string, headers?: {}, body?: string);
|
|
9
|
+
toString(): string;
|
|
10
|
+
getHeader(key: string): string | undefined;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
+
//#endregion
|
|
13
|
+
export { SipMessage as default };
|
|
@@ -1,34 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
(k) => k.toLowerCase() === key.toLowerCase()
|
|
25
|
-
);
|
|
26
|
-
if (foundKey) {
|
|
27
|
-
return this.headers[foundKey];
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
var sip_message_default = SipMessage;
|
|
32
|
-
export {
|
|
33
|
-
sip_message_default as default
|
|
1
|
+
//#region src/sip-message/sip-message.ts
|
|
2
|
+
var SipMessage = class {
|
|
3
|
+
subject;
|
|
4
|
+
headers;
|
|
5
|
+
body;
|
|
6
|
+
constructor(subject = "", headers = {}, body = "") {
|
|
7
|
+
this.subject = subject;
|
|
8
|
+
this.headers = headers;
|
|
9
|
+
this.body = body.trim().split(/[\r\n]+/).join("\r\n");
|
|
10
|
+
if (this.body.length > 0) this.body += "\r\n";
|
|
11
|
+
}
|
|
12
|
+
toString() {
|
|
13
|
+
return [
|
|
14
|
+
this.subject,
|
|
15
|
+
...Object.keys(this.headers).map((key) => `${key}: ${this.headers[key]}`),
|
|
16
|
+
"",
|
|
17
|
+
this.body
|
|
18
|
+
].join("\r\n");
|
|
19
|
+
}
|
|
20
|
+
getHeader(key) {
|
|
21
|
+
const foundKey = Object.keys(this.headers).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
22
|
+
if (foundKey) return this.headers[foundKey];
|
|
23
|
+
}
|
|
34
24
|
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { SipMessage as default };
|
package/dist/types.cjs
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var types_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(types_exports);
|
package/dist/types.d.cts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
type SoftPhoneOptions = {
|
|
3
|
+
domain: string;
|
|
4
|
+
outboundProxy: string;
|
|
5
|
+
username: string;
|
|
6
|
+
password: string;
|
|
7
|
+
authorizationId: string;
|
|
8
|
+
codec?: "OPUS/16000" | "OPUS/48000/2" | "PCMU/8000";
|
|
9
|
+
ignoreTlsCertErrors?: boolean;
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { SoftPhoneOptions };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
type SoftPhoneOptions = {
|
|
3
|
+
domain: string;
|
|
4
|
+
outboundProxy: string;
|
|
5
|
+
username: string;
|
|
6
|
+
password: string;
|
|
7
|
+
authorizationId: string;
|
|
8
|
+
codec?: "OPUS/16000" | "OPUS/48000/2" | "PCMU/8000";
|
|
9
|
+
ignoreTlsCertErrors?: boolean;
|
|
9
10
|
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { SoftPhoneOptions };
|
package/dist/types.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/utils.cjs
CHANGED
|
@@ -1,80 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var utils_exports = {};
|
|
29
|
-
__export(utils_exports, {
|
|
30
|
-
branch: () => branch,
|
|
31
|
-
extractAddress: () => extractAddress,
|
|
32
|
-
generateAuthorization: () => generateAuthorization,
|
|
33
|
-
localKey: () => localKey,
|
|
34
|
-
randomInt: () => randomInt,
|
|
35
|
-
uuid: () => uuid,
|
|
36
|
-
withoutTag: () => withoutTag
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(utils_exports);
|
|
39
|
-
var import_node_crypto = __toESM(require("node:crypto"), 1);
|
|
40
|
-
const md5 = (s) => import_node_crypto.default.createHash("md5").update(s).digest("hex");
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let node_crypto = require("node:crypto");
|
|
4
|
+
node_crypto = require_runtime.__toESM(node_crypto, 1);
|
|
5
|
+
//#region src/utils.ts
|
|
6
|
+
const md5 = (s) => node_crypto.default.createHash("md5").update(s).digest("hex");
|
|
41
7
|
const generateResponse = (sipInfo, endpoint, nonce) => {
|
|
42
|
-
|
|
43
|
-
`${sipInfo.authorizationId}:${sipInfo.domain}:${sipInfo.password}`
|
|
44
|
-
);
|
|
45
|
-
const ha2 = md5(endpoint);
|
|
46
|
-
const response = md5(`${ha1}:${nonce}:${ha2}`);
|
|
47
|
-
return response;
|
|
8
|
+
return md5(`${md5(`${sipInfo.authorizationId}:${sipInfo.domain}:${sipInfo.password}`)}:${nonce}:${md5(endpoint)}`);
|
|
48
9
|
};
|
|
49
10
|
const generateAuthorization = (sipInfo, nonce, method) => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
nonce
|
|
60
|
-
)
|
|
61
|
-
};
|
|
62
|
-
return Object.entries(authObj).map(([key, value]) => `${key}="${value}"`).join(", ");
|
|
11
|
+
const authObj = {
|
|
12
|
+
"Digest algorithm": "MD5",
|
|
13
|
+
username: sipInfo.authorizationId,
|
|
14
|
+
realm: sipInfo.domain,
|
|
15
|
+
nonce,
|
|
16
|
+
uri: `sip:${sipInfo.domain}`,
|
|
17
|
+
response: generateResponse(sipInfo, `${method}:sip:${sipInfo.domain}`, nonce)
|
|
18
|
+
};
|
|
19
|
+
return Object.entries(authObj).map(([key, value]) => `${key}="${value}"`).join(", ");
|
|
63
20
|
};
|
|
64
|
-
const uuid = () =>
|
|
21
|
+
const uuid = () => node_crypto.default.randomUUID();
|
|
65
22
|
const branch = () => `z9hG4bK-${uuid()}`;
|
|
66
|
-
const randomInt = () => Math.floor(Math.random() *
|
|
23
|
+
const randomInt = () => Math.floor(Math.random() * 64512) + 1024;
|
|
67
24
|
const withoutTag = (s) => s.replace(/;tag=.*$/, "");
|
|
68
25
|
const extractAddress = (s) => s.match(/<(sip:.+?)>/)?.[1];
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
uuid,
|
|
79
|
-
withoutTag
|
|
80
|
-
});
|
|
26
|
+
const localKey = node_crypto.default.randomBytes(30).toString("base64").replace(/=+$/, "");
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.branch = branch;
|
|
29
|
+
exports.extractAddress = extractAddress;
|
|
30
|
+
exports.generateAuthorization = generateAuthorization;
|
|
31
|
+
exports.localKey = localKey;
|
|
32
|
+
exports.randomInt = randomInt;
|
|
33
|
+
exports.uuid = uuid;
|
|
34
|
+
exports.withoutTag = withoutTag;
|
package/dist/utils.d.cts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SoftPhoneOptions } from "./types.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/utils.d.ts
|
|
4
|
+
declare const generateAuthorization: (sipInfo: SoftPhoneOptions, nonce: string, method: "REGISTER" | "INVITE") => string;
|
|
5
|
+
declare const uuid: () => `${string}-${string}-${string}-${string}-${string}`;
|
|
6
|
+
declare const branch: () => string;
|
|
7
|
+
declare const randomInt: () => number;
|
|
8
|
+
declare const withoutTag: (s: string) => string;
|
|
9
|
+
declare const extractAddress: (s: string) => string | undefined;
|
|
10
|
+
declare const localKey: string;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { branch, extractAddress, generateAuthorization, localKey, randomInt, uuid, withoutTag };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { SoftPhoneOptions } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utils.d.ts
|
|
4
|
+
declare const generateAuthorization: (sipInfo: SoftPhoneOptions, nonce: string, method: "REGISTER" | "INVITE") => string;
|
|
5
|
+
declare const uuid: () => `${string}-${string}-${string}-${string}-${string}`;
|
|
6
|
+
declare const branch: () => string;
|
|
7
|
+
declare const randomInt: () => number;
|
|
8
|
+
declare const withoutTag: (s: string) => string;
|
|
9
|
+
declare const extractAddress: (s: string) => string | undefined;
|
|
10
|
+
declare const localKey: string;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { branch, extractAddress, generateAuthorization, localKey, randomInt, uuid, withoutTag };
|
package/dist/utils.js
CHANGED
|
@@ -1,41 +1,25 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
|
+
//#region src/utils.ts
|
|
2
3
|
const md5 = (s) => crypto.createHash("md5").update(s).digest("hex");
|
|
3
4
|
const generateResponse = (sipInfo, endpoint, nonce) => {
|
|
4
|
-
|
|
5
|
-
`${sipInfo.authorizationId}:${sipInfo.domain}:${sipInfo.password}`
|
|
6
|
-
);
|
|
7
|
-
const ha2 = md5(endpoint);
|
|
8
|
-
const response = md5(`${ha1}:${nonce}:${ha2}`);
|
|
9
|
-
return response;
|
|
5
|
+
return md5(`${md5(`${sipInfo.authorizationId}:${sipInfo.domain}:${sipInfo.password}`)}:${nonce}:${md5(endpoint)}`);
|
|
10
6
|
};
|
|
11
7
|
const generateAuthorization = (sipInfo, nonce, method) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
nonce
|
|
22
|
-
)
|
|
23
|
-
};
|
|
24
|
-
return Object.entries(authObj).map(([key, value]) => `${key}="${value}"`).join(", ");
|
|
8
|
+
const authObj = {
|
|
9
|
+
"Digest algorithm": "MD5",
|
|
10
|
+
username: sipInfo.authorizationId,
|
|
11
|
+
realm: sipInfo.domain,
|
|
12
|
+
nonce,
|
|
13
|
+
uri: `sip:${sipInfo.domain}`,
|
|
14
|
+
response: generateResponse(sipInfo, `${method}:sip:${sipInfo.domain}`, nonce)
|
|
15
|
+
};
|
|
16
|
+
return Object.entries(authObj).map(([key, value]) => `${key}="${value}"`).join(", ");
|
|
25
17
|
};
|
|
26
18
|
const uuid = () => crypto.randomUUID();
|
|
27
19
|
const branch = () => `z9hG4bK-${uuid()}`;
|
|
28
|
-
const randomInt = () => Math.floor(Math.random() *
|
|
20
|
+
const randomInt = () => Math.floor(Math.random() * 64512) + 1024;
|
|
29
21
|
const withoutTag = (s) => s.replace(/;tag=.*$/, "");
|
|
30
22
|
const extractAddress = (s) => s.match(/<(sip:.+?)>/)?.[1];
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
export {
|
|
34
|
-
branch,
|
|
35
|
-
extractAddress,
|
|
36
|
-
generateAuthorization,
|
|
37
|
-
localKey,
|
|
38
|
-
randomInt,
|
|
39
|
-
uuid,
|
|
40
|
-
withoutTag
|
|
41
|
-
};
|
|
23
|
+
const localKey = crypto.randomBytes(30).toString("base64").replace(/=+$/, "");
|
|
24
|
+
//#endregion
|
|
25
|
+
export { branch, extractAddress, generateAuthorization, localKey, randomInt, uuid, withoutTag };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ringcentral-softphone",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"homepage": "https://github.com/ringcentral/ringcentral-softphone-ts",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"join": "rm -rf *.wav && tsx -r dotenv-override-true/config demos/join-rcv-meeting.ts",
|
|
31
31
|
"multi": "tsx -r dotenv-override-true/config demos/multiple-calls-sequentially.ts",
|
|
32
32
|
"lint": "biome check --write .",
|
|
33
|
-
"build": "
|
|
33
|
+
"build": "tsdown",
|
|
34
34
|
"prepublishOnly": "yarn build",
|
|
35
35
|
"postpublish": "rm -rf dist"
|
|
36
36
|
},
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"werift-rtp": "^0.8.8"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@biomejs/biome": "^2.4.
|
|
44
|
+
"@biomejs/biome": "^2.4.12",
|
|
45
45
|
"@types/node": "^25.6.0",
|
|
46
46
|
"dotenv-override-true": "^6.2.2",
|
|
47
|
-
"
|
|
47
|
+
"tsdown": "^0.21.10",
|
|
48
48
|
"tsx": "^4.21.0",
|
|
49
49
|
"typescript": "^6.0.3",
|
|
50
|
-
"yarn-upgrade-all": "^0.
|
|
50
|
+
"yarn-upgrade-all": "^0.8.1"
|
|
51
51
|
},
|
|
52
52
|
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
53
53
|
}
|