All Products
Search
Document Center

Intelligent Media Services:API reference

Last Updated:Jun 08, 2026

This topic describes the API operations of the Android software development kit (SDK).

API overview

Note

Earlier SDK versions contain deprecated parameters and methods. We recommend that you upgrade the SDK to the latest version. For more information, see Android user guide.

Class/Protocol

API

Description

ARTCAICallEngine

Defines the audio and video call engine interface.

init

Initialization

setAICallAgentType

Sets the agent type.

call[1/2]

Creates and starts a call.

call[2/2]

Initiates an agent call from the client.

handup

Hangs up the call.

switchMicrophone

Switches the microphone status.

interruptSpeaking

You can interrupt the robot.

enableVoiceInterrupt

Enables or disables smart interruption.

enableSpeaker

Switches between the speaker and earpiece.

muteAgentAudioPlaying

Stops or resumes playing the agent's audio stream.

enablePushToTalk

Enables or disables the push-to-talk mode.

isPushToTalkEnable

Checks whether the push-to-talk mode is enabled.

startPushToTalk

Push-to-talk mode: Starts speaking.

finishPushToTalk

Push-to-talk mode: Stops speaking.

cancelPushToTalk

Push-to-talk mode: Cancels the current speech.

switchRobotVoice

Switches the voice.

getRobotVoiceId

Gets the current voice.

setEngineCallback

Registers a callback.

isMicrophoneOn

Checks whether the microphone is muted.

isSpeakerOn

Checks whether the speaker is used for playback.

isVoiceInterruptEnable

Checks whether smart interruption is enabled.

setAvatarAgentView (Deprecated)

Sets the view container for the digital human and specifies the rendering mode.

setVisionPreviewView (Deprecated)

Sets the local view container for visual understanding and specifies the rendering mode.

muteLocalCamera

Turn Camera On/Off

isLocalCameraMute

Is the camera shut down?

switchCamera

Switches between the front and rear cameras.

getRtcEngine

Gets the Alibaba Real-Time Communication (ARTC) engine instance.

getIARTCAICallService

Gets the official protocol implementation.

sendTextToAgent

Sends a custom message to the large language model (LLM).

sendCustomMessageToServer

Sends a custom message to the business server. This operation must be called after the call is connected.

updateLlmSystemPrompt

Updates the system prompt for the LLM. This operation must be called after the call is connected.

updateBailianAppParams

Updates the parameters for the Model Studio application center.

updateVcrConfig

Updates the VCR configuration.

startVisionCustomCapture

For a visual understanding agent, starts custom frame capture. After this is started, you cannot talk to the agent by voice. This operation must be called after the call is connected.

stopVisionCustomCapture

For a visual understanding agent, stops custom frame capture. This operation must be called after the call is connected.

setAgentView[1/2]

Sets the video view container for the agent.

setAgentView[2/2]

Sets the video view container for the agent and specifies the rendering mode.

setLocalView[1/2]

Sets the local preview view control.

setLocalView[2/2]

Sets the local preview view control and specifies the rendering mode.

updateAsrMaxSilence

Updates the voice activity detection (VAD) threshold.

updateTtsSpeechRate

Updates the text-to-speech (TTS) playback speed.

getAgentInfo

Gets the runtime information of the current agent.

IARTCAICallEngineCallback

Engine callback events.

onErrorOccurs

An error occurred.

onAgentStarted

The agent started successfully.

onCallBegin

The call started.

onCallEnd

The call ended.

onAliRtcEngineCreated

The underlying AliRtcEngine engine is created.

onAICallEngineRobotStateChanged

Synchronizing Robot Status

onUserSpeaking

Callback for when the user is speaking.

onUserAsrSubtitleNotify

Synchronizes the text recognized from the user's speech by Automatic Speech Recognition (ASR).

onAIAgentSubtitleNotify

Synchronization agent response

onLLMReplyCompleted

The LLM has finished replying in the current call.

onNetworkStatusChanged

Callback for network status changes.

onVoiceVolumeChanged

The volume changed.

onVoiceIdChanged

The voice for the current call changed.

onVoiceInterrupted

The voice interruption setting for the current call changed.

onAgentVideoAvailable

