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
package/dist/codec.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { Buffer } from "node:buffer";
|
|
2
|
+
|
|
3
|
+
//#region src/codec.d.ts
|
|
2
4
|
declare class Codec {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
id: number;
|
|
6
|
+
name: "OPUS/16000" | "OPUS/48000/2" | "PCMU/8000";
|
|
7
|
+
packetSize: number;
|
|
8
|
+
timestampInterval: number;
|
|
9
|
+
createEncoder: () => {
|
|
10
|
+
encode: (pcm: Buffer) => Buffer;
|
|
11
|
+
};
|
|
12
|
+
createDecoder: () => {
|
|
13
|
+
decode: (audio: Buffer) => Buffer;
|
|
14
|
+
};
|
|
15
|
+
constructor(name: "OPUS/16000" | "OPUS/48000/2" | "PCMU/8000");
|
|
14
16
|
}
|
|
15
|
-
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Codec as default };
|
package/dist/codec.js
CHANGED
|
@@ -1,66 +1,68 @@
|
|
|
1
1
|
import { Buffer } from "node:buffer";
|
|
2
2
|
import { Decoder, Encoder } from "@evan/opus";
|
|
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
|
-
|
|
3
|
+
//#region src/codec.ts
|
|
4
|
+
var Codec = class {
|
|
5
|
+
id;
|
|
6
|
+
name;
|
|
7
|
+
packetSize;
|
|
8
|
+
timestampInterval;
|
|
9
|
+
createEncoder;
|
|
10
|
+
createDecoder;
|
|
11
|
+
constructor(name) {
|
|
12
|
+
this.name = name;
|
|
13
|
+
switch (name) {
|
|
14
|
+
case "OPUS/16000":
|
|
15
|
+
this.createEncoder = () => {
|
|
16
|
+
const encoder = new Encoder({
|
|
17
|
+
channels: 1,
|
|
18
|
+
sample_rate: 16e3
|
|
19
|
+
});
|
|
20
|
+
return { encode: (pcm) => Buffer.from(encoder.encode(pcm)) };
|
|
21
|
+
};
|
|
22
|
+
this.createDecoder = () => {
|
|
23
|
+
const decoder = new Decoder({
|
|
24
|
+
channels: 1,
|
|
25
|
+
sample_rate: 16e3
|
|
26
|
+
});
|
|
27
|
+
return { decode: (opus) => Buffer.from(decoder.decode(opus)) };
|
|
28
|
+
};
|
|
29
|
+
this.id = 109;
|
|
30
|
+
this.packetSize = 640;
|
|
31
|
+
this.timestampInterval = 320;
|
|
32
|
+
break;
|
|
33
|
+
case "OPUS/48000/2":
|
|
34
|
+
this.createEncoder = () => {
|
|
35
|
+
const encoder = new Encoder({
|
|
36
|
+
channels: 2,
|
|
37
|
+
sample_rate: 48e3
|
|
38
|
+
});
|
|
39
|
+
return { encode: (pcm) => Buffer.from(encoder.encode(pcm)) };
|
|
40
|
+
};
|
|
41
|
+
this.createDecoder = () => {
|
|
42
|
+
const decoder = new Decoder({
|
|
43
|
+
channels: 2,
|
|
44
|
+
sample_rate: 48e3
|
|
45
|
+
});
|
|
46
|
+
return { decode: (opus) => Buffer.from(decoder.decode(opus)) };
|
|
47
|
+
};
|
|
48
|
+
this.id = 111;
|
|
49
|
+
this.packetSize = 3840;
|
|
50
|
+
this.timestampInterval = 960;
|
|
51
|
+
break;
|
|
52
|
+
case "PCMU/8000":
|
|
53
|
+
this.createEncoder = () => {
|
|
54
|
+
return { encode: (pcm) => pcm };
|
|
55
|
+
};
|
|
56
|
+
this.createDecoder = () => {
|
|
57
|
+
return { decode: (audio) => audio };
|
|
58
|
+
};
|
|
59
|
+
this.id = 0;
|
|
60
|
+
this.packetSize = 160;
|
|
61
|
+
this.timestampInterval = 160;
|
|
62
|
+
break;
|
|
63
|
+
default: throw new Error(`unsupported codec: ${name}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
66
|
};
|
|
67
|
+
//#endregion
|
|
68
|
+
export { Codec as default };
|
package/dist/dtmf.cjs
CHANGED
|
@@ -1,65 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
require("./_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
let node_buffer = require("node:buffer");
|
|
3
|
+
//#region src/dtmf.ts
|
|
4
|
+
const phoneChars = [
|
|
5
|
+
"0",
|
|
6
|
+
"1",
|
|
7
|
+
"2",
|
|
8
|
+
"3",
|
|
9
|
+
"4",
|
|
10
|
+
"5",
|
|
11
|
+
"6",
|
|
12
|
+
"7",
|
|
13
|
+
"8",
|
|
14
|
+
"9",
|
|
15
|
+
"*",
|
|
16
|
+
"#"
|
|
17
|
+
];
|
|
18
|
+
const payloads = [
|
|
19
|
+
393216,
|
|
20
|
+
393376,
|
|
21
|
+
393536,
|
|
22
|
+
8782624,
|
|
23
|
+
8782624,
|
|
24
|
+
8782624
|
|
25
|
+
];
|
|
26
|
+
const DTMF = {
|
|
27
|
+
phoneChars,
|
|
28
|
+
charToPayloads(char) {
|
|
29
|
+
const index = phoneChars.indexOf(char[0]);
|
|
30
|
+
if (index === -1) throw new Error("invalid phone char");
|
|
31
|
+
return payloads.map((payload) => {
|
|
32
|
+
const temp = payload + index * 16777216;
|
|
33
|
+
const buffer = node_buffer.Buffer.alloc(4);
|
|
34
|
+
buffer.writeIntBE(temp, 0, 4);
|
|
35
|
+
return buffer;
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
payloadToChar(payload) {
|
|
39
|
+
return phoneChars[(payload.readIntBE(0, 4) - 393216) / 16777216];
|
|
40
|
+
}
|
|
8
41
|
};
|
|
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 dtmf_exports = {};
|
|
19
|
-
__export(dtmf_exports, {
|
|
20
|
-
default: () => dtmf_default
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(dtmf_exports);
|
|
23
|
-
var import_node_buffer = require("node:buffer");
|
|
24
|
-
class DTMF {
|
|
25
|
-
static phoneChars = [
|
|
26
|
-
"0",
|
|
27
|
-
"1",
|
|
28
|
-
"2",
|
|
29
|
-
"3",
|
|
30
|
-
"4",
|
|
31
|
-
"5",
|
|
32
|
-
"6",
|
|
33
|
-
"7",
|
|
34
|
-
"8",
|
|
35
|
-
"9",
|
|
36
|
-
"*",
|
|
37
|
-
"#"
|
|
38
|
-
];
|
|
39
|
-
static payloads = [
|
|
40
|
-
393216,
|
|
41
|
-
393376,
|
|
42
|
-
393536,
|
|
43
|
-
8782624,
|
|
44
|
-
8782624,
|
|
45
|
-
8782624
|
|
46
|
-
];
|
|
47
|
-
static charToPayloads = (char) => {
|
|
48
|
-
const index = DTMF.phoneChars.indexOf(char[0]);
|
|
49
|
-
if (index === -1) {
|
|
50
|
-
throw new Error("invalid phone char");
|
|
51
|
-
}
|
|
52
|
-
return DTMF.payloads.map((payload) => {
|
|
53
|
-
const temp = payload + index * 16777216;
|
|
54
|
-
const buffer = import_node_buffer.Buffer.alloc(4);
|
|
55
|
-
buffer.writeIntBE(temp, 0, 4);
|
|
56
|
-
return buffer;
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
static payloadToChar = (payload) => {
|
|
60
|
-
const intBE = payload.readIntBE(0, 4);
|
|
61
|
-
const index = (intBE - 393216) / 16777216;
|
|
62
|
-
return DTMF.phoneChars[index];
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
var dtmf_default = DTMF;
|
|
42
|
+
//#endregion
|
|
43
|
+
module.exports = DTMF;
|
package/dist/dtmf.d.cts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
2
|
+
|
|
3
|
+
//#region src/dtmf.d.ts
|
|
4
|
+
declare const DTMF: {
|
|
5
|
+
phoneChars: readonly ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "#"];
|
|
6
|
+
charToPayloads(char: string): Buffer<ArrayBuffer>[];
|
|
7
|
+
payloadToChar(payload: Buffer): "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "*" | "#";
|
|
8
|
+
};
|
|
9
|
+
export = DTMF;
|
package/dist/dtmf.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Buffer } from "node:buffer";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
|
|
3
|
+
//#region src/dtmf.d.ts
|
|
4
|
+
declare const DTMF: {
|
|
5
|
+
phoneChars: readonly ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "#"];
|
|
6
|
+
charToPayloads(char: string): Buffer<ArrayBuffer>[];
|
|
7
|
+
payloadToChar(payload: Buffer): "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "*" | "#";
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { DTMF as default };
|
package/dist/dtmf.js
CHANGED
|
@@ -1,46 +1,42 @@
|
|
|
1
1
|
import { Buffer } from "node:buffer";
|
|
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
|
-
return DTMF.phoneChars[index];
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
var dtmf_default = DTMF;
|
|
44
|
-
export {
|
|
45
|
-
dtmf_default as default
|
|
2
|
+
//#region src/dtmf.ts
|
|
3
|
+
const phoneChars = [
|
|
4
|
+
"0",
|
|
5
|
+
"1",
|
|
6
|
+
"2",
|
|
7
|
+
"3",
|
|
8
|
+
"4",
|
|
9
|
+
"5",
|
|
10
|
+
"6",
|
|
11
|
+
"7",
|
|
12
|
+
"8",
|
|
13
|
+
"9",
|
|
14
|
+
"*",
|
|
15
|
+
"#"
|
|
16
|
+
];
|
|
17
|
+
const payloads = [
|
|
18
|
+
393216,
|
|
19
|
+
393376,
|
|
20
|
+
393536,
|
|
21
|
+
8782624,
|
|
22
|
+
8782624,
|
|
23
|
+
8782624
|
|
24
|
+
];
|
|
25
|
+
const DTMF = {
|
|
26
|
+
phoneChars,
|
|
27
|
+
charToPayloads(char) {
|
|
28
|
+
const index = phoneChars.indexOf(char[0]);
|
|
29
|
+
if (index === -1) throw new Error("invalid phone char");
|
|
30
|
+
return payloads.map((payload) => {
|
|
31
|
+
const temp = payload + index * 16777216;
|
|
32
|
+
const buffer = Buffer.alloc(4);
|
|
33
|
+
buffer.writeIntBE(temp, 0, 4);
|
|
34
|
+
return buffer;
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
payloadToChar(payload) {
|
|
38
|
+
return phoneChars[(payload.readIntBE(0, 4) - 393216) / 16777216];
|
|
39
|
+
}
|
|
46
40
|
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { DTMF as default };
|