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
@@ -0,0 +1,23 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ //#endregion
23
+ exports.__toESM = __toESM;
@@ -1,93 +1,51 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
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 inbound_exports = {};
29
- __export(inbound_exports, {
30
- default: () => inbound_default
31
- });
32
- module.exports = __toCommonJS(inbound_exports);
33
- var import_sip_message = require("../sip-message/index.js");
34
- var import_utils = require("../utils.js");
35
- var import_index = __toESM(require("./index.js"), 1);
36
- class InboundCallSession extends import_index.default {
37
- constructor(softphone, inviteMessage) {
38
- super(softphone, inviteMessage);
39
- this.localPeer = inviteMessage.headers.To;
40
- this.remotePeer = inviteMessage.headers.From;
41
- if (inviteMessage.body.length > 0) {
42
- this.remoteKey = inviteMessage.body.match(
43
- /AES_CM_128_HMAC_SHA1_80 inline:([\w+/]+)/
44
- )[1];
45
- }
46
- }
47
- async answer() {
48
- const answerSDP = `
1
+ const require_utils = require("../utils.cjs");
2
+ const require_sip_message_outbound_index = require("../sip-message/outbound/index.cjs");
3
+ require("../sip-message/index.cjs");
4
+ const require_call_session_index = require("./index.cjs");
5
+ //#region src/call-session/inbound.ts
6
+ var InboundCallSession = class extends require_call_session_index {
7
+ constructor(softphone, inviteMessage) {
8
+ super(softphone, inviteMessage);
9
+ this.localPeer = inviteMessage.headers.To;
10
+ this.remotePeer = inviteMessage.headers.From;
11
+ if (inviteMessage.body.length > 0) this.remoteKey = inviteMessage.body.match(/AES_CM_128_HMAC_SHA1_80 inline:([\w+/]+)/)[1];
12
+ }
13
+ async answer() {
14
+ const answerSDP = `
49
15
  v=0
50
16
  o=- ${Date.now()} 0 IN IP4 ${this.softphone.client.localAddress}
51
17
  s=rc-softphone-ts
52
18
  c=IN IP4 ${this.softphone.client.localAddress}
53
19
  t=0 0
54
- m=audio ${(0, import_utils.randomInt)()} RTP/SAVP ${this.softphone.codec.id} 101
20
+ m=audio ${require_utils.randomInt()} RTP/SAVP ${this.softphone.codec.id} 101
55
21
  a=rtpmap:${this.softphone.codec.id} ${this.softphone.codec.name}
56
22
  a=rtpmap:101 telephone-event/8000
57
23
  a=fmtp:101 0-15
58
24
  a=sendrecv
59
- a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:${import_utils.localKey}
25
+ a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:${require_utils.localKey}
60
26
  `.trim();
61
- this.sdp = answerSDP;
62
- const newMessage = new import_sip_message.OutboundMessage(
63
- "SIP/2.0 200 OK",
64
- {
65
- Via: this.sipMessage.headers.Via,
66
- "Call-ID": this.sipMessage.getHeader("Call-ID"),
67
- From: this.sipMessage.headers.From,
68
- To: this.sipMessage.headers.To,
69
- CSeq: this.sipMessage.headers.CSeq,
70
- Contact: `<sip:${this.softphone.sipInfo.username}@${this.softphone.client.localAddress}:${this.softphone.client.localPort};transport=TLS;ob>`,
71
- Allow: "PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS",
72
- Supported: "replaces, 100rel, timer, norefersub",
73
- "Session-Expires": "14400;refresher=uac",
74
- Require: "timer",
75
- "Content-Type": "application/sdp"
76
- },
77
- answerSDP
78
- );
79
- const ackMessage = await this.softphone.send(newMessage, true);
80
- if (ackMessage.body.length > 0) {
81
- this.remoteIP = ackMessage.body.match(/c=IN IP4 ([\d.]+)/)[1];
82
- this.remotePort = parseInt(
83
- ackMessage.body.match(/m=audio (\d+) /)[1],
84
- 10
85
- );
86
- this.remoteKey = ackMessage.body.match(
87
- /AES_CM_128_HMAC_SHA1_80 inline:([\w+/]+)/
88
- )[1];
89
- }
90
- this.startLocalServices();
91
- }
92
- }
93
- var inbound_default = InboundCallSession;
27
+ this.sdp = answerSDP;
28
+ const newMessage = new require_sip_message_outbound_index("SIP/2.0 200 OK", {
29
+ Via: this.sipMessage.headers.Via,
30
+ "Call-ID": this.sipMessage.getHeader("Call-ID"),
31
+ From: this.sipMessage.headers.From,
32
+ To: this.sipMessage.headers.To,
33
+ CSeq: this.sipMessage.headers.CSeq,
34
+ Contact: `<sip:${this.softphone.sipInfo.username}@${this.softphone.client.localAddress}:${this.softphone.client.localPort};transport=TLS;ob>`,
35
+ Allow: "PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS",
36
+ Supported: "replaces, 100rel, timer, norefersub",
37
+ "Session-Expires": "14400;refresher=uac",
38
+ Require: "timer",
39
+ "Content-Type": "application/sdp"
40
+ }, answerSDP);
41
+ const ackMessage = await this.softphone.send(newMessage, true);
42
+ if (ackMessage.body.length > 0) {
43
+ this.remoteIP = ackMessage.body.match(/c=IN IP4 ([\d.]+)/)[1];
44
+ this.remotePort = parseInt(ackMessage.body.match(/m=audio (\d+) /)[1], 10);
45
+ this.remoteKey = ackMessage.body.match(/AES_CM_128_HMAC_SHA1_80 inline:([\w+/]+)/)[1];
46
+ }
47
+ this.startLocalServices();
48
+ }
49
+ };
50
+ //#endregion
51
+ module.exports = InboundCallSession;
@@ -0,0 +1,10 @@
1
+ import InboundMessage from "../sip-message/inbound/index.cjs";
2
+ import CallSession from "./index.cjs";
3
+ import Softphone from "../index.cjs";
4
+
5
+ //#region src/call-session/inbound.d.ts
6
+ declare class InboundCallSession extends CallSession {
7
+ constructor(softphone: Softphone, inviteMessage: InboundMessage);
8
+ answer(): Promise<void>;
9
+ }
10
+ export = InboundCallSession;
@@ -1,8 +1,11 @@
1
- import type Softphone from "../index.js";
2
- import { type InboundMessage } from "../sip-message/index.js";
1
+ import InboundMessage from "../sip-message/inbound/index.js";
3
2
  import CallSession from "./index.js";
3
+ import Softphone from "../index.js";
4
+
5
+ //#region src/call-session/inbound.d.ts
4
6
  declare class InboundCallSession extends CallSession {
5
- constructor(softphone: Softphone, inviteMessage: InboundMessage);
6
- answer(): Promise<void>;
7
+ constructor(softphone: Softphone, inviteMessage: InboundMessage);
8
+ answer(): Promise<void>;
7
9
  }
8
- export default InboundCallSession;
10
+ //#endregion
11
+ export { InboundCallSession as default };
@@ -1,19 +1,17 @@
1
- import { OutboundMessage } from "../sip-message/index.js";
2
1
  import { localKey, randomInt } from "../utils.js";
2
+ import OutboundMessage from "../sip-message/outbound/index.js";
3
+ import "../sip-message/index.js";
3
4
  import CallSession from "./index.js";
4
- class InboundCallSession extends CallSession {
5
- constructor(softphone, inviteMessage) {
6
- super(softphone, inviteMessage);
7
- this.localPeer = inviteMessage.headers.To;
8
- this.remotePeer = inviteMessage.headers.From;
9
- if (inviteMessage.body.length > 0) {
10
- this.remoteKey = inviteMessage.body.match(
11
- /AES_CM_128_HMAC_SHA1_80 inline:([\w+/]+)/
12
- )[1];
13
- }
14
- }
15
- async answer() {
16
- const answerSDP = `
5
+ //#region src/call-session/inbound.ts
6
+ var InboundCallSession = class extends CallSession {
7
+ constructor(softphone, inviteMessage) {
8
+ super(softphone, inviteMessage);
9
+ this.localPeer = inviteMessage.headers.To;
10
+ this.remotePeer = inviteMessage.headers.From;
11
+ if (inviteMessage.body.length > 0) this.remoteKey = inviteMessage.body.match(/AES_CM_128_HMAC_SHA1_80 inline:([\w+/]+)/)[1];
12
+ }
13
+ async answer() {
14
+ const answerSDP = `
17
15
  v=0
18
16
  o=- ${Date.now()} 0 IN IP4 ${this.softphone.client.localAddress}
19
17
  s=rc-softphone-ts
@@ -26,39 +24,28 @@ a=fmtp:101 0-15
26
24
  a=sendrecv
27
25
  a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:${localKey}
28
26
  `.trim();
29
- this.sdp = answerSDP;
30
- const newMessage = new OutboundMessage(
31
- "SIP/2.0 200 OK",
32
- {
33
- Via: this.sipMessage.headers.Via,
34
- "Call-ID": this.sipMessage.getHeader("Call-ID"),
35
- From: this.sipMessage.headers.From,
36
- To: this.sipMessage.headers.To,
37
- CSeq: this.sipMessage.headers.CSeq,
38
- Contact: `<sip:${this.softphone.sipInfo.username}@${this.softphone.client.localAddress}:${this.softphone.client.localPort};transport=TLS;ob>`,
39
- Allow: "PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS",
40
- Supported: "replaces, 100rel, timer, norefersub",
41
- "Session-Expires": "14400;refresher=uac",
42
- Require: "timer",
43
- "Content-Type": "application/sdp"
44
- },
45
- answerSDP
46
- );
47
- const ackMessage = await this.softphone.send(newMessage, true);
48
- if (ackMessage.body.length > 0) {
49
- this.remoteIP = ackMessage.body.match(/c=IN IP4 ([\d.]+)/)[1];
50
- this.remotePort = parseInt(
51
- ackMessage.body.match(/m=audio (\d+) /)[1],
52
- 10
53
- );
54
- this.remoteKey = ackMessage.body.match(
55
- /AES_CM_128_HMAC_SHA1_80 inline:([\w+/]+)/
56
- )[1];
57
- }
58
- this.startLocalServices();
59
- }
60
- }
61
- var inbound_default = InboundCallSession;
62
- export {
63
- inbound_default as default
27
+ this.sdp = answerSDP;
28
+ const newMessage = new OutboundMessage("SIP/2.0 200 OK", {
29
+ Via: this.sipMessage.headers.Via,
30
+ "Call-ID": this.sipMessage.getHeader("Call-ID"),
31
+ From: this.sipMessage.headers.From,
32
+ To: this.sipMessage.headers.To,
33
+ CSeq: this.sipMessage.headers.CSeq,
34
+ Contact: `<sip:${this.softphone.sipInfo.username}@${this.softphone.client.localAddress}:${this.softphone.client.localPort};transport=TLS;ob>`,
35
+ Allow: "PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS",
36
+ Supported: "replaces, 100rel, timer, norefersub",
37
+ "Session-Expires": "14400;refresher=uac",
38
+ Require: "timer",
39
+ "Content-Type": "application/sdp"
40
+ }, answerSDP);
41
+ const ackMessage = await this.softphone.send(newMessage, true);
42
+ if (ackMessage.body.length > 0) {
43
+ this.remoteIP = ackMessage.body.match(/c=IN IP4 ([\d.]+)/)[1];
44
+ this.remotePort = parseInt(ackMessage.body.match(/m=audio (\d+) /)[1], 10);
45
+ this.remoteKey = ackMessage.body.match(/AES_CM_128_HMAC_SHA1_80 inline:([\w+/]+)/)[1];
46
+ }
47
+ this.startLocalServices();
48
+ }
64
49
  };
50
+ //#endregion
51
+ export { InboundCallSession as default };