Indicates whether the agent's video stream is available.

onAgentAudioAvailable

Indicates whether the agent's audio stream is available.

onAudioDelayInfo

Audio loopback latency.

onAgentAvatarFirstFrameDrawn

The first video frame of the digital human is rendered.

onUserOnLine

Callback for when a user comes online.

onSpeakingInterrupted

The agent's current speech was interrupted.

onVisionCustomCapture

Indicates whether custom frame capture mode is enabled for the current visual understanding call.

onAgentWillLeave

The current agent is about to leave the call.

onHumanTakeoverWillStart

A human agent is about to take over from the current agent.

onHumanTakeoverConnected

The human agent takeover is connected.

onReceivedAgentCustomMessage

A custom message from the agent.

onAgentEmotionNotify

Notification of the agent's emotion analysis result.

onAgentDataChannelAvailable

Callback for the availability of the agent's message channel.

onConnectionStatusChange

The connection status changed during the call.

onReceivedAgentVcrResult

A VCR result is received from the current agent.

API details

ARTCAICallEngine details

init

Initialization

/**
 * Initializes the engine.
 * @param config The initialization configuration.
 */
public abstract void init(ARTCAICallConfig config);

Parameters:

Parameter

Type

Description

config

ARTCAICallConfig

The initialization configuration.

setAICallAgentType

Sets the agent type.

/**
 * Sets the agent type.
 * @param aiAgentType
 */
public abstract void setAICallAgentType(ARTCAICallAgentType aiAgentType);

Parameters:

Parameter

Type

Description

aiAgentType

You can set the agent type.

call[1/2]

Creates and starts a call.

Note

The client calls this operation when the server initiates the call. For more information about how to initiate an agent call from the server, see Initiate a call to an agent using a server-side API operation.

/**
 * Creates and starts a call.
 */
public abstract void call(String rtcToken, String aiAgentInstanceId, String aiAgentUserId, String channelId);

Parameters:

Parameter

Type

Description

rtcToken

String

The token for joining the channel. This parameter cannot be empty.

aiAgentInstanceId

String

The instance ID. This parameter cannot be empty.

aiAgentUserId

String

The user ID of the agent. This parameter cannot be empty.

channelId

String

The channel ID. This parameter cannot be empty.

call[2/2]

Initiates a call to an agent using the SDK. You must pass the ARTC token to join the channel and set the agent ID, agent region, and startup parameters in `mAiCallAgentTemplateConfig` of `ARTCAICallConfig`.

Note

This method is used to initiate a call to an agent from the client. This is the default calling method. For more information, see Android user guide.

/**
   * Initiates a call to an agent.
   * @param rtcToken The authentication token for the local user to join the ARTC channel.
   * @detail This operation uses the SDK to call the agent. You must pass the ARTC token for joining the channel
   * and set the agent ID, agent region, and startup parameters in `mAiCallAgentTemplateConfig` of `ARTCAICallConfig`.
   */
public abstract void call(String rtcToken);

Parameters:

Parameter

Type

Description

rtcToken

String

The token for joining the channel.

handup

Hangs up the call.

/**
 * Hangs up the call.
 */
public abstract void handup();

switchMicrophone

Toggles the microphone on or off.

/**
 * Switches the microphone status.
 * @param on
 */
public abstract void switchMicrophone(boolean on);

Parameters:

Parameter

Type

Description

on

boolean

Indicates whether the sound is muted.

interruptSpeaking

Interrupts the agent's speech.

/**
 * Interrupts the agent's speech.
 */
public abstract boolean interruptSpeaking();

enableVoiceInterrupt

Enables or disables smart interruption.

/**
 * Enables or disables smart interruption.
 */
public abstract boolean enableVoiceInterrupt(boolean enable);

Parameters:

Parameter

Type

Description

enable

boolean

Specifies whether to enable smart interruption.

enableSpeaker

Switches between the speaker and the earpiece. `true` enables the speaker. `false` enables the earpiece.

/**
 * Switches between the speaker and the earpiece.
 */
public abstract boolean enableSpeaker(boolean enable);

Parameters:

Parameter

Type

Description

enable

boolean

Specifieswhether to enable the speaker or the earpiece. `true` enables the speaker. `false` enables the earpiece.

