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

@yayfon/yayfon-js-sdk

v2.0.3

Published

SIP.js based SDK for YayFon takes care of WebRTC and SIP signaling

Downloads

13

Readme

YayFon-js-SDK

Sip.js-based JavaScript library that helps developers make applications for online calls.

YayFon-js-SDK features:

  • Audio and Video calls support
  • Uses State Machine
  • Blind and Attended transfers

Get the SDK package:

$ npm i @yayfon/yayfon-js-sdk

Usage

Example with login and bundled SDK can be found in "example" folder.

To start example run:

$ npm i
$ npm run build 

API

YayFonSdk

Class for init connection, make calls, attended transfer and confirm transfer

$ getCallInfo()

Returns info about current call

$ getCallId()

Returns current call id

$ getAttendedCallId()

Returns id of call with second agent after attended transfer

$ call(phoneNumber, organizationId?)

Makes an outgoing multimedia call. If you consist in 2 or more organizations, you should set parameter organizationId phoneNumber - destination of the call

organizationId - ID of the organization you are trying to call

$ endCall()

Declines all calls and cleans object with all information about calls

$ attendedTransfer(agent, phoneNumber)

The current call is put on hold and another call is initiated to confirm whether the end destination actually wants to take the call or not agent - object with info about current call (YayFonCall) phoneNumber - destination of the call

$ endAttendedCall()

Declines only the person to whom the transfer was made

$ confirmTransfer()

Connects two agents after attended transfer and terminates current call

$ onRegister(callback)

Fired for successful registration callback - function that runs, when event fired

$ onRegistrationFailed(callback)

Fired for registration failure callback - function that runs, when event fired

$ onUnregistered(callback)

Fired for unregistration callback - function that runs, when event fired

$ logout()

Disconnects from the WebSocket server after gracefully unregistering and terminates any active sessions

$ getToken()

Returns auth token

Comment: If you have the call and at this moment someone calling to you, then first person is on hold and you can accept the second call.

YayFonCall

Class to manage calls

$ getSession()

Returns info about current session

$ getSessionId()

Returns id of current session

$ answer()

Answer the incoming session. Available only for incoming call

$ endCall()

Terminates current call

$ blindTransfer(phoneNumber)

Transfers the caller to another agent without speaking to the new agent first phoneNumber - destination of the call

$ hold()

Puts the call on hold

$ unhold()

Resumes the call from hold

$ mute(true)

Mutes the local audio and/or video

$ unmute()

Unmutes the local audio and/or video

$ isIncomingCall()

Determines if the call is incoming

$ onAccept(callback)

Fired each time a successful final (200-299) response is received callback - function that runs, when event fired

$ onProgress(callback)

Fired each time a provisional response is received callback - function that runs, when event fired

$ onEnd(callback)

Fired when an established call ends callback - function that runs, when event fired

$ onFail(callback)

Fired when the request fails, whether due to an unsuccessful final response or due to timeout, transport, or other callback - function that runs, when event fired