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

react-native-twilio-voice-sdk

v0.5.2

Published

React Native wrapper for Twilio Programmable Voice SDK

Downloads

113

Readme

react-native-twilio-voice-sdk

This is a React Native wrapper for Twilio Programmable Voice SDK that lets you make (and in the future receive) calls from your ReactNative App. This module is not curated nor maintained, but inspired by Twilio.

The initial version of this library was forked from react-native-twilio-programmable-voice in order to update Twilio's programmable Voice SDK libraries to their latest version. This is specially important because version 2 of Twilio's libraries used by react-native-twilio-programmable-voice is going to be deprecated by Jan, 1st 2020. In order to simplify the migration, only the making calls part was migrated.

Twilio Programmable Voice SDK

  • Android 4.1.0
  • iOS 4.1.0

Installation

Before starting, we recommend you get familiar with Twilio Programmable Voice SDK. It's easier to integrate this module into your react-native app if you follow the Quick start tutorial from Twilio, because it makes very clear which setup steps are required.

This library only intends to support React Native versions over 0.60. This doesn't mean that it won't work with previous versions, just that issues related to previous versions of RN won't be actively tracked by the mantainer.

npm install react-native-twilio-voice-sdk --save

Usage

The library tries to mimic the Twilio Voice SDK API for Android and iOS with some idiomatic changes for Javascript.

The SDK is composed of several key classes illustrated in the image below.

The class TwilioVoice is the entry point into the SDK and does the following:

  • Make outgoing calls with TwilioVoice.connect(...)
  • The class Call represents an outgoing call.

UML Diagram

Code example

import TwilioVoice from 'react-native-twilio-voice-sdk'

// Get the library version
TwilioVoice.version

// Get the underlying native TwilioVoice library version
TwilioVoice.nativeVersion

// Subscribe to call events
let call
const removeSubscription = TwilioVoice.on("connect", connectedCall => call = connectedCall)
// call removeSubscription() to stop listening

// start a call
TwilioVoice.connect(accessToken, {to: '+61234567890'})

// hangup
call.disconnect()

// mute or un-mute the call
// mutedValue must be a boolean
call.muted(mutedValue)

// Send the call audio to the speaker phone
// speakerPhoneEnabled must be a boolean
call.setSpeakerPhone(speakerPhoneEnabled)

call.sendDigits(digits)

// Call properties
call.from
call.to
call.sid
call.state // "RINGING" | "CONNECTING" | "CONNECTED" | "RECONNECTING" | "DISCONNECTED"

Events

All calls to the on method return a function that removes the subscription upon execution.

TwilioVoice.on('ringing', function(call: Call): void);
TwilioVoice.on('connect', function(call: Call): void);
TwilioVoice.on('connectFailure', function(call: Call, err?: Error): void);
TwilioVoice.on('reconnecting', function(call: Call, err?: Error): void);
TwilioVoice.on('reconnect', function(call: Call): void);
TwilioVoice.on('disconnect', function(call: Call, err?: Error): void);

Twilio Voice SDK reference

iOS changelog

Android changelog

Credits

react-native-twilio-programmable-voice

voice-quickstart-android

react-native-push-notification

voice-quickstart-objc

License

MIT