Skip to content

CallWebrtcRequest

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

extends CallRequest



CallWebrtcRequest(token, context, destination, webrtcCallEventListener)

Description

Creates an instance of CallWebrtcRequest required for making an outgoing WebRTC call via callWebrtc 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 - WebRTC identity to call.
  • webrtcCallEventListener: WebrtcCallEventListener - Event listener used for receiving call events.

Returns

Example

CallWebrtcRequest callWebrtcRequest = new CallWebrtcRequest(
        obtainToken(),
        getApplicationContext(),
        "alice",
        new DefaultWebrtcCallEventListener() {
            @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);
            }
        }
);



getWebrtcCallEventListener()

Description

Getter for the webrtcCallEventListener field.

Arguments

  • none

Returns

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

Example

WebrtcCallEventListener webrtcCallEventListener = callWebrtcRequest.getWebrtcCallEventListener();

Tutorials

Migration guides

Reference documentation

Clone this wiki locally