# react-native-twilio-programmable-voice
This is a react-native wrapper around [Twilio Programmable Voice SDK](https://www.twilio.com/voice), which allows your react-native app to make and receive calls.
This module is not affiliated with nor officially maintained by Twilio. It is maintained by open source contributors working during their nights and weekends.
Tested with:
- react-native 0.62.2
- Android 11
- iOS 14
## Roadmap
### Project 1
The most updated branch is [feat/twilio-android-sdk-5](https://github.com/hoxfon/react-native-twilio-programmable-voice/tree/feat/twilio-android-sdk-5) which is aligned with:
- Android 5.0.2
- iOS 5.2.0
It contains breaking changes from `react-native-twilio-programmable-voice` v4, and it will be released as v5.
You can install it with:
```bash
# Yarn
yarn add https://github.com/hoxfon/react-native-twilio-programmable-voice#feat/twilio-android-sdk-5
# NPM
npm install git+https://github.com/hoxfon/react-native-twilio-programmable-voice#feat/twilio-android-sdk-5
```
I am currently updating the library to catchup with all changes published on the latest Android and iOS Twilio Voice SDK:
[iOS changelog](https://www.twilio.com/docs/voice/voip-sdk/ios/changelog)
[Android changelog](https://www.twilio.com/docs/voice/voip-sdk/android/3x-changelog)
My plan is to use the following links as a reference, and follow Twilio commit by commit.
- https://github.com/twilio/voice-quickstart-android
- https://github.com/twilio/voice-quickstart-ios
_If you want to contribute please consider helping on this project. [Click here for more information](https://github.com/hoxfon/react-native-twilio-programmable-voice/issues/158)._
### Project 2
Allow Android to use the built in Android telephony service to make and receive calls.
## Stable release
### Twilio Programmable Voice SDK
- Android 4.5.0
- iOS 5.2.0
### Breaking changes in v4.0.0
The module implements [react-native autolinking](https://github.com/react-native-community/cli/blob/master/docs/autolinking.md) as many other native libraries > react-native 0.60.0, therefore it doesn't need to be linked manually.
Android: update Firebase Messaging to 17.6.+. Remove the following block from your application's `AndroidManifest.xml` if you are migrating from v3.
```xml
<!-- [START instanceId_listener] -->
<service
android:name="com.hoxfon.react.TwilioVoice.fcm.VoiceFirebaseInstanceIDService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID" />
</intent-filter>
</service>
<!-- [END instanceId_listener] -->
```
Android X is supported.
Data passed to the event `deviceDidReceiveIncoming` does not contain the key `call_state`, because state of Call Invites was removed in Twilio Android and iOS SDK v3.0.0
- iOS: params changes for `connectionDidConnect` and `connectionDidDisconnect`
to => call_to
from => call_from
error => err
New features
Twilio Programmable Voice SDK v3.0.0 handles call invites directly and makes it easy to distinguish a call invites from an active call, which previously was confusing.
To ensure that an active call is displayed when the app comes to foreground you should use the promise `getActiveCall()`.
To ensure that a call invite is displayed when the app comes to foreground use the promise `getCallInvite()`. Please note that call invites don't have a `call_state` field.
You should use `hold()` to put a call on hold.
You can be notified when a call is `ringing` by listening for `callStateRinging` events.
iOS application can now receive the following events, that in v3 where only dispatched to Android:
- deviceDidReceiveIncoming
- callInviteCancelled
- callStateRinging
- connectionIsReconnecting
- connectionDidReconnect
### Breaking changes in v3.0.0
- initWitToken returns an object with a property `initialized` instead of `initilized`
- iOS event `connectionDidConnect` returns the same properties as Android
move property `to` => `call_to`
move property `from` => `call_from`
### Installation
Before starting, we recommend you get familiar with [Twilio Programmable Voice SDK](https://www.twilio.com/docs/api/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.
```bash
npm install react-native-twilio-programmable-voice --save
```
- **React Native 0.60+**
[CLI autolink feature](https://github.com/react-native-community/cli/blob/master/docs/autolinking.md) links the module while building the app.
- **React Native <= 0.59**
```bash
react-native link react-native-twilio-programmable-voice
```
### iOS Installation
If you can't or don't want to use autolink, you can also manually link the library using the instructions below (click on the arrow to show them):
<details>
<summary>Manually link the library on iOS</summary>
Follow the [instructions in the React Native documentation](https://facebook.github.io/react-native/docs/linking-libraries-ios#manual-linking) to manually link the framework
After you have linked the library with `react-native link react-native-twilio-programmable-voice`
check that `libRNTwilioVoice.a` is present under YOUR_TARGET > Build Phases > Link Binaries With Libraries. If it is not present you can add it using the + sign at the bottom of that list.
</details>
```bash
cd ios && pod install
```
#### CallKit
The iOS library works through [CallKit](https://developer.apple.com/reference/callkit) and handling calls is much simpler than the Android implementation as CallKit handles the inbound calls answering, ignoring, or rejecting. Outbound calls must be controlled by custom React-Native screens and controls.
To pass caller's name to CallKit via Voip push notification add custom parameter 'CallerName' to Twilio Dial verb.
```xml
<Dial>
<Client>
<Identity>Client</Identity>
<Parameter name="CallerName">NAME TO DISPLAY</Parameter>
</Client>
</Dial>
```
#### VoIP Service Certificate
Twilio Programmable Voice for iOS utilizes Apple's VoIP Services and VoIP "Push Notifications" instead of FCM. You will need a VoIP Service Certificate from Apple to receive calls. Follow [the official Twilio instructions](https://github.com/twilio/voice-quickstart-ios#7-create-voip-service-certificate) to complete this step.
### Android Installation
Setup FCM
You must download the file `google-services.json` from the Firebase console.
It contains keys and settings for all your applications under Firebase. This library obtains the resource `senderID` for registering for remote GCM from that file.
#### `android/build.gradle`
```groovy
buildscript {
dependencies {
// override the google-service version if needed
// https://developers.google.com/android/guides/google-services-plugin
classpath 'com.google.gms:google-services:4.3.4'
}
}
// this plugin looks for google-services.json in your project
apply plugin: 'com.google.gms.google-services'
```
#### `AndroidManifest.xml`
```xml
<uses-permission android:name="android.permission.VIBRATE" />
<application ....>
<!-- Twilio Voice -->
<!-- [START fcm_listener] -->
<service
android:name="com.hoxfon.react.RNTwilioVoice.fcm.VoiceFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<!-- [END fcm_listener] -->
```
If you can't or don't want to use autolink, you can also manually link the library using the instructions below (click on the arrow to show them):
<details>
<summary>Manually link the library on Android</summary>
Make the following changes:
#### `android/settings.gradle`
```groovy
include ':react-native-twilio-programmable-voice'
project(':react-native-twilio-programmable-voice').
没有合适的资源?快使用搜索试试~ 我知道了~
用于Twilio可编程语音SDK的ReactNative包装器_Java_Objective-C_下载.zip
共36个文件
java:8个
xml:5个
properties:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 119 浏览量
2023-04-25
10:52:10
上传
评论
收藏 251KB ZIP 举报
温馨提示
用于Twilio可编程语音SDK的ReactNative包装器_Java_Objective-C_下载.zip
资源推荐
资源详情
资源评论
收起资源包目录
用于Twilio可编程语音SDK的ReactNative包装器_Java_Objective-C_下载.zip (36个子文件)
react-native-twilio-programmable-voice-master
RNTwilioVoice.podspec 845B
ISSUE_TEMPLATE 765B
LICENSE 1KB
android
gradle.properties 782B
gradle
wrapper
gradle-wrapper.jar 52KB
gradle-wrapper.properties 232B
src
main
java
com
hoxfon
react
RNTwilioVoice
TwilioVoiceModule.java 38KB
fcm
VoiceFirebaseMessagingService.java 9KB
SoundPoolManager.java 1KB
ProximityManager.java 6KB
CallNotificationManager.java 17KB
HeadsetManager.java 3KB
TwilioVoicePackage.java 1KB
EventManager.java 2KB
res
drawable
ic_call_missed_white_24dp.xml 340B
ic_call_black_24dp.xml 564B
ic_call_missed_black_24dp.xml 340B
ic_call_white_24dp.xml 562B
AndroidManifest.xml 201B
gradlew.bat 2KB
proguard-rules.pro 1KB
build.gradle 2KB
gradlew 5KB
CHANGELOG.md 9KB
react-native.config.js 123B
package.json 969B
.npmignore 647B
logs
android
beta5
in-rejected-foreground 9KB
in-answered-foreground 41KB
ios
RNTwilioVoice
RNTwilioVoice.m 31KB
RNTwilioVoice.h 136B
RNTwilioVoice.xcodeproj
project.pbxproj 10KB
index.js 3KB
.gitignore 606B
images
vjeux_tweet.png 147KB
README.md 14KB
共 36 条
- 1
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9156
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功