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.
Files changed (66) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  2. package/dist/call-session/inbound.cjs +41 -83
  3. package/dist/call-session/inbound.d.cts +10 -0
  4. package/dist/call-session/inbound.d.ts +8 -5
  5. package/dist/call-session/inbound.js +36 -49
  6. package/dist/call-session/index.cjs +212 -269
  7. package/dist/call-session/index.d.cts +48 -0
  8. package/dist/call-session/index.d.ts +44 -39
  9. package/dist/call-session/index.js +204 -239
  10. package/dist/call-session/outbound.cjs +56 -99
  11. package/dist/call-session/outbound.d.cts +13 -0
  12. package/dist/call-session/outbound.d.ts +11 -8
  13. package/dist/call-session/outbound.js +54 -68
  14. package/dist/call-session/streamer.cjs +66 -111
  15. package/dist/call-session/streamer.d.cts +19 -0
  16. package/dist/call-session/streamer.d.ts +16 -13
  17. package/dist/call-session/streamer.js +61 -79
  18. package/dist/codec.cjs +68 -84
  19. package/dist/codec.d.cts +17 -0
  20. package/dist/codec.d.ts +15 -12
  21. package/dist/codec.js +65 -63
  22. package/dist/dtmf.cjs +42 -64
  23. package/dist/dtmf.d.cts +9 -0
  24. package/dist/dtmf.d.ts +9 -7
  25. package/dist/dtmf.js +40 -44
  26. package/dist/index.cjs +166 -248
  27. package/dist/index.d.cts +31 -0
  28. package/dist/index.d.ts +28 -24
  29. package/dist/index.js +156 -224
  30. package/dist/sip-message/inbound/index.cjs +16 -50
  31. package/dist/sip-message/inbound/index.d.cts +7 -0
  32. package/dist/sip-message/inbound/index.d.ts +5 -2
  33. package/dist/sip-message/inbound/index.js +14 -19
  34. package/dist/sip-message/index.cjs +11 -49
  35. package/dist/sip-message/index.d.cts +6 -0
  36. package/dist/sip-message/index.d.ts +6 -5
  37. package/dist/sip-message/index.js +6 -12
  38. package/dist/sip-message/outbound/index.cjs +10 -40
  39. package/dist/sip-message/outbound/index.d.cts +7 -0
  40. package/dist/sip-message/outbound/index.d.ts +5 -2
  41. package/dist/sip-message/outbound/index.js +9 -10
  42. package/dist/sip-message/outbound/request.cjs +20 -61
  43. package/dist/sip-message/outbound/request.d.cts +9 -0
  44. package/dist/sip-message/outbound/request.d.ts +7 -4
  45. package/dist/sip-message/outbound/request.js +17 -29
  46. package/dist/sip-message/outbound/response.cjs +25 -54
  47. package/dist/sip-message/outbound/response.d.cts +8 -0
  48. package/dist/sip-message/outbound/response.d.ts +6 -3
  49. package/dist/sip-message/outbound/response.js +24 -24
  50. package/dist/sip-message/response-codes.cjs +80 -100
  51. package/dist/sip-message/response-codes.d.cts +5 -0
  52. package/dist/sip-message/response-codes.d.ts +4 -2
  53. package/dist/sip-message/response-codes.js +80 -81
  54. package/dist/sip-message/sip-message.cjs +25 -52
  55. package/dist/sip-message/sip-message.d.cts +12 -0
  56. package/dist/sip-message/sip-message.d.ts +11 -9
  57. package/dist/sip-message/sip-message.js +25 -33
  58. package/dist/types.cjs +0 -15
  59. package/dist/types.d.cts +12 -0
  60. package/dist/types.d.ts +11 -8
  61. package/dist/types.js +1 -0
  62. package/dist/utils.cjs +27 -73
  63. package/dist/utils.d.cts +12 -0
  64. package/dist/utils.d.ts +12 -8
  65. package/dist/utils.js +15 -31
  66. 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
- id: number;
4
- name: "OPUS/16000" | "OPUS/48000/2" | "PCMU/8000";
5
- packetSize: number;
6
- timestampInterval: number;
7
- createEncoder: () => {
8
- encode: (pcm: Buffer) => Buffer;
9
- };
10
- createDecoder: () => {
11
- decode: (audio: Buffer) => Buffer;
12
- };
13
- constructor(name: "OPUS/16000" | "OPUS/48000/2" | "PCMU/8000");
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
- export default Codec;
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
- class Codec {
4
- id;
5
- name;
6
- packetSize;
7
- timestampInterval;
8
- createEncoder;
9
- createDecoder;
10
- constructor(name) {
11
- this.name = name;
12
- switch (name) {
13
- case "OPUS/16000": {
14
- this.createEncoder = () => {
15
- const encoder = new Encoder({ channels: 1, sample_rate: 16e3 });
16
- return { encode: (pcm) => Buffer.from(encoder.encode(pcm)) };
17
- };
18
- this.createDecoder = () => {
19
- const decoder = new Decoder({ channels: 1, sample_rate: 16e3 });
20
- return {
21
- decode: (opus) => Buffer.from(decoder.decode(opus))
22
- };
23
- };
24
- this.id = 109;
25
- this.packetSize = 640;
26
- this.timestampInterval = 320;
27
- break;
28
- }
29
- case "OPUS/48000/2": {
30
- this.createEncoder = () => {
31
- const encoder = new Encoder({ channels: 2, sample_rate: 48e3 });
32
- return { encode: (pcm) => Buffer.from(encoder.encode(pcm)) };
33
- };
34
- this.createDecoder = () => {
35
- const decoder = new Decoder({ channels: 2, sample_rate: 48e3 });
36
- return {
37
- decode: (opus) => Buffer.from(decoder.decode(opus))
38
- };
39
- };
40
- this.id = 111;
41
- this.packetSize = 3840;
42
- this.timestampInterval = 960;
43
- break;
44
- }
45
- case "PCMU/8000": {
46
- this.createEncoder = () => {
47
- return { encode: (pcm) => pcm };
48
- };
49
- this.createDecoder = () => {
50
- return { decode: (audio) => audio };
51
- };
52
- this.id = 0;
53
- this.packetSize = 160;
54
- this.timestampInterval = 160;
55
- break;
56
- }
57
- default: {
58
- throw new Error(`unsupported codec: ${name}`);
59
- }
60
- }
61
- }
62
- }
63
- var codec_default = Codec;
64
- export {
65
- codec_default as default
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
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
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
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
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;
@@ -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
- declare class DTMF {
3
- static readonly phoneChars: string[];
4
- private static readonly payloads;
5
- static charToPayloads: (char: string) => Buffer<ArrayBuffer>[];
6
- static payloadToChar: (payload: Buffer) => string;
7
- }
8
- export default DTMF;
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
- class DTMF {
3
- static 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
- static payloads = [
18
- 393216,
19
- 393376,
20
- 393536,
21
- 8782624,
22
- 8782624,
23
- 8782624
24
- ];
25
- static charToPayloads = (char) => {
26
- const index = DTMF.phoneChars.indexOf(char[0]);
27
- if (index === -1) {
28
- throw new Error("invalid phone char");
29
- }
30
- return DTMF.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
- static payloadToChar = (payload) => {
38
- const intBE = payload.readIntBE(0, 4);
39
- const index = (intBE - 393216) / 16777216;
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 };