muteAgentAudioPlaying

Stops or resumes playback of the agent's audio stream.

public abstract boolean muteAgentAudioPlaying(boolean mute);

Parameters:

Parameter

Type

Description

mute

boolean

Specifies whether to mute the audio.

enablePushToTalk

Enables or disables the push-to-talk mode.

/**
 * Enables or disables the push-to-talk mode. In push-to-talk mode, the agent reports the result only after finishPushToTalk is called.
 * @param enable
 * @return
 */
public abstract boolean enablePushToTalk(boolean enable);
Note
  • You must call this method after the onCallBegin callback for the setting to take effect.

  • If you want to use push-to-talk mode by default, you can set agentConfig.enablePushToTalk to true before the call.

Parameters:

Parameter

Type

Description

enable

boolean

Specifies whether to enable the push-to-talk mode. In push-to-talk mode, the agent reports the result only after finishPushToTalk is called.

isPushToTalkEnable

Checks whether the push-to-talk mode is enabled.

/**
 * Checks whether the push-to-talk mode is enabled.
 * @return
 */
public abstract boolean isPushToTalkEnable();

startPushToTalk

Push-to-talk mode: Starts speaking.

/**
 * Push-to-talk mode: Starts speaking.
 * @return
 */
public abstract boolean startPushToTalk();

finishPushToTalk

Push-to-talk mode: Stops speaking.

/**
 * Push-to-talk mode: Stops speaking.
 * @return
 */
public abstract boolean finishPushToTalk();

cancelPushToTalk

Push-to-talk mode: Cancels the current speech.

/**
 * Push-to-talk mode: Cancels the current speech.
 * @return
 */
public abstract boolean cancelPushToTalk();

switchRobotVoice

Switches the voice.

/**
 * Switches the voice.
 */
public abstract boolean switchRobotVoice(String voiceId);

Parameters:

Parameter

Type

Description

voiceId

String

Change voice

getRobotVoiceId

Retrieves the current voice.

/**
 * Gets the current voice.
 * @return
 */
public abstract String getRobotVoiceId();

setEngineCallback

Registers a callback.

/**
 * Registers a callback.
 * @param engineCallback
 */
public abstract void setEngineCallback(IARTCAICallEngineCallback engineCallback);

Parameters:

Parameter

Type

Description

engineCallback

IARTCAICallEngineCallback

The callback to register.

isMicrophoneOn

Do you want to turn off the microphone?

/**
 * Checks whether the microphone is on.
 * @return
 */
public abstract boolean isMicrophoneOn();

isSpeakerOn

Checks whether the speaker is used for playback. `true` indicates speaker playback. `false` indicates earpiece playback.

/**
 * Checks whether the speaker is used for playback.
 * @return
 */
public abstract boolean isSpeakerOn();

isVoiceInterruptEnable

Checks whether smart interruption is enabled.

/**
 * Checks whether smart interruption is enabled.
 * @return
 */
public abstract boolean isVoiceInterruptEnable();

setAvatarAgentView (Deprecated)

Sets the view container for the digital human and specifies the rendering mode.

Important

This method is deprecated in versions 2.5 and later. Use setAgentView[1/2] or setAgentView[2/2] instead.

public abstract void setAvatarAgentView(ViewGroup viewGroup, ViewGroup.LayoutParams avatarLayoutParams, ARTCAICallVideoCanvas canvas);

Parameters:

Parameter

Type

Description

viewGroup

ViewGroup

The rendering view for the digital human.

avatarLayoutParams

ViewGroup.LayoutParams

The layout parameters.

canvas

ARTCAICallVideoCanvas

The rendering view configuration, including the rendering view, rendering mode, mirror mode, and rotation mode.

setVisionPreviewView (Deprecated)

Sets the local view container for visual understanding and specifies the rendering mode.

Important

This method is deprecated in versions 2.5 and later. Use setLocalView[1/2] or setLocalView[2/2] instead.

public abstract void setVisionPreviewView(ViewGroup viewGroup, ViewGroup.LayoutParams visionLayoutParams, ARTCAICallVideoCanvas canvas);

Parameters:

Parameter

Type

Description

