Partilhar via


CallAgent Class

  • java.lang.Object
    • com.azure.android.communication.calling.CallAgent

public class CallAgent

Call agent created by the CallClient factory method createCallAgent It bears the responsibility of managing calls on behalf of the authenticated user

Method Summary

Modifier and Type Method and Description
void addOnCallsUpdatedListener(CallsUpdatedListener listener)

Adds the specified listener to receive OnCallsUpdated events. CallsUpdated event. Occurs when a new call is created, in case of an incoming call or when an existing call is disconnected.

void addOnIncomingCallListener(IncomingCallListener listener)

Adds the specified listener to receive OnIncomingCall events. onIncomingCall Event. Occurs when incoming call is recieved from PushNotification or Trouter.

void dispose()

Releases all the resources held by CallAgent. CallAgent should be destroyed/nullified after dispose.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

List<Call> getCalls()

Returns the list of all active calls.

CompletableFuture<Void> handlePushNotification(final PushNotificationInfo notification)

Handle the push notification. If successful, will raise appropriate incoming call event.

Call join(android.content.Context context, JoinMeetingLocator meetingLocator, JoinCallOptions joinCallOptions)

Join an existing group conversation with the ability to specify call options for the participant joining.

CompletableFuture<Void> registerPushNotification(final String deviceRegistrationToken)

Register the current device for receiving Incoming Calls Push notification alerts.

void removeOnCallsUpdatedListener(CallsUpdatedListener listener)

Removes the specified listener to receive OnCallsUpdated events. CallsUpdated event. Occurs when a new call is created, in case of an incoming call or when an existing call is disconnected.

void removeOnIncomingCallListener(IncomingCallListener listener)

Removes the specified listener to receive OnIncomingCall events. onIncomingCall Event. Occurs when incoming call is recieved from PushNotification or Trouter.

Call startCall(android.content.Context context, Iterable<com.azure.android.communication.common.CommunicationIdentifier> participants, StartCallOptions startCallOptions)

Initiates outgoing call with list of participants with the ability to specify call initiator options.

Call startCall(android.content.Context context, Iterable<com.azure.android.communication.common.CommunicationIdentifier> participants)

Initiates outgoing call with list of participants with default call options (audio on, video off).

CompletableFuture<Void> unregisterPushNotification()

Unregister all previously registered devices from receiving incoming calls push notifications.

Method Details

addOnCallsUpdatedListener

public void addOnCallsUpdatedListener(CallsUpdatedListener listener)

Adds the specified listener to receive OnCallsUpdated events. CallsUpdated event. Occurs when a new call is created, in case of an incoming call or when an existing call is disconnected.

Parameters:

listener

addOnIncomingCallListener

public void addOnIncomingCallListener(IncomingCallListener listener)

Adds the specified listener to receive OnIncomingCall events. onIncomingCall Event. Occurs when incoming call is recieved from PushNotification or Trouter.

Parameters:

listener

dispose

public void dispose()

Releases all the resources held by CallAgent. CallAgent should be destroyed/nullified after dispose.

finalize

protected void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

getCalls

public List getCalls()

Returns the list of all active calls.

handlePushNotification

public CompletableFuture handlePushNotification(final PushNotificationInfo notification)

Handle the push notification. If successful, will raise appropriate incoming call event.

Parameters:

notification

join

public Call join(android.content.Context context, JoinMeetingLocator meetingLocator, JoinCallOptions joinCallOptions)

Join an existing group conversation with the ability to specify call options for the participant joining.

Parameters:

context - Android application context object.
meetingLocator - information of the conversation to join.
joinCallOptions - call options for the participant joining the call (video on/off, audio on/off).

Returns:

The resulting Call object.

registerPushNotification

public CompletableFuture registerPushNotification(final String deviceRegistrationToken)

Register the current device for receiving Incoming Calls Push notification alerts.

Parameters:

deviceRegistrationToken - Device registration token obtained from the FCM/GCM SDK.

removeOnCallsUpdatedListener

public void removeOnCallsUpdatedListener(CallsUpdatedListener listener)

Removes the specified listener to receive OnCallsUpdated events. CallsUpdated event. Occurs when a new call is created, in case of an incoming call or when an existing call is disconnected.

Parameters:

listener

removeOnIncomingCallListener

public void removeOnIncomingCallListener(IncomingCallListener listener)

Removes the specified listener to receive OnIncomingCall events. onIncomingCall Event. Occurs when incoming call is recieved from PushNotification or Trouter.

Parameters:

listener

startCall

public Call startCall(android.content.Context context, Iterable participants, StartCallOptions startCallOptions)

Initiates outgoing call with list of participants with the ability to specify call initiator options.

Parameters:

context - Android application context object.
participants - an array containing identifier of participants to call.
startCallOptions - call options for the call initiator (video on/off, audio on/off).

Returns:

The resulting Call object.

startCall

public Call startCall(android.content.Context context, Iterable participants)

Initiates outgoing call with list of participants with default call options (audio on, video off).

Parameters:

context - Android application context object.
participants - an array containing identifier of participants to call.

Returns:

The resulting Call object.

unregisterPushNotification

public CompletableFuture unregisterPushNotification()

Unregister all previously registered devices from receiving incoming calls push notifications.

Applies to