Skip to content

CallViberRequest

Lejla Solak edited this page Feb 10, 2025 · 4 revisions

extends CallRequest



CallViberRequest(token, context, from, destination, viberCallEventListener)

Description

Creates an instance of CallViberRequest required for making an outgoing Viber call via callViber method.

Arguments

  • token: String - Authentication token generated by client's app via Infobip's HTTP /webrtc/1/token endpoint.
  • context: Context - An instance of the android.content.Context class, 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.

Returns

Example

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);
            }
        }
);



getFrom()

Description

Getter for the from field.

Arguments

  • none

Returns

  • String - The value of the from field, representing the Viber Voice number used to initiate the call, provided in the request.

Example

String from = callViberRequest.getFrom();



getViberCallEventListener()

Description

Getter for the viberCallEventListener field.

Arguments

  • none

Returns

  • ViberCallEventListener - The value of the viberCallEventListener field, which represents interface to be implemented, provided in the request.

Example

ViberCallEventListener viberCallEventListener = callViberRequest.getViberCallEventListener();

Tutorials

Migration guides

Reference documentation

Clone this wiki locally