ringcentral-softphone
Advanced tools
Comparing version 1.0.7 to 1.1.0-beta.2
{ | ||
"name": "ringcentral-softphone", | ||
"version": "1.0.7", | ||
"version": "1.1.0-beta.2", | ||
"homepage": "https://github.com/ringcentral/ringcentral-softphone-ts", | ||
"license": "MIT", | ||
"main": "dist/src/softphone.js", | ||
"types": "dist/src/softphone.d.ts", | ||
"main": "dist/cjs/index.js", | ||
"types": "dist/cjs/index.d.ts", | ||
"module": "dist/esm/index.js", | ||
"exports": { | ||
".": { | ||
"import": "./dist/esm/index.js", | ||
"require": "./dist/cjs/index.js", | ||
"types": "./dist/esm/index.d.ts" | ||
}, | ||
"./*": { | ||
"import": "./dist/esm/*.js", | ||
"require": "./dist/cjs/*.js", | ||
"types": "./dist/esm/*.d.ts" | ||
} | ||
}, | ||
"scripts": { | ||
"in": "rm -rf *.wav && tsx -r dotenv-override-true/config demos/inbound-call.ts", | ||
"lint": "eslint --fix . && prettier --write . && sort-package-json", | ||
"out": "rm -rf *.wav && tsx -r dotenv-override-true/config demos/outbound-call.ts", | ||
"prepublishOnly": "rm -rf *.wav && rm -rf dist && yarn tsc --skipLibCheck" | ||
"build": "tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json", | ||
"prepublishOnly": "yarn build", | ||
"postpublish": "rm -rf dist" | ||
}, | ||
"dependencies": { | ||
"@evan/opus": "^1.0.3", | ||
"wait-for-async": "^0.7.5", | ||
"werift-rtp": "^0.8.3" | ||
"wait-for-async": "^0.7.9", | ||
"werift-rtp": "^0.8.4" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"devDependencies": { | ||
"@rc-ex/core": "^1.4.2", | ||
"@types/node": "^22.10.5", | ||
"@rc-ex/core": "^1.5.0", | ||
"@types/node": "^22.10.10", | ||
"dotenv-override-true": "^6.2.2", | ||
"eslint-config-tyler": "^0.2.2", | ||
"sort-package-json": "^2.12.0", | ||
"sort-package-json": "^2.14.0", | ||
"tsx": "^4.19.2", | ||
"ttpt": "^0.13.0", | ||
"typescript": "^5.7.2", | ||
"typescript": "^5.7.3", | ||
"yarn-upgrade-all": "^0.7.4" | ||
} | ||
} |
# RingCentral Softphone SDK for TypeScript | ||
This is a TypeScript SDK for RingCentral Softphone. It is a complete rewrite of the [RingCentral Softphone SDK for JavaScript](https://github.com/ringcentral/ringcentral-softphone-js) | ||
This is a TypeScript SDK for RingCentral Softphone. It is a complete rewrite of | ||
the | ||
[RingCentral Softphone SDK for JavaScript](https://github.com/ringcentral/ringcentral-softphone-js) | ||
@@ -24,14 +26,19 @@ Users are recommended to use this SDK instead of the JavaScript SDK. | ||
7. Click the link "Set up manually using SIP" | ||
8. You will find "SIP Domain", "Outbound Proxy", "User Name", "Password" and "Authorization ID" | ||
8. You will find "SIP Domain", "Outbound Proxy", "User Name", "Password" and | ||
"Authorization ID" | ||
Please note that, "SIP Domain" name should come without port number. I don't know why it shows a port number on the page. | ||
This SDK requires a "domain" which is "SIP Domain" but without the port number. | ||
Please note that, "SIP Domain" name should come without port number. I don't | ||
know why it shows a port number on the page. This SDK requires a "domain" which | ||
is "SIP Domain" but without the port number. | ||
### Programmatically | ||
Invoke this RESTful API: https://developers.ringcentral.com/api-reference/Devices/readDeviceSipInfo | ||
Invoke this RESTful API: | ||
https://developers.ringcentral.com/api-reference/Devices/readDeviceSipInfo | ||
Please note that, in order to invoke this API, you need to be familiar with RingCentral RESTful programmming. | ||
Please note that, in order to invoke this API, you need to be familiar with | ||
RingCentral RESTful programmming. | ||
Here is a demo: https://github.com/tylerlong/rc-get-device-info-demo/blob/main/src/demo.ts | ||
Here is a demo: | ||
https://github.com/tylerlong/rc-get-device-info-demo/blob/main/src/demo.ts | ||
@@ -96,5 +103,5 @@ The credentials data returned by that API is like this: | ||
You will need to choose a outboundProxy value based on your location. | ||
And please choose the `proxyTLS` value because this SDK uses TLS. | ||
For example if you live in north America, choose `sip10.ringcentral.com:5096`. | ||
You will need to choose a outboundProxy value based on your location. And please | ||
choose the `proxyTLS` value because this SDK uses TLS. For example if you live | ||
in north America, choose `sip10.ringcentral.com:5096`. | ||
@@ -104,3 +111,3 @@ ## Usage | ||
```ts | ||
import Softphone from 'ringcentral-softphone'; | ||
import Softphone from "ringcentral-softphone"; | ||
@@ -135,8 +142,7 @@ const softphone = new Softphone({ | ||
The codec used between server and client is "OPUS/16000". | ||
This SDK will auto decode/encode the codec to/from "uncompressed PCM". | ||
The codec used between server and client is "OPUS/16000". This SDK will auto | ||
decode/encode the codec to/from "uncompressed PCM". | ||
Bit rate is 16, which means 16 bits per sample. | ||
Sample rate is 16000, which means 16000 samples per second. | ||
Encoding is "signed-integer". | ||
Bit rate is 16, which means 16 bits per sample. Sample rate is 16000, which | ||
means 16000 samples per second. Encoding is "signed-integer". | ||
@@ -149,3 +155,4 @@ You may play saved audio by the following command: | ||
To stream an audio file to remote peer, you need to make sure that the audio file is playable by the command above. | ||
To stream an audio file to remote peer, you need to make sure that the audio | ||
file is playable by the command above. | ||
@@ -168,13 +175,18 @@ #### ffmpeg | ||
For Linux and Windows, please do some investigation yourself. Audio file generation is out of scope of this SDK. | ||
For Linux and Windows, please do some investigation yourself. Audio file | ||
generation is out of scope of this SDK. | ||
### Multiple instances with same credentials | ||
You can run multiple softphone instances with the same credentials without encountering any errors. However, only the most recent instance will receive inbound calls. | ||
You can run multiple softphone instances with the same credentials without | ||
encountering any errors. However, only the most recent instance will receive | ||
inbound calls. | ||
In the future, we may consider supporting multiple active instances using the same credentials. For now, we believe there is no demand for this functionality. | ||
In the future, we may consider supporting multiple active instances using the | ||
same credentials. For now, we believe there is no demand for this functionality. | ||
### Invalid callee number | ||
If you call an invalid number. The sip server will return "SIP/2.0 486 Busy Here". | ||
If you call an invalid number. The sip server will return "SIP/2.0 486 Busy | ||
Here". | ||
@@ -186,4 +198,4 @@ This SDK will emit a "busy" event for the call session and dispose it. | ||
```ts | ||
callSession.once('busy', () => { | ||
console.log('cannot reach the callee number'); | ||
callSession.once("busy", () => { | ||
console.log("cannot reach the callee number"); | ||
}); | ||
@@ -194,6 +206,7 @@ ``` | ||
When you get audio from a call session, you may forward it to another call session: | ||
When you get audio from a call session, you may forward it to another call | ||
session: | ||
```ts | ||
callSession1.on('rtpPacket', (rtpPacket: RtpPacket) => { | ||
callSession1.on("rtpPacket", (rtpPacket: RtpPacket) => { | ||
if (rtpPacket.header.payloadType === 109) { | ||
@@ -214,6 +227,14 @@ // 109 is for opus audio packet | ||
Content below is for the maintainer of this SDK. | ||
Content below is for the maintainer/contributor of this SDK. | ||
- We don't need to explicitly tell remote server our local UDP port (for audio streaming) via SIP SDP message. We send a RTP message to the remote server first, so the remote server knows our IP and port. So, the port number in SDP message could be fake. | ||
- We don't need to explicitly tell remote server our local UDP port (for audio | ||
streaming) via SIP SDP message. We send a RTP message to the remote server | ||
first, so the remote server knows our IP and port. So, the port number in SDP | ||
message could be fake. | ||
- Ref: https://www.ietf.org/rfc/rfc3261.txt | ||
- Caller Id feature is not supported. `P-Asserted-Identity` doesn't work. I think it is by design, since hardphone cannot support it. | ||
- Caller Id feature is not supported. `P-Asserted-Identity` doesn't work. I | ||
think it is by design, since hardphone cannot support it. | ||
#### Code style | ||
We use `deno fmt` to format all code. |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 6 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
281905
8
107
4305
232
1
1
1
Updatedwait-for-async@^0.7.9
Updatedwerift-rtp@^0.8.4