Skip to content

CallApplicationRequest

Lejla Solak edited this page Aug 5, 2024 · 6 revisions



CallApplicationRequest(token, context, callsConfigurationId, applicationCallEventListener)

Description

Creates a new instance of CallApplicationRequest.

Arguments

  • token: String - Authentication token generated by client's app via Infobip's HTTP /webrtc/1/token endpoint.
  • context: Context - Instance of the android.content.Context class.
  • callsConfigurationId: String - Represents the Calls Configuration ID which is configured using the Calls Configuration API.
  • applicationCallEventListener: ApplicationCallEventListener - Interface with event methods that should be implemented, method per application call event to be handled.

Returns

  • N/A

Example

String token = obtainToken();
CallApplicationRequest callApplicationRequest = new CallApplicationRequest(
    token,
    getApplicationContext(),
    "45g2gql9ay4a2blu55uk1628",
    new DefaultApplicationCallEventListener() {
        @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);
        }
    }
);



getToken()

Description

Getter for token field.

Arguments

  • none

Returns

  • String - Value of token field.

Example

String token = obtainToken();
CallApplicationRequest callApplicationRequest = new CallApplicationRequest(
    token,
    getApplicationContext(),
    "45g2gql9ay4a2blu55uk1628",
    new DefaultApplicationCallEventListener() {
        @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);
        }
    }
);

Log.d("WebRTC", "Token: " + callApplicationRequest.getToken());



getContext()

Description

Getter for context field.

Arguments

  • none

Returns

  • Context - Value of context field.

Example

String token = obtainToken();
CallApplicationRequest callApplicationRequest = new CallApplicationRequest(
    token,
    getApplicationContext(),
    "45g2gql9ay4a2blu55uk1628",
    new DefaultApplicationCallEventListener() {
        @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);
        }
    }
);

Log.d("WebRTC", "Context: " + callApplicationRequest.getContext());



getCallsConfigurationId()

Description

Getter for callsConfigurationId field.

Arguments

  • none

Returns

  • String - Value of callsConfigurationId field.

Example

String token = obtainToken();
CallApplicationRequest callApplicationRequest = new CallApplicationRequest(
    token,
    getApplicationContext(),
    "45g2gql9ay4a2blu55uk1628",
    new DefaultApplicationCallEventListener() {
        @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);
        }
    }
);

Log.d("WebRTC", "Destination: " + callApplicationRequest.getCallsConfigurationId());



getApplicationCallEventListener()

Description

Getter for applicationCallEventListener field.

Arguments

  • none

Returns

Example

String token = obtainToken();
CallApplicationRequest callApplicationRequest = new CallApplicationRequest(
    token,
    getApplicationContext(),
    "45g2gql9ay4a2blu55uk1628",
    new DefaultApplicationCallEventListener() {
        @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);
        }
    }
);

ApplicationCallEventListener applicationCallEvenListener = callApplicationRequest.getApplicationCallEventListener();

Tutorials

Migration guides

Reference documentation

Clone this wiki locally