viewGroup

ViewGroup

The local rendering view.

avatarLayoutParams

ViewGroup.LayoutParams

The layout parameters.

canvas

ARTCAICallVideoCanvas

The rendering view configuration. This includes settings such as the rendering view, rendering mode, mirror mode, and rotation mode.

muteLocalCamera

Enable/Disable Camera

/**
 * Mutes or unmutes the camera.
 */
public abstract boolean muteLocalCamera(boolean mute);

Parameters:

Parameter

Type

Description

mute

boolean

Turn the camera on or off

isLocalCameraMute

Is the camera off?

/**
 * Checks whether the camera is muted.
 * @return
 */
public abstract boolean isLocalCameraMute();

switchCamera

Switches between the front and rear cameras.

/**
 * Switches between the front and rear cameras.
 */
public abstract boolean switchCamera();

getRtcEngine

You can obtain the RTC engine instance.

/**
 * Gets the ARTC engine instance.
 * @return
 */
public abstract AliRtcEngine getRtcEngine();

getIARTCAICallService

Retrieves the official protocol implementation.

/**
 * Gets the official protocol implementation.
 * @return
 */
public abstract IARTCAICallService getIARTCAICallService();

sendTextToAgent

Sends a custom message to the Large Language Model (LLM).

/**
 * Sends a custom message to the LLM.
 * @param req
*/
public  boolean sendTextToAgent(ARTCAICallSendTextToAgentRequest req);

Parameters:

Parameter

Type

Description

req

ARTCAICallSendTextToAgentRequest

The message struct to send.

sendCustomMessageToServer

Sends a custom message to the business server. You must call this method after the call is connected.

/**
 * Sends a custom message to the AppServer.
 * Reuses the agent's message channel to send a message to the AppServer. The AppServer must listen for the callback to receive the custom message.
 * @param msg
 * @return true: The message was sent successfully. false: The message failed to be sent.
*/
public boolean sendCustomMessageToServer(String msg);

Parameters:

Parameter

Type

Description

msg

String

The message content.

updateLlmSystemPrompt

Updates the system prompt for the LLM. You must call this method after the call is connected.

/**
 * Updates the system prompt for the LLM. For example: "You are a friendly and helpful assistant focused on providing users with accurate information and advice."
 * @param prompt
 * @return true: The update was successful. false: The update failed.
*/
public boolean updateLlmSystemPrompt(String prompt)

Parameters:

Parameter

Type

Description

prompt

String

The prompt.

updateBailianAppParams

Updates the parameters for the Model Studio application center.

public abstract boolean updateBailianAppParams(String params);

Parameters:

Parameter

Type

Description

params

String

The parameters for the Model Studio application center.

updateVcrConfig

Updates the VCR configuration.

 public abstract boolean updateVcrConfig(ARTCAICallAgentVcrConfig config);

Parameters:

Parameter

Type

Description

config

ARTCAICallAgentVcrConfig

The VCR configuration.

startVisionCustomCapture

For a visual understanding agent, starts custom frame capture. After this mode is started, voice communication with the agent is disabled. You must call this method after the call is connected.

/**
 * For a Vision agent, starts custom frame capture. After this is started, you cannot talk to the agent by voice.
 * @param request The request parameters.
 * @return true: The request was sent successfully. false: The request failed to be sent.
*/
public  boolean startVisionCustomCapture(ARTCAICallVisionCustomCaptureRequest request);

Parameters:

Parameter

Type

Description

request

ARTCAICallVisionCustomCaptureRequest

The configuration information.

stopVisionCustomCapture

For a visual understanding agent, stops custom frame capture. You must call this method after the call is connected.

public  boolean stopVisionCustomCapture();

setAgentView[1/2]

Sets the video view container for the agent.

    public abstract void setAgentView(ViewGroup viewGroup, ViewGroup.LayoutParams agentLayoutParams);

Parameters:

Parameter

Type

Description

viewGroup

ViewGroup

The digital human rendering view.

avatarLayoutParams

ViewGroup.LayoutParams

The layout parameter.

setAgentView[2/2]

Sets the agent video view and specifies the rendering mode.

    public abstract void setAgentView(ViewGroup viewGroup, ViewGroup.LayoutParams agentLayoutParams, ARTCAICallVideoCanvas canvas);

