telesale
v1.0.0
Published
add webrtc
Readme
Installation
Install this package with npm:
$ npm install telesaleor using yarn:
$ yarn add telesaleUsage
Import clvDevice in the module where you need it.
import { clvDevice } from "telesale";<audio id="clv-sipjs-remote-audio"></audio>Example config and initiation
let config = {
host: "sip.clv.com",
wsServers: "wss://sip.clv.com:7443",
displayName: "Phone User",
username: "testuser",
password: "testuserPassword",
};
let device = new clvDevice(config);
device.on("connecting", () => {
console.log("connecting!");
});
device.on("accepted", () => {
console.log("We're on a phone call!");
});
device.on("invite", (data) => {
console.log("Incoming", data);
});
device.on("accept", (accept) => {
console.log("accept", accept);
});
device.on("cancel", (cancel) => {
console.log("cancel", cancel);
});
device.on("rejected", (rejected) => {
console.log("rejected", rejected);
});
device.on("failed", (failed) => {
console.log("failed", failed);
});
device.on("bye", (bye) => {
console.log("bye", bye);
});
device.on("replaced", (replaced) => {
console.log("replaced", replaced);
});
device.on("rejected", (rejected) => {
console.log("rejected", rejected);
});
device.on("trackAdded", (trackAdded) => {
console.log("trackAdded", trackAdded);
});Example phone call
let activeCall = device.initiateCall("1235556789");
activeCall.on("connecting", () => {
console.log("it's connecting!");
});
activeCall.on("accepted", () => {
console.log("We're on a phone call!");
});Example answer
device.on("invite", (data) => {
console.log("Incoming", data);
});
device.accept();Example hangup
device.reject();See the clvDevice and clvCall for more details.
Development
Building the package
When working on the package directly, please use yarn instead of npm.
$ yarn build
# Or to watch for changes to files:
$ yarn startRunning tests
$ yarn testGenerating Docs
We use jsdoc-to-markdown to generate GitHub friendly docs.
$ yarn docs