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

piopiyjs

v0.10.0

Published

PIOPIY WebRTC javascript browser SDK

Downloads

161

Readme

PIOPIY Client JS SDK for voice

PIOPIY WebRTC SDK allows you to make and receive voice calls, where making voice calls can be made to a public switched telephone network(PSTN), APP to APP calling and browser to browser calling.

Package Installation

Using NPM

 npm install piopiyjs

Using YARN

 yarn add piopiyjs

Using Bower

 bower install telecmi/piopiy_client_js

Monolithic Import

In Browser

 <script src="dist/piopiy.min.js" type="text/javascript"></script>

In ESM/Typescript

 import PIOPIY from 'piopiyjs';

In CommonJS

 var PIOPIY = require('piopiyjs');

Initializing the PIOPIY Object

var piopiy = new PIOPIY( {
        name: 'Display Name',
        debug: false,
        autoplay: true,
        ringTime: 60
    } );

Configuration Parameters

Below is the configuration parameters

| Attribute | Description | Allowed Values | Default Value | | --- | --- | --- | --- | | name | Your Display Name in App | string | none | | debug | Enable debug message in browser console | Boolean | false | | autoplay | Handle media stream automatically | Boolean | true | | ringTime | Your incoming call ringing time in seconds | number | 60 |

PIOPIY Methods

Login

Using this method user can able to connect with TeleCMI SBC.

piopiy.login('user_id','password','SBC_URI');

Configuration Parameters

| Parameter Name| Type | Description |
| --- | --- | --- | | user_id | string | The user login ID | | password | string | The user login Password | | SBC_URI | url | ASIA - sbcsg.telecmi.comEurope - sbcuk.telecmi.comAmerica - sbcus.telecmi.comIndia - sbcind.telecmi.com |

Make call

Using this method user can able to make call to PSTN or Other user extension.

piopiy.call('PHONE_NUMBER');

Configuration Parameters

| Parameter Name| Type | Description |
| --- | --- | --- | | PHONE_NUMBER | string | Enter phone number or user extention number ,Phone number start with country code example '13158050050' |

Send DTMF

Using this method user can able to send DTMF tone to ongoing call.

piopiy.sendDtmf('DTMF_TONE');

Configuration Parameters

| Parameter Name| Type | Description |
| --- | --- | --- | | DTMF_TONE| string | Your DTMF tone input |

Hold Call

Using this method user can able to hold ongoing call.

piopiy.hold();

Unhold Call

Using this method user can able to unhold ongoing call.

piopiy.unHold();

Mute Call

Using this method user can able to mute ongoing call.

piopiy.mute();

Unmute Call

Using this method user can able to unmute ongoing call.

piopiy.unMute();

Answer call

Using this method user can able to answer incoming call.

piopiy.answer();

Reject call

Using this method user can able to reject or disconnect incoming call.

piopiy.reject();

Hangup call

Using this method user can able to hangup ongoing call.

piopiy.terminate();

Logout

Using this method user can able to logout from SBC session.

piopiy.logout();

PIOPIY Call Event Handler

Login

This event will triger when user login sucessfully

piopiy.on( 'login', function ( object ) {

    //  Data is JSON it contain event and status.
});

Example

piopiy.on( 'login', function ( object ) {
       
    if(object.code == 200) {
   
        //  Login successfully and do your stuff here.
        
    }   
});

List of event and status

| code | status | | --- | --- | | 200 | Login Successfully |

LoginFailed

This event will trigger when user authentication failed.

piopiy.on( 'loginFailed', function ( object ) {

    //  Data is JSON it contain event and status.
});

Example

 piopiy.on( 'loginFailed', function ( object ) {
       
    if(object.code == 401) {

        //  Verify that the user_id and password are correct. 
    }
});

List of event and status

| code | status | | --- | --- | | 401 | Invalid user_id or password |

Trying

This event will trigger when user make call to phone number or extention (Destination Number)

piopiy.on( 'trying', function ( object ) {

    //  Data is JSON it contain event and status.
});

Example

piopiy.on( 'trying', function ( object ) {
        
    if(object.code == 100 ) {

        //  The outgoing call is currently being started.
    }
});

List of event and status

| code | status | type | call_id | | --- | --- | --- | --- | | 100 | trying | ougoing | 95ea3424-d77e-123b-0ca1-463d48e96190 |

