react-native-voip-call
Getting started
Npm
$ npm install react-native-voip-call --save
Yarn
$ yarn add react-native-voip-call
Mostly automatic installation RN < 0.60.x
$ react-native link react-native-voip-call
ios Installation
$ cd ios && pod install
Link required libraries
Click on Build Phases
tab, then open Link Binary With Libraries
.
Add CallKit.framework
and Intents.framework
(and mark it Optional).
Usage of RNVoip Call
import this package as your needed places
;
1. initialize Call (IOS Required)
let options = { appName:'RNVoip App', // Required imageName: 'logo', //string (optional) in ios Resource Folder ringtoneSound : '', //string (optional) If provided, it will be played when incoming calls received includesCallsInRecents: false, // boolean (optional) If provided, calls will be shown in the recent calls supportsVideo : true //boolean (optional) If provided, whether or not the application supports video calling (Default: true) } // Initlize Call Kit IOS is Required RNVoipCall.initializeCall(options).then(()=>{ //Success Call Back }).catch(e=>console.log(e));
2. display Incomming Call
let callOptions = callerId:'825f4094-a674-4765-96a7-1ac512c02a71' // Important uuid must in this format ios: phoneNumber:'12344' // Caller Mobile Number name:'RNVoip' // caller Name hasVideo:true android: ringtuneSound: true // defualt true ringtune: 'ringtune' // add file inside Project_folder/android/app/res/raw duration: 20000 // defualt 30000 vibration: true // defualt is true channel_name: 'call1asd' // notificationId: 1121 notificationTitle: 'Incomming Call' notificationBody: 'Some One is Calling...' answerActionTitle: 'Answer' declineActionTitle: 'Decline' RNVoipCall
3. call End
RNVoipCall; // End specific Call RNVoipCall; // End All Calls
4. Call Answer Event
RNVoipCall;
5. Call End Event
RNVoipCall;
6.Check Call Active (Ios Only)
RNVoipCall;
7. Event Listener (Ios only)
RNVoipCall; RNVoipCall; RNVoipCall;
8. call back on android app in background state (Android only)
RNVoipCall ;
9. Event Listener (Android only)
//app open Automatically when Call recived RNVoipCall; // on click call Notification RNVoipCall; missed call notification taped RNVoipCall;
10. Play and stop ringtune (Android only)
RNVoipCall; // param1 -> name of the ringtune in inside Project_folder/android/app/res/raw , param2 -> play ringtune as loop RNVoipCall;
Usage (Background Integration)
1. IOS
1.1 Configure Voip Service to App
-
please Refer and Configure Apple Voice Over IP
-
Make sure you enabled the folowing in
Xcode -> Signing & Capabilities:
2.1) Background Modes
-> Voice over IP enabled
2.2 )Capability
-> Push Notifications
2.3) Add PushKit.framework
- Add Following Code to
Xcode -> project_folder -> AppDelegate.m
... /* <------ add this line */ /* <------ add this line *//* <------ add this line */
- Add Following Code to
Xcode -> project_folder -> info.plist
UIBackgroundModes audio voip fetch remote-notification
IosPushKitHandler.js
;;; const IsIos = PlatformOS === 'ios'; const log = console; const IosPushKitHandler = { const pushkitToken setPushkitToken = ; const iosPushKit = { ifIsIos //For Push Kit RNVoipPushKit; // --- optional, you can use another library to request permissions //Ios PushKit device token Listner RNVoipPushKit; //On Remote Push notification Recived in Forground RNVoipPushKit; } return <View> <Text> "push kit token:" + pushkitToken </Text> </View> ;}; };
-
Create pem file for push please Refer generate Cretificate , convert p12 to pem
-
send push sendPush.php
2. Android
Configure and install below 2 packages
# Install & setup the app module yarn add @react-native-firebase/app # Install the messaging module yarn add @react-native-firebase/messaging # If you're developing your app using iOS, run this command cd ios/ && pod install
Installation
Add the below code to index.js
in Root folder
;; ;
push payload
{ "to":"asgvdsdjhsfdsfd....", //device token "data":{ "priority":"high", // Android required for background Notification "uuid":"uuid of user", "name":"RNVoip", "type":"call" // to identify reciving call Notification } }
Demo
ios | Android | android( Lockscreen) |
---|---|---|
![]() |
![]() |
![]() |
Donate
Author
licenses
MIT