npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ringover-sdk

v1.1.3

Published

Ringover SDK to import your favourite VOIP web app as an iframe on your interfaces

Downloads

870

Readme

Ringover SDK

Import easily the ringover web app iframe into your own project (like your crm)

You need a ringover account to properly use the following features.

Installation

Standalone file is available on:

https://webcdn.ringover.com/resources/SDK/1.1.3/ringover-sdk.js

Also the package is available on npm as ringover-sdk

https://www.npmjs.com/package/ringover-sdk

Setup

Browser


<script  src="ringover-sdk.js"  type="text/javascript"></script>

const  simpleSDK = new  window.RingoverSDK();
// ...

Node.js


npm install --save ringover-sdk

const RingoverSDK = require("ringover-sdk");
const simpleSDK = new RingoverSDK();
// ...

ES6 / Webpack


import RingoverSDK from "ringover-sdk";
const simpleSDK = new RingoverSDK();

// ...

AMD


require(["ringover-sdk"], function(RingoverSDK) {
    const simpleSDK = new RingoverSDK();
    //...
});

Usage


// Set options
const options = {animation: false, size: "auto"};

// Create instance
const simpleSDK = new window.RingoverSDK(options);

// Generate iframe
simpleSDK.generate();

// Set event
simpleSDK.on("ringingCall", (e) => console.log("Call with from number: " + e.data.from_number);

// Check iframe status
simpleSDK.checkStatus();

Configuration


new RingoverSDK({

	// "fixed", "relative", "absolute"
	type: "fixed",
	
	// "big", "medium", "small", "auto"
	size: "medium",
	
	container: null,
	
	position: {
		top: 	null,
		bottom: "50px"
		left: 	null,
		right: 	"50px"
	},
	
	// true, false
	border: true,

	// true, false
	animation: true,

	// "rgb(0,0,0)", "#eee", "red"
	backgroundColor: "transparent",

	// true, false
	trayicon: true,

	trayposition: {
		top: 	null,
		bottom: "10px"
		left: 	null,
		right: 	"10px"
	},
});

new RingoverSDK({options})

All option properties are optional.

Options

type: string

  • CSS position type.
  • Can be one of the following : ["fixed", "relative", "absolute"].
  • Default is "fixed".

size: string

  • Size of iframe.
  • Can be one of the following : ["big", "medium", "small", "auto"].
  • Default is "medium".
    • big: L: 1050px, H: 750px
    • medium: L: 380px, H: 620px
    • small: L: 350px, H: 500px
    • auto: L: 100% of container, H: 100% of container

container: string

  • Element id of container.
  • Default is null.
  • If the container is null the document.body is chosen by default.

position: object

backgroundcolor : string

  • Choose your background iframe color (only visible if trayicon is enable)
  • Can be any CSS background color format in string
  • Default is "transparent"

border: boolean

  • Choose if you want to display the border of the iframe.
  • Default is true.

animation: boolean

  • Choose if you want to have an animation when the iframe shows and hides
  • Default is true.

trayicon: boolean

  • Choose if you want to display a button to show and hide the iframe.
  • Default is true.

trayposition: object

API


const simpleSDK = new RingoverSDK();

// Iframe main methods
simpleSDK.generate();			// iframe element
simpleSDK.destroy();			// boolean
simpleSDK.checkStatus();		// boolean

// Display methods
simpleSDK.show();			// boolean
simpleSDK.hide();			// boolean
simpleSDK.toggle();			// boolean
simpleSDK.isDisplay();		// boolean

// Ringover methods
simpleSDK.logout();									// boolean
simpleSDK.reload();									// boolean
simpleSDK.getCurrentPage();							// string(pageName) | boolean(false)
simpleSDK.changePage("settings");					// boolean
simpleSDK.dial("+33179757575");						// boolean
simpleSDK.sendSMS("+33610001000", "Hello");			// boolean
simpleSDK.openCallLog("616626881427127983");		// boolean

// Events

simpleSDK.on('changePage',    (e) => console.log(e.data));
simpleSDK.on('dialerReady',   (e) => console.log(e.data));
simpleSDK.on('login',         (e) => console.log(e.data));
simpleSDK.on('logout',        (e) => console.log(e.data));
simpleSDK.on('ringingCall',   (e) => console.log(e.data));
simpleSDK.on('answeredCall',  (e) => console.log(e.data));
simpleSDK.on('hangupCall',    (e) => console.log(e.data));
simpleSDK.on('smsSent',    	  (e) => console.log(e.data));
simpleSDK.on('smsReceived',   (e) => console.log(e.data));
simpleSDK.off();

Methods

generate()

Create an iframe, place it in the DOM and return it.

Return: iframe element

destroy()

Remove iframe from the dom and destroy it. Return true if successful, return false if an error occurs.

Return: boolean

checkStatus()

Returns true if the iframe can be generated or is already in the DOM, returns false if an error occurs.

Return boolean

show() | hide() | toggle()

Show or hide the iframe (if animation: true, the animation is triggered).

Return boolean

isDisplay()

Return true if the iframe is displayed, return false if the iframe is hidden.

Return boolean

logout()

Logout the current user connected to the web app in the iframe. Return true if successful, return false if an error occurs.

Return boolean

reload()

Reload the web app in the iframe. Return true if successful, return false if an error occurs.

Return boolean

getCurrentPage()

Get the current web app page. Return false if an error occurs.

Return (string|boolean)

changePage(pageName)

Change the current web app page. Return true if successful, return false if an error occurs.

Parameters:

  • pageName: (string). Example: "dialer", "call-logs", "sms", "settings"...

Return boolean

dial(numberE164, fromNumberE164)

Call a specific number in the web app. Return true if successful, return false if an error occurs.

Parameters:

  • numberE164: (string|integer). Example: "+16467129500", "442038906606", 33179757575...
  • fromNumberE164: (string|integer). OPTIONAL Must be one of the numbers in the dialer presentation number list. Example: "+16467129500", "442038906606", 33179757575...

Return boolean

sendSMS(toNumberE164, content, fromNumberE164)

send an sms to a specific recipient from a mobile number. Return true if successful, return false if an error occurs.

Parameters:

  • toNumberE164: (string|integer). Example: "+16467129500", "442038906606", 33179757575...
  • content: (string). Example: "Hello, welcome to our service."...
  • fromNumberE164: (string|integer). OPTIONAL Example: "+16467129500", "442038906606", 33179757575...

Return boolean

openCallLog(call_id)

Open a specific call log by its call_id identifier. Return true if successful, return false if an error occurs.

Parameters:

  • call_id: (string). Example: "616626881427127983"...

Return boolean

on(eventName, myFunction)

Set a specific event listener to set up a function that will be called when the event is delivered. Return true if successful, return false if an error occurs.

Parameters:

  • eventName: (string). Example: "login", "dialerReady", "ringingCall", "changePage"... See below.
  • myFunction: (function).

Return boolean

off()

Remove all event listerners previously setted. Return true if successful, return false if an error occurs.

Return boolean

Events

changePage

Trigger a hook when the web app changes page. Return the new page name.

Return object:

{
	action: "changePage",
	data: {
		page: "settings"
	}
}
  • page: (string). Example: "dialer", "call-logs", "sms", "settings"...

dialerReady

Trigger a hook when the web app is ready to receive and make call. Return the current user id.

Return object:

{
	action: "dialerReady",
	data: {
		userId: 123
	}
}

login

Trigger a hook when the user logs on the web app. Return the current user id.

Return object:

{
	action: "login",
	data: {
		userId: 123
	}
}

logout

Trigger a hook when the user logs out the web app. Return the previous user id.

Return object:

{
	action: "logout",
	data: {
		userId: 123
	}
}

ringingCall

Trigger a hook when a call is ringing or is being dialed. Automatically open the iframe. Return data call.

Return object:

{
	action: "ringingCall",
	data: {
		direction: "out", // "in"|"out"
		from_number: "fromNumber", 
		to_number: "toNumber", 
		internal: false, // true|false 
		call_id: "123", 
		ringDuration: 0, 
		callDuration: 0
	}
}
  • direction: (string). Direction (context) of the call. Value can be "in" or "out".
  • from_number: (string). Caller E164 number.
  • to_number: (string). Callee E164 number.
  • internal: (boolean). True if the call is internal of the team (inter-users), false is the call is external.
  • call_id: (string). Identifier of the call.

answeredCall

Trigger a hook when a call is ringing or is being dialed. Return data call.

Return object:

{
	action: "answeredCall",
	data: {
		direction: "out", // "in"|"out"
		from_number: "fromNumber", 
		to_number: "toNumber", 
		internal: false, // true|false 
		call_id: "123", 
		ringDuration: 123, 
		callDuration: 0
	}
}
  • direction: (string). Direction (context) of the call. Value can be "in" or "out".
  • from_number: (string). Caller E164 number.
  • to_number: (string). Callee E164 number.
  • internal: (boolean). True if the call is internal of the team (inter-users), false is the call is external.
  • call_id: (string). Identifier of the call.
  • ringDuration: (integer). Duration in seconds of the ringing time (before answer).

hangupCall

Trigger a hook when a call is ringing or is being dialed. Return data call.

Return object:

{
	action: "hangupCall",
	data: {
		direction: "out", // "in"|"out"
		from_number: "fromNumber", 
		to_number: "toNumber", 
		internal: false, // true|false 
		call_id: "123", 
		ringDuration: 123, 
		callDuration: 123
	}
}
  • direction: (string). Direction (context) of the call. Value can be "in" or "out".
  • from_number: (string). Caller E164 number.
  • to_number: (string). Callee E164 number.
  • internal: (boolean). True if the call is internal of the team (inter-users), false is the call is external.
  • call_id: (string). Identifier of the call.
  • ringDuration: (integer). Duration in seconds of the ringing time (before answer).
  • callDuration: (integer). Duration in seconds of the call time (after answer).

smsSent

Trigger a hook when a sms is sendend. Return information about the sms.

Return object:

{
	action: "smsSent",
	data: {
		conversation_id: "123"
		to_number: "toNumber", 
		message: "Hello World",
	}
}
  • conversation_id: (string). Identifier of the conversation.
  • to_number: (string). SMS Recipient E164 number.
  • message: (string). Content of the message.

smsReceived

Trigger a hook when a sms is received. Return information about the sms.

Return object:

{
	action: "smsReceived",
	data: {
		conversation_id: "123"
		from_number: "fromNumber", 
		message: "Hello World",
	}
}
  • conversation_id: (string). Identifier of the conversation.
  • from_number: (string). SMS Sender E164 number.
  • message: (string). Content of the message.

License

Apache-2.0