Ringing

This event will trigger when call start ringing.

piopiy.on( 'ringing', function ( object ) {

    //  Data is JSON it contain event and status.
});

Example

piopiy.on( 'ringing', function ( object ) {
        
    if(object.code == 183) {

        // An incoming or outgoing call is ringing.        
    }
});

List of event and status

| code | status | type | call_id | | --- | --- | --- | --- | | 183 | ringing | outgoing & incoming | 95ea3424-d77e-123b-0ca1-463d48e96190 |

Answered

This event will trigger when ongoing call was answered.

piopiy.on( 'answered', function ( object ) {

    //  Data is JSON it contain event and status.
});

Example

piopiy.on( 'answered', function ( object ) {
        
    if(object.code == 200) {

        // An incoming or outgoing call is answered.
    }
});

List of event and status

| code | status | call_id | | --- | --- | --- | | 200 | answered | 95ea3424-d77e-123b-0ca1-463d48e96190 |

CallStream

This event will trigger when mediastream established.

piopiy.on( 'callStream', function ( object ) {

    //  Data is JSON it contain event and status.
});

Example

piopiy.on( 'callStream', function ( object ) {
          
    // MediaStream has been established.
});

List of event and status

| code | status | call_id | | --- | --- | --- | | 200 | MediaStream | 95ea3424-d77e-123b-0ca1-463d48e96190 |

InComingCall

This event will trigger when user recive incmoing call.

piopiy.on( 'inComingCall', function ( object ) {

    //  Data is JSON it contain event and status.
});

Hangup

This event will trigger when user reject or hangup incmoing call.

piopiy.on( 'hangup', function ( object ) {

    //  Data is JSON it contain event and status.
});

Example

piopiy.on( 'hangup', function ( object ) {
        
    if(object.code == 200 ) {

        //  to hangup the incoming and ongoing calls.
    }
});

List of event and status

| code | status | call_id | | --- | --- | --- | | 200 | call hangup | 95ea3424-d77e-123b-0ca1-463d48e96190 |

Ended

This event will trigger when ongoing call end.

piopiy.on( 'ended', function ( object ) {

    //  Data is JSON it contain event and status.
});

Example

piopiy.on( 'ended', function ( object ) {
        
    if(object.code == 200 ) {

        //  An incoming or outgoing call is ended.
    }
});

List of event and status

| code | status | call_id | | --- | --- | --- | | 200 | call ended , Unavailable , Busy & Canceled | 95ea3424-d77e-123b-0ca1-463d48e96190 |

Hold

This event will trigger when ongoing call on hold.

piopiy.on( 'hold', function ( object ) {

    //  Data is JSON it contain event and status.
});

Example

piopiy.on( 'hold', function ( object ) {
        
    if(object.code == 200 ) {

        //  The call is now being hold.
    }
});

List of event and status

| code | status | whom | call_id | | --- | --- | --- | --- | | 200 | call on hold | myself | 95ea3424-d77e-123b-0ca1-463d48e96190 |

UnHold

This event will trigger when ongoing call on unhold.

piopiy.on( 'unhold', function ( object ) {

    //  Data is JSON it contain event and status.
});

Example

piopiy.on( 'unhold', function ( object ) {
        
    if(object.code == 200 ) {

        //  The call is now being released.
    }
});

List of event and status

| code | status | whom | call_id | | --- | --- | --- | --- | | 200 | call on active | myself | 95ea3424-d77e-123b-0ca1-463d48e96190 |

Error

This event will trigger when error will occurr.

piopiy.on( 'error', function ( object ) {

    //  Data is JSON it contain event and status.
});

Example

piopiy.on( 'error', function ( object ) {
        
    if(object.code == 1001 || object.code == 1002) {

        //  If there are any incorrect commands in the function, displays error.
    }
});

List of event and status

| code | status | | --- | --- | | 1001 & 1002 | common error |

Logout

This event will trigger when user logout .

piopiy.on( 'logout', function ( object ) {

    //  Data is JSON it contain event and status.
});

Example

piopiy.on( 'logout', function ( object ) {
        
    if(object.code == 200 ) {

        //  The user logged out successfully. 
    }
});

List of event and status

| code | status | | --- | --- | | 200 | logout successfully |