ibridge-webphone
v2.1.7
Published
`npm i ibridge-webphone`
Readme
iBridge Webphone
*Check full docs here
Get Started
npm i ibridge-webphone
Import lib to the project
import { Webphone } from "ibridge-webphone"
Init Webphone
Webphone.init({
token: LOGGED_TOKEN_HERE,
environment: ENVIRONMENT_ID
}).then((webphone) => {
// your code here
});Actions
| Function | Description | |-------------------------------|----------------------------------| | openWebphone | Open webphone window | | closeWebphone | Close webphone window | | startCall(phone, destNumber?) | Init call | | acceptCall | Accept incoming call | | declineCall(cause?) | Decline incoming call | | hangupCall(cause?) | Hangup the current call | | transferCall(option, person) | Transfer the current call | | openDialer | Open the webphone dialer | | mute | Mute your mic | | holdCall | Put the current call on hold | | recCall | Start recording the call | | setNote(note) | Set a note for the call | | setTag(tag) | Set a tag for the call | | die | Terminate the webphone instance |
Events
| Event | Syntax | |----------|----------------------------------| | on | (eventName, callback) => void | | off | (eventName, callback) => void |
Infos
| Function | Description | |----------|------------------------------------| | isOpened | Check if webphone window is opened | | isClosed | Check if webphone window is closed |
Acceptable Params
| Key | Type | Required | Description | |-------------|--------|----------|-----------------------| | token | string | yes | Login token from user | | environment | string | yes | User's Environment | | profile | string | no | Profile Logged |
Example
Webphone.init({
token: LOGGED_TOKEN_HERE,
environment: ENVIRONMENT_ID
}).then((webphone) => {
document.getElementById("accept-call-btn").onclick(function() {
webphone.acceptCall();
});
}).catch(() => {
console.error("Error on init webphone");
});