Gathering detailed insights and metrics for @teravoz/react-webrtc-adapter
Gathering detailed insights and metrics for @teravoz/react-webrtc-adapter
Gathering detailed insights and metrics for @teravoz/react-webrtc-adapter
Gathering detailed insights and metrics for @teravoz/react-webrtc-adapter
React WebRTC Adapter for the Teravoz WebRTC Client
npm install @teravoz/react-webrtc-adapter
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
6 Stars
45 Commits
5 Watchers
18 Branches
4 Contributors
Updated on Aug 01, 2020
Latest Version
0.11.0-beta
Package Id
@teravoz/react-webrtc-adapter@0.11.0-beta
Unpacked Size
35.90 kB
Size
11.70 kB
File Count
5
NPM Version
6.9.0
Node Version
10.16.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
React HOC that binds the Teravoz WebRTC Library to your component props.
Have Teravoz WebRTC bound to wherever you want.
1import React, { Component } from 'react'; 2import teravozWebRTCAdapter from '@teravoz/react-webrtc-adapter'; 3 4class MyComponent extends Component { 5 6 render() { 7 this.props.teravoz.* 8 ... 9 } 10} 11 12exports default teravozWebRTCAdapter(MyComponent, { 13 apiKey: '<your-api-key>' 14});
This is a React module that wraps the Teravoz WebRTC adapter and is available through the npm.
Installation is done with npm install
or yarn add
:
1npm install --save @teravoz/react-webrtc-adapter 2# or 3yarn add @teravoz/react-webrtc-adapter
There are several methods that enables the communication capabilities. Below you can find all the methods provided by the Teravoz Library to register a peer and make/receive calls. For detailed information, see the Methods Reference.
register
1this.props.teravoz.register('101', '***');
The register('username', 'password')
method is required to initialize a session with the Teravoz platform.
string
, required) - your peer username (usually the number)string
, required) - your peer passwordThe register
method emits the registering/registered/registrationFailed events. Once the registered
is emitted, you are able to make and receive calls.
unregister
1this.props.teravoz.unregister();
The unregister()
method must be used when a user/peer needs to be unregistered.
dial
1this.props.teravoz.dial('011987654321');
The dial('number')
method must be used to start a call.
string
, required) - the number who will be calledhold
1this.props.teravoz.hold();
The hold()
method put an ongoing call in a holding state.
unhold
1this.props.teravoz.unhold();
The unhold()
method recovers a holded call to an ongoing state.
mute
1this.props.teravoz.mute();
The mute()
method mute an ongoing call.
unmute
1this.props.teravoz.unmute();
The unmute()
method unmute an ongoing call.
hangUp
1this.props.teravoz.hangUp();
The hangUp()
method hang up an ongoing call.
sendDTMF
1this.props.teravoz.sendDTMF('3', { 2 duration: 500, 3 gap: 50 4});
The sendDTMF('tone', options = { duration, gap })
method sends a tone.
char
) - the tone to be sentobject
, optional) - the DTMF options to send the tone.
int
, default = 500
) - the tone sound duration in millisecondsint
, default = 50
) - the gap between the tones in millisecondsThere are several events received by the Teravoz WebRTC Adapter during a session. For detailed information, see the Events Reference.
These events are received when a registration is requested.
To receive and manage all events indiscriminately, use the *
operator:
1this.props.teravoz.events.on('*', (type, payload) => { 2 switch(type) { 3 case 'registering': 4 case 'registered': 5 ... 6 } 7});
registering
1this.props.teravoz.events.on('registering', () => { ... });
The registering
event is received when the register
method is called.
registered
1this.props.teravoz.events.on('registered', () => { ... });
The registered
event is received once the peer is succesfull registered (username and password are valid).
registrationFailed
1this.props.teravoz.events.on('registrationFailed', () => { ... });
The registrationFailed
event is received when the username and password are not valid.
unregistering
1this.props.teravoz.events.on('unregistering', () => { ... });
The unregistering
event is received when the unregister()
method is called.
unregistered
1this.props.teravoz.events.on('unregistered', () => { ... });
The unregistered
event is received once the peer is succesfull unregistered.
incomingCall
1this.props.teravoz.events.on('incomingCall', (theirNumber, actions) => { 2 console.info('Receiving and accepting call from', theirNumber); 3 actions.accept(); // accepts the incoming call 4 // or 5 actions.decline(); // declines the incoming call 6});
The incomingCall
event is received when an incoming call is received. It receives two arguments in the callback:
string
) - the number who is callingobject
) - a call management actions
object
function
) - accepts the current incoming callfunction
) - declines the current incoming callacceptedCall
1this.props.teravoz.events.on('acceptedCall', (theirNumber) => { ... });
The acceptedCall
event is received when a call is accepted by the incomingCall
's actions
. It receives one argument in the callback:
string
) - the number who calledisReceivingMedia
1this.props.teravoz.events.on('isReceivingMedia', (mediaType, on)) => { ... });
The isReceivingMedia
event is received once the connection is established between the sides. It receives two arguments in the callback:
string
) - the value audio
boolean
) - if the media is being transferedDTMF
1this.props.teravoz.events.on('DTMF', () => { ... });
The DTMF
event is received when additional information is requested.
hangingUp
1this.props.teravoz.events.on('hangingUp', () => { ... });
The hangingUp
event is received once a call is succesfully hanged up.
hangUp
1this.props.teravoz.events.on('hangUp', () => { ... });
The hangUp
event is received when the hangUp()
method is called.
missedCall
1this.props.teravoz.events.on('missedCall', (theirNumber) => { ... });
The missedCall
event is received when you received a call but did not answered. It receives one argument in the callback:
string
) - the number who calledcleanUp
1this.props.teravoz.events.on('cleanUp', () => { ... });
The cleanUp
event is received everytime a call lifecycle ends.
calling
1this.props.teravoz.events.on('calling', () => { ... });
The calling
event is received when the dial()
method is called.
PS: when the
calling
event is received the call is not actually ringing yet. In other words, the call did not reach the carrier yet. This event refers to an intermediate state between thedial
and theringing
states of a call. In this point you should consider using some fake audio to simulate the ringing.
earlyMedia
1this.props.teravoz.events.on('earlyMedia', (theirNumber) => { ... });
The earlyMedia
event is received when a connection is in fact established, even if the call goes to the voicemail.. It receives one argument in the callback:
string
) - the number who is callingwebRTCState
1this.props.teravoz.events.on('webRTCState', (on) => { ... });
The webRTCState
event is received when there is a change in the WebRTC state. It receive one argument in the callback:
boolean
) - if the WebRTC is onNo vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 4/18 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
65 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More