|
|
# Handling Calls With **Reve** Voice SDK
|
|
|
|
|
|
After calling the `sipWrapper.restartSIP()` method voip Calling is available but To make the UI work with the sdk's background tasks you should initialize the Listeners first. Follow the [Listeners Guide](Configuring-Listeners) to Correctly initialize the Listeners of this SDK.
|
|
|
After calling the `SIPWrapper.restartSIP()` method voip Calling is available to you through `CallHandler.makeCall()` and other similar methods. But Even if you have access to the call functionalites, you need to Make your UI work according to the background tasks. The Listeners Interfaces **SDKSIPListener** and **SDKServiceListener** are used for that reason. See [Listeners Guide](Configuring-Listeners) to correctly Implement Listeners.
|
|
|
|
|
|
After you are done with the Listeners, you have create an Instance of the **CallHandler** Class. Now the CallHandler as the name suggests handles all the tasks related to calling. You can start a call by calling the ```callHandler.makeCall(number,isPaid)``` method. Here the isPaid Variable will be true if the user is calling a GSM number. If the call is To another subscriber the number will be the user's username and the isPaid variable will be false.
|
|
|
After Listeners are correctly implemented you can use your UI to start your calls with ```CallHandler.makeCall(phoneNumber:String , isPaid:Boolean)``` function can be called and the you can get the relevant call related info through the Listeners.
|
|
|
|
|
|
Now, isPaid is a variable that indicates whether you want to make a VOIP call or a Peer to Peer call. If you want to make a VOIP call then set isPaid as true. Set isPaid to false if you want a Peer to Peer call. In the latter instance make sure that the phoneNumber is a subscriber. Otherwise the call will drop.
|
|
|
|
|
|
*It is recommended that you handle isPaid variable according to your subscriber database.*
|
|
|
|
|
|
After you have started a call with makeCall method, you can end this call by invoking the `callHandler.endCall()` method.
|
|
|
|
|
|
Finally you can accept incoming calls by invoking `callHandler.acceptCall(callID)` method. You can find the callID through the **SDKServiceListener**(See [Listeners Guide](Configuring-Listeners))
|
|
|
Finally you can accept incoming calls by invoking `callHandler.acceptCall(callID)` method. You can find the callID through the **SDKServiceListener** *(See [Listeners Guide](Configuring-Listeners))*
|
|
|
|
|
|
#### Incoming calls
|
|
|
You can get the incoming call id from `ListenersProvider.sdkServiceListener` Then you can invoke callHandler.acceptCall(callId) to accept the current incoming call. |