Reve Systems Android Voice Call SDK: Configuration and Usage
Reve Voice SDK for Android provides you with the Opportunity to make VOIP (Voice over Internet Protocol) Calls and Peer to Peer calls.
Follow the steps below to integrate Reve Voice SDK with your native android app.
Step 1. Installation: In build.gradle in your project file, make sure you have the following items
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
You will need both mavencentral() and google() repositories for this project. Also use classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
if you intend to use Kotlin in your project.
Now in your settings.gradle file you need to add the following maven repository
repositories {
google()
mavenCentral()
jcenter()
maven {
url "https://maven.iptelephony.revesoft.com/artifactory/libs-release-local/"
}
maven { url 'https://jitpack.io' }
}
Finally add the following line in your app/build.gradle file's dependencies tab
dependencies {
...
implementation 'com.revesoft.sdk:revecallsdk:1.0.1'
...
}
Step 2. Configuration: In this step you need to configure the AppConfig according to the Configuration provided to you by Reve Systems.
Your app has to be configured exactly as the credentials and attributes provided, otherwise you will not be able to connect to the server properly. You have to build an instance of the class AppConfig and pass it to the ReveSdkSIPWrapper.startSIP(context: Context, appConfig:AppConfig)
method. You have to build an instance the following way.
In kotlin
var myConfigBuilder = AppConfig.newBuilder()
.withDialerName("SDK_DIALER")
.withDialerType(DialerType.TEST)
.withDialerVersion("1.0.0")
.withDefaultCountry("bd")
.withVersionCode(1)
.withSDKClientCredentials("operator1", "1234")
.withAPIKey("[Your API Key]")
var appConfig = AppConfig(myConfigBuilder)
In Java
MyConfigBuilder myConfigBuilder = AppConfig.newBuilder()
.withDialerName("SDK_DIALER")
.withDialerType(DialerType.TEST)
.withDialerVersion("1.0.0")
.withDefaultCountry("bd")
.withVersionCode(1)
.withSDKClientCredentials("operator1", "1234")
.withAPIKey("[Your API Key]")
AppConfig appConfig = new AppConfig(myConfigBuilder);
Follow the Instructions to get your own API Key.
Step 3. Setting User Credentials: Set the username and Password of the end user in UserInfo class. Taking these two pieces of information from the UI is recommended.
UserInfo.setUsername("[Your User Id]")
UserInfo.setPassword("[Your Password]")
Step 4. Starting the Call Functionalities At this stage The configuration of the App is complete. Now you can start to activate the functionalities of this sdk. You have to call the function ReveSdkSIPWrapper.startSIP(context: Context, appConfig:AppConfig)
. This method starts the components that lets you start/receive and end calls. Here context is recommended to be the default applicationContext and the appConfig is what you created in Step 2.
If all the configuration is ok, this function will start the core components of this sdk. You have to make sure that you are using the exact configuration provided by Reve Systems. You can call this method inside an activity or a service.
Step 5. Permission: Make sure to ask for permissions for Audio record and Make Calls in your app. Otherwise the sdk wont work.
Step 6. Call Handling: The aforementioned ReveSdkSIPWrapper.startSIP(Context,AppConfig)
In kotlin
ReveSdkSIPWrapper.startSIP(context,appConfig);
In Java
ReveSdkSIPWrapper.Companion.startSIP(context,appConfig);
function will initialize ReveSdkCallHandler, a class for all types of call related activites. You can now make a call by simply using ReveSdkCallHandler.makeCall(number:String)
Start Call using:
In kotlin
if (SIPProvider.callState == CallState.READY){
ReveSdkCallHandler.makeCall(phoneNumber)
}
In Java
if (SIPProvider.callState == CallState.READY){
ReveSdkCallHandler.Companion.makeCall(phoneNumber);
}
function and end call by usingReveSdkCallHandler.endCall()
function.
In kotlin
if (SIPProvider.callState == CallState.READY){
ReveSdkCallHandler.endCall()
}
In Java
if (SIPProvider.callState == CallState.READY){
ReveSdkCallHandler.Companion.endCall();
}
You can receive Peer to Peer calls by using ReveSdkCallHandler.acceptCall(callid:String)
.
if (SIPProvider.callState == CallState.READY){
ReveSdkCallHandler.acceptCall(callid)
}
In Java
if (SIPProvider.callState == CallState.READY){
ReveSdkCallHandler.Companion.acceptCall(callid);
}
You can get the callid of an incoming call from Listeners. Check out how to Implement Listeners.
Check out the Call Handling guide for details on Handling of calls using this SDK and UI integration with Native App.