Parameter details:

Parameter

Type

Description

viewGroup

ViewGroup

The rendering view for the digital human.

agentLayoutParams

ViewGroup.LayoutParams

Layout parameters.

canvas

ARTCAICallVideoCanvas

The rendering view configuration. This includes the rendering view and rendering mode.

setLocalView[1/2]

Sets the local preview view.

public abstract void setLocalView(ViewGroup viewGroup, ViewGroup.LayoutParams localLayoutParams);

Parameters:

Parameter

Type

Description

viewGroup

ViewGroup

The local capture view.

localLayoutParams

ViewGroup.LayoutParams

The layout parameters.

setLocalView[2/2]

Sets the local preview view and specifies the rendering mode.

public abstract void setLocalView(ViewGroup viewGroup, ViewGroup.LayoutParams localLayoutParams, ARTCAICallVideoCanvas canvas);

Parameters:

Parameter

Type

Description

viewGroup

ViewGroup

The local capture view.

localLayoutParams

ViewGroup.LayoutParams

The layout parameters.

canvas

ARTCAICallVideoCanvas

The rendering view configuration, including the rendering view and rendering mode.

updateAsrMaxSilence

Updates the Voice Activity Detection (VAD) threshold. A period of silence that exceeds this threshold is considered a sentence break.

public abstract boolean updateAsrMaxSilence(int duration);

Parameters:

Parameter

Type

Description

duration

int

The duration in milliseconds. The value ranges from 200 ms to 1200 ms.

updateTtsSpeechRate

Updates the Text-to-Speech (TTS) playback speed. This applies to all TTS types. The value can range from 0.5 to 2.0.

public abstract boolean updateTtsSpeechRate(double rate);

Parameters:

Parameter

Type

Description

rate

double

The speech rate. The value ranges from 0.5 to 2.0.

getAgentInfo

Retrieves the runtime information of the current agent.

public abstract ARTCAICallAgentInfo getAgentInfo();
Note
  • The agent information returned by this API becomes valid only after the onCallBegin callback signals the start of the call.

  • If the agent runs abnormally, you can use this method to retrieve runtime information, especially the instance ID, and provide it to technical support for troubleshooting.

Return value:

This operation returns an ARTCAICallAgentInfo object that contains the following parameters:

Parameter

Type

Description

agentId

String

The current agent ID.

agentType

ARTCAICallAgentType

The agent type.

agentUserId

String

The user ID of the agent in the RTC channel.

channelId

String

The RTC channel ID where the agent is located.

instanceId

String

The instance ID of the currently running agent. When an agent starts, the system assigns a unique instance ID to identify and track its entire lifecycle and running state.

requestId

String

The request ID of the currently running agent.

IARTCAICallEngineCallback details

onErrorOccurs

A fault occurred.

/**
 * An error occurred.
 * @param errorCode The error code.
 */
void onErrorOccurs(AICallErrorCode errorCode);

Parameters:

Parameter

Type

Description

errorCode

AICallErrorCode

The error that occurred.

onAgentStarted

This callback is triggered when the agent starts successfully. If you use the client-side call[2/2] operation to call the agent, this callback is triggered when the call is successful.

/**
 * The agent started successfully.
 */     
public void onAgentStarted() {}

onCallBegin

Start a call (Join Meeting)

/**
 * The call started (joined the channel).
 */
void onCallBegin();

onCallEnd

Leave meeting

/**
 * The call ended (left the channel).
 */
void onCallEnd();

onAliRtcEngineCreated

The underlying AliRtcEngine has been created.

 public void onAliRtcEngineCreated(AliRtcEngine engine)

Parameters:

Parameter

Type

Description

engine

AliRtcEngine

The underlying AliRtcEngine engine object. This is useful when the AICallKit SDK operations do not meet your needs and you need to use the atomic operations of the ARTC SDK.

onAICallEngineRobotStateChanged

Robot State Synchronization

/**
 * The agent status is synchronized.
 * @param oldRobotState
 * @param newRobotState
 */
void onAICallEngineRobotStateChanged(ARTCAICallRobotState oldRobotState, ARTCAICallRobotState newRobotState);

Parameters:

Parameter

Type

Description

oldRobotState

ARTCAICallRobotState

The previous state.

newRobotState

ARTCAICallRobotState

The new state.

onUserSpeaking

This callback is triggered when the user is speaking.

/**
 * Callback for when the user is speaking.
 * @param isSpeaking Whether the user is speaking.
 */
void onUserSpeaking(boolean isSpeaking);

Parameters:

Parameter

Type

Description

isSpeaking

boolean

User speech callback

onUserAsrSubtitleNotify

This callback synchronizes the text recognized from the user's speech by Automatic Speech Recognition (ASR).

/**
 * Synchronizes the text recognized from the user's speech by ASR.
 * @param text The specific text recognized by ASR.
 * @param isSentenceEnd Whether the current text is the final result for this sentence.
 * @param sentenceId The ID of the sentence to which the current text belongs.
 * @param voicePrintStatusCode The voiceprint recognition status.
 */
void onUserAsrSubtitleNotify(String text, boolean isSentenceEnd, int sentenceId, VoicePrintStatusCode voicePrintStatusCode);

Parameters:

Parameter

Type

Description

text

String

The specific text recognized by ASR.

isSentenceEnd

boolean

Whether the current text is the final result for this sentence.

sentenceId

int

The sentence ID.

voicePrintStatusCode

VoicePrintStatusCode

The voiceprint recognition status.

onAIAgentSubtitleNotify

Synchronous agent response

/**
 * Synchronizes the agent's response text.
 * @param text The agent's text.
 * @param end Whether the current reply is finished.
 * @param userAsrSentenceId The LLM content that corresponds to the speech input with the specified sentenceId.
 */
void onAIAgentSubtitleNotify(String text, boolean end, int userAsrSentenceId);

Parameters:

Parameter

Type

Description

text

String

The agent's reply.

end

boolean

Whether the current reply is finished.

userAsrSentenceId

int

The LLM content that corresponds to the speech input with the specified sentenceId.

onLLMReplyCompleted

The LLM has finished responding in the current call.

/**
 * The LLM has finished replying in the current call.
 * @param text The text output by the LLM.
 * @param userAsrSentenceId The ID of the sentence that answers the user's question.
 * @note This callback provides the complete LLM response to a question and is not synchronized with the agent's voice playback. For real-time captions, use onAIAgentSubtitleNotify.
 */
public void onLLMReplyCompleted(String text, int userAsrSentenceId) {}

Parameters:

Parameter

Type

Description

text

String

The text output by the LLM.

userAsrSentenceId

int

The ID of the sentence that answers the user's question.

onNetworkStatusChanged

Network Status Callback

/**
 * Callback for network status changes.
 * @param uid The user ID.
 * @param quality The network status.
 */
void onNetworkStatusChanged(String uid, ARTCAICallNetworkQuality quality);

Parameters:

Parameter

Type

Description

uid

String

User ID

quality

ARTCAICallNetworkQuality

The network status.

onVoiceVolumeChanged

Volume modification

/**
 * The volume changed.
 * @param uid The user ID.
 * @param volume The volume, from 0 to 255.
 */
void onVoiceVolumeChanged(String uid, int volume);

Parameters:

Parameter

Type

Description

uid

String

User ID

volume

int

The volume, from 0 to 255.

onVoiceIdChanged

The current call's timbre has changed.

/**
 * The voice for the current call changed.
 */
void onVoiceIdChanged(String voiceId);

Parameters:

Parameter

Type

Description

voiceId

String

The call tone has changed.

onVoiceInterrupted

The barge-in settings for the current call have been changed.

/**
 * The voice interruption setting for the current call changed.
 */
void onVoiceInterrupted(boolean enable);

Parameters:

Parameter

Type

Description

enable

boolean

The barge-in settings for the current call have been changed.

onAgentVideoAvailable

Is stream ingest active for the agent's video?

/**
 * Indicates whether the agent's video stream is available.
 */
void onAgentVideoAvailable(boolean available);

Parameters:

Parameter

Type

Description

Enable

boolean

Indicates whether the agent's video stream is available.

onAgentAudioAvailable

Is the agent's audio stream ingest active?

/**
 * Indicates whether the agent's audio stream is available.
 */
void onAgentAudioAvailable(boolean available);

Parameters:

Parameter

Type

Description

Enable

boolean

Indicates whether the agent's audio stream is available.

onAudioDelayInfo

Audio loopback latency

/**
         * Audio loopback latency.
         *  @param id The statement ID.
         *  @param delay_ms The latency.
         */
public void onAudioDelayInfo(int id, int delay_ms) {}

Parameters:

Parameter

Type

Description

id

int

The statement ID.

delay_ms

int

The latency.

onAgentAvatarFirstFrameDrawn

Digital human initial frame rendering

/**
*  The first video frame of the digital human is rendered.
*/
void onAgentAvatarFirstFrameDrawn();

onUserOnLine

User Online Callback

/**
*  Callback for when a user comes online.
*/
void onUserOnLine(String uid);

Parameters:

Parameter

Type

Description

uid

String

User joined callback

onSpeakingInterrupted

The agent's speech was interrupted.

public void onSpeakingInterrupted(ARTCAICallSpeakingInterruptedReason reason);

Metric description:

Parameter

Type

Description

reason

ARTCAICallSpeakingInterruptedReason

The reason for the interruption, such as a specific keyword.

onVisionCustomCapture

This callback indicates whether custom frame capture mode is enabled for the current visual understanding call.

public void onVisionCustomCapture(boolean enable)

Metric description:

Parameter

Type

Description

enable

boolean

Indicates whether the mode is enabled.

onAgentWillLeave

The call will end because the current agent is about to disconnect.

/**
 * The current agent is about to leave the call.
 * @param reason The reason: 2001 (idle exit), 2002 (human takeover ended), 0 (other).
 * @param message A description of the reason.
 */
void onAgentWillLeave(int reason, String message);

Parameters:

Parameter

Type

Description

reason

int

The reason: 2001 (idle exit), 2002 (human takeover ended), 0 (other).

message

String

A description of the reason.

onHumanTakeoverWillStart

When a human agent is about to take over from the current agent

public void onHumanTakeoverWillStart(String takeoverUid, int takeoverMode);

Parameters:

Parameter

Type

Description

takeoverUid

String

The human agent's UID.

takeoverMode

int

1: Use the human agent's voice for output. 0: Use the agent's voice for output.

onHumanTakeoverConnected

This callback is triggered when the human agent takeover is connected.

public void onHumanTakeoverConnected(String takeoverUid);

The human agent takeover is connected.

Parameter

Type

Description

takeoverUid

String

Real-person UID

onReceivedAgentCustomMessage

Custom Agent Messages

/**
 * A custom message from the agent.
 * @param data The custom message body in a JSON string.
 */
public void onReceivedAgentCustomMessage(String data);

Parameters:

Parameter

Type

Description

data

String

The custom message body in a JSON string.

onAgentEmotionNotify

Agent Emotion Notifications

public void onAgentEmotionNotify(String emotion,int userAsrSentenceId);

Parameters:

Parameter

Type

Description

emotion

String

The emotion label, such as neutral, happy, angry, or sad.

userAsrSentenceId

int

The ID of the sentence that answers the user's question.

onAgentDataChannelAvailable

This callback indicates the availability of the agent's message channel. You can send messages to the agent only after this callback is triggered.

public void onAgentDataChannelAvailable() {}

onReceivedAgentVcrResult

This callback is triggered when a VCR result is received from the current agent. For more information, see ARTCAICallAgentVcrResult.

 public void onReceivedAgentVcrResult(ARTCAICallAgentVcrResult result) {}

onConnectionStatusChange

The connection status can change during the call.

public void onConnectionStatusChange(ARTCAICallConnectionStatus status, ARTCAICallConnectionStatusChangeReason reason) {}

Parameters:

Parameter

Type

Description

status

ARTCAICallConnectionStatus

The status code:

  • Init: Initialization is complete.

  • Disconnected: The network connection is disconnected.

  • Connecting: A network connection is being established.

  • Connected: The network is connected.

  • Reconnecting: The network connection is being re-established.

  • Failed: The network connection failed.

reason

int

Cause