ringcentral-softphone 1.0.3 → 1.0.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/README.md CHANGED
@@ -142,6 +142,26 @@ You may play saved audio by the following command:
142
142
  play -t raw -b 16 -r 16000 -e signed-integer test.wav
143
143
  ```
144
144
 
145
+ To stream an audio file to remote peer, you need to make sure that the audio file is playable by the command above.
146
+
147
+ #### ffmpeg
148
+
149
+ If you prefer ffmpeg, here is the command to play the file:
150
+
151
+ ```
152
+ ffplay -autoexit -f s16le -ar 16000 test.wav
153
+ ```
154
+
155
+ #### how to generate audio file for testing
156
+
157
+ On macOS:
158
+
159
+ ```
160
+ say "Hello world" -o test.wav --data-format=LEI16@16000
161
+ ```
162
+
163
+ For Linux and Windows, please do some investigation yourself. Audio file generation is out of scope of this SDK.
164
+
145
165
  ### Multiple instances with same credentials
146
166
 
147
167
  You can run multiple softphone instances with the same credentials without encountering any errors. However, only the most recent instance will receive inbound calls.
@@ -1,2 +1,4 @@
1
- import { OpusEncoder } from '@discordjs/opus';
2
- export declare const opus: OpusEncoder;
1
+ export declare const opus: {
2
+ encode: (pcm: Buffer) => Buffer<Uint8Array<ArrayBufferLike>>;
3
+ decode: (opus: Buffer) => Buffer<Uint8Array<ArrayBufferLike>>;
4
+ };
package/dist/src/codec.js CHANGED
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.opus = void 0;
4
- const opus_1 = require("@discordjs/opus");
5
- exports.opus = new opus_1.OpusEncoder(16000, 1);
4
+ const opus_1 = require("@evan/opus");
5
+ const encoder = new opus_1.Encoder({ channels: 1, sample_rate: 16000 });
6
+ const decoder = new opus_1.Decoder({ channels: 1, sample_rate: 16000 });
7
+ exports.opus = {
8
+ encode: (pcm) => Buffer.from(encoder.encode(pcm)),
9
+ decode: (opus) => Buffer.from(decoder.decode(opus)),
10
+ };
6
11
  //# sourceMappingURL=codec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/codec.ts"],"names":[],"mappings":";;;AAAA,0CAA8C;AAEjC,QAAA,IAAI,GAAG,IAAI,kBAAW,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/codec.ts"],"names":[],"mappings":";;;AAAA,qCAA8C;AAE9C,MAAM,OAAO,GAAG,IAAI,cAAO,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;AACjE,MAAM,OAAO,GAAG,IAAI,cAAO,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;AAEpD,QAAA,IAAI,GAAG;IAClB,MAAM,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACzD,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CAC5D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ringcentral-softphone",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "homepage": "https://github.com/ringcentral/ringcentral-softphone-ts",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/softphone.js",
@@ -12,13 +12,13 @@
12
12
  "prepublishOnly": "rm -rf *.wav && rm -rf dist && yarn tsc --skipLibCheck"
13
13
  },
14
14
  "dependencies": {
15
- "@discordjs/opus": "^0.9.0",
16
- "wait-for-async": "^0.7.0",
17
- "werift-rtp": "^0.8.2"
15
+ "@evan/opus": "^1.0.3",
16
+ "wait-for-async": "^0.7.5",
17
+ "werift-rtp": "^0.8.3"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@rc-ex/core": "^1.4.2",
21
- "@types/node": "^22.10.2",
21
+ "@types/node": "^22.10.5",
22
22
  "dotenv-override-true": "^6.2.2",
23
23
  "eslint-config-tyler": "^0.2.2",
24
24
  "sort-package-json": "^2.12.0",
package/src/codec.ts CHANGED
@@ -1,3 +1,9 @@
1
- import { OpusEncoder } from '@discordjs/opus';
1
+ import { Decoder, Encoder } from "@evan/opus";
2
2
 
3
- export const opus = new OpusEncoder(16000, 1);
3
+ const encoder = new Encoder({ channels: 1, sample_rate: 16000 });
4
+ const decoder = new Decoder({ channels: 1, sample_rate: 16000 });
5
+
6
+ export const opus = {
7
+ encode: (pcm: Buffer) => Buffer.from(encoder.encode(pcm)),
8
+ decode: (opus: Buffer) => Buffer.from(decoder.decode(opus)),
9
+ };