Thanks to visit codestin.com
Credit goes to github.com

Skip to content

CallPhoneRequest

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

extends CallRequest



CallPhoneRequest(token, context, destination, phoneCallEventListener)

Description

Creates an instance of CallPhoneRequest required for making an outgoing phone call via callPhone 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.
  • phoneCallEventListener: PhoneCallEventListener - Event listener used for receiving call events.

Returns

Example

CallPhoneRequest callPhoneRequest = new CallPhoneRequest(
        obtainToken(),
        getApplicationContext(),
        "41793026727",
        new DefaultPhoneCallEventListener() {
            @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);
            }
        }
);



getPhoneCallEventListener()

Description

Getter for the phoneCallEventListener field.

Arguments

  • none

Returns

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

Example

PhoneCallEventListener phoneCallEventListener = callPhoneRequest.getPhoneCallEventListener();

Tutorials

Migration guides

Reference documentation

Clone this wiki locally