0.6.3 • Published 4 years ago

react-native-twilio-voice-sdk-upgrade v0.6.3

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

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

abort-controllerabsolute-pathacceptsansi-colorsansi-cyanansi-escapesansi-fragmentsansi-grayansi-redansi-regexanymatchansi-stylesansi-wrapargparsearr-diffarray-filterarr-unionarr-flattenarray-reducearray-slicearray-maparray-uniqueartasapassign-symbolsastral-regexasyncasync-limiteratobbabel-plugin-dynamic-import-nodebabel-plugin-syntax-trailing-function-commasbabel-preset-fbjsbalanced-matchbasebase64-jsbasic-authbig-integerbindingsbplist-creatorbplist-parserbrace-expansionbracesbserbuffer-crc32buffer-frombytescache-basecaller-callsitecaller-pathcallsitescamelcasecapture-exitchalkchardetci-infoclass-utilscli-cursorcli-spinnerscli-widthcliuiclonecode-point-atcollection-visitcolor-convertcolor-namecolor-supportcolorettecommandercommondircomponent-emittercompressiblecompressionconcat-mapconcat-streamconnectconvert-source-mapcopy-descriptorcore-jscosmiconfigcreate-react-classcsstypecross-spawndayjscore-util-isdebugdecamelizedecode-uri-componentdeepmergedefaultsdefine-propertiesdefine-propertydenodeifydepddestroydom-walkee-firstencodingencodeurlend-of-streamenvinfoerror-exerrorhandlerescape-htmlescape-string-regexpesprimaetagevent-target-shimeventemitter3exec-shexecaexpand-bracketsextend-shallowexternal-editorextglobfancy-logfb-watchmanfbjsfbjs-css-varsfbjs-scriptsfiguresfile-uri-to-pathfill-rangefinalhandlerfind-cache-dirfind-upfor-infreshfs-extrafragment-cachefs.realpathfseventsfunction-bindgensyncget-caller-fileget-streamget-valueglobglobalglobalsgraceful-fsgrowlyhas-flaghas-symbolshas-valuehas-valueshermesvmhttp-errorshosted-git-infoimport-freshimage-sizeimurmurhashinflighticonv-liteinheritsinquirerinvariantinvert-kvis-accessor-descriptoris-arrayishis-bufferis-ciis-data-descriptoris-descriptoris-extendableis-directoryis-fullwidth-code-pointis-numberis-plain-objectis-streamis-windowsis-wslisarrayisexeisomorphic-fetchisobjectjest-get-typejest-haste-mapjest-message-utiljest-serializerjest-mockjest-validatejest-utiljest-workerjs-tokensjetifierjs-yamljsc-androidjsescjson5json-stable-stringifyjson-parse-better-errorsjsonifyjsonfilekind-ofklawlcidlevenload-json-filelocate-pathlodashlodash.throttlelogkittyloose-envifylog-symbolslru-cachemakeerrormake-dirmap-age-cleanermap-cachemap-visitmemmerge-streammetrometro-babel-registermetro-babel7-plugin-react-transformmetro-babel-transformermetro-configmetro-cachemetro-coremetro-inspector-proxymetro-minify-uglifymetro-react-native-babel-presetmetro-react-native-babel-transformermetro-resolvermetro-source-mapmetro-symbolicatemimemicromatchmime-dbmin-documentmime-typesminimatchmimic-fnmixin-deepmkdirpminimistmorganmsmute-streamnannanomatchnegotiatornice-trynode-fetchnode-int64node-modules-regexpnode-notifiernormalize-package-datanormalize-pathnpm-run-pathob1nullthrowsnumber-is-nanobject-copyobject-assignobject-keysobject-visitobject.pickobject.assignon-finishedon-headersonceonetimeopenoptionsoraos-localeos-tmpdirp-deferp-finallyp-is-promisep-limitp-locateparse-jsonp-tryparseurlparse-node-versionpascalcasepath-existspath-is-absolutepath-keypath-parsepath-typepifypiratesplistpkg-dirplugin-errorpretty-formatprocess-nextick-argsposix-character-classesprocesspromiseprop-typespseudomappumprange-parserreact-deep-force-updatereact-devtools-corereact-isreact-proxyread-pkgreact-transform-hmrread-pkg-upreadable-streamregenerate-unicode-propertiesregenerateregenerator-runtimeregenerator-transformregex-notregjsgenregexpu-corerepeat-elementregjsparserrepeat-stringremove-trailing-separatorrequire-directoryrequire-main-filenameresolveresolve-fromresolve-urlrestore-cursorretrimrafrsvprun-asyncrx-literx-lite-aggregatesrxjssafe-buffersafe-regexsanesafer-buffersemversendsaxschedulerserialize-errorserve-staticset-valuesetimmediateset-blockingsetprototypeofshebang-commandshebang-regexshell-quoteshellwordssignal-exitsimple-plistslashslideslice-ansisnapdragon-nodesnapdragonsnapdragon-utilsource-map-resolvesource-mapsource-map-urlsource-map-supportspdx-correctspdx-exceptionsspdx-expression-parsespdx-license-idssplit-stringsprintf-jsstack-utilsstacktrace-parserstatic-extendstatusesstream-buffersstring-widthstring_decoderstrip-ansistrip-bomsymbol-observablestrip-eoftempsupports-colorthroatthroughthrough2tmptmplto-fast-propertiestime-stampto-object-pathto-regextoidentifiertype-festtypedarrayto-regex-rangeuglify-esua-parser-jsunicode-canonical-property-names-ecmascriptultronunicode-match-property-value-ecmascriptunicode-match-property-ecmascriptunion-valueuniversalifyunicode-property-aliases-ecmascriptunpipeunset-valueurixuseutils-mergeuuidutil-deprecatevalidate-npm-package-licensevaryvlqwalkerwcwidthwhatwg-fetchwhichwhich-modulewordwrapwrap-ansiwsxcodewrappywrite-file-atomicxmlbuilderxmldocxmldomxpipextendy18nyallistyargsyargs-parser
0.6.3

4 years ago

0.6.2

4 years ago