Skip to content

PhoneCall

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

extends Call



options()

Description

Returns call options used to construct a phone call.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
PhoneCall phoneCall = (PhoneCall) infobipRTC.getActiveCall();
PhoneCallOptions phoneCallOptions = phoneCall.options();



setEventListener(phoneCallEventListener)

Description

Configures event handler for phone call events.

Arguments

  • phoneCallEventListener: PhoneCallEventListener - Interface with event methods that should be implemented, method per phone call event to be handled.

Returns

  • N/A

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    PhoneCall phoneCall = (PhoneCall) infobipRTC.getActiveCall();
    phoneCall.setEventListener(new DefaultPhoneCallEventListener() {
        @Override
        public void onRinging(CallRingingEvent callRingingEvent) {
            Toast.makeText(getApplicationContext(), "Ringing!", Toast.LENGTH_LONG);
        }

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



getEventListener()

Description

Returns event handler for phone call events.

Arguments

  • none

Returns

  • PhoneCallEventListener - Interface that should be implemented in order to handle phone call events properly.

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
PhoneCall phoneCall = (PhoneCall) infobipRTC.getActiveCall();
PhoneCallEventListener phoneCallEventListener = phoneCall.getEventListener();

Tutorials

Migration guides

Reference documentation

Clone this wiki locally