-
Notifications
You must be signed in to change notification settings - Fork 2
CallViberRequest
Lejla Solak edited this page Feb 10, 2025
·
4 revisions
extends CallRequest
CallViberRequest(String token, Context context, String from, String destination, ViberCallEventListener viberCallEventListener)String getFrom()ViberCallEventListener getViberCallEventListener()
Creates an instance of CallViberRequest required for making an outgoing Viber call
via callViber method.
-
token:String- Authentication token generated by client's app via Infobip's HTTP /webrtc/1/token endpoint. -
context:Context- An instance of theandroid.content.Contextclass, which provides access to system services, resources, and application-specific data in an Android application. -
destination:String- Phone number to call. -
from:String- Call identifier which has to be a Viber Voice number. -
viberCallEventListener:ViberCallEventListener- Event listener used for receiving call events.
-
CallViberRequest- Instance of theCallViberRequest.
CallViberRequest callViberRequest = new CallViberRequest(
obtainToken(),
getApplicationContext(),
"41793026727",
"41727620397",
new DefaultViberCallEventListener() {
@Override
public void onEstablished(CallEstablishedEvent callEstablishedEvent) {
Toast.makeText(getApplicationContext(), "Established!", Toast.LENGTH_LONG);
}
@Override
public void onHangup(CallHangupEvent callHangupEvent) {
Toast.makeText(getApplicationContext(), "Hangup!", Toast.LENGTH_LONG);
}
@Override
public void onError(ErrorEvent errorEvent) {
Toast.makeText(getApplicationContext(), "Error!", Toast.LENGTH_LONG);
}
@Override
public void onRinging(CallRingingEvent callRingingEvent) {
Toast.makeText(getApplicationContext(), "Ringing!", Toast.LENGTH_LONG);
}
}
);Getter for the from field.
none
-
String- The value of thefromfield, representing the Viber Voice number used to initiate the call, provided in the request.
String from = callViberRequest.getFrom();Getter for the viberCallEventListener field.
none
-
ViberCallEventListener- The value of theviberCallEventListenerfield, which represents interface to be implemented, provided in the request.
ViberCallEventListener viberCallEventListener = callViberRequest.getViberCallEventListener();