API | Description |
sharedInstance | Creates a TCCCWorkstation instance (singleton). |
destroySharedInstance | Destroys a TCCCWorkstation instance (singleton). |
setListener | Sets a TCCCWorkstation event callback. |
// Create an instance and set an event callbackTCCCWorkstation tcccSDK = TCCCWorkstation.sharedInstance(getApplicationContext());tcccSDK.setListener(new TCCCListener() {});
API | Description |
login | SDK login |
checkLogin | Checks whether the SDK is already logged in. |
logout | SDK logout |
TCCCTypeDef.TCCCLoginParams loginParams = new TCCCTypeDef.TCCCLoginParams();/// The agent ID for login, which is usually an email addressloginParams.userId = "";/// The login ticket, required for the Agent login mode. For details, see Creating SDK Login./// Token](https://www.tencentcloud.com/document/product/679/49227?from_cn_redirect=1)loginParams.token = "";/// Cloud Contact Center application ID, which usually starts with 1400loginParams.sdkAppId = 0;// Must be the Agent modeloginParams.type = TCCCTypeDef.TCCCLoginType.Agent;tcccSDK.login(loginParams, new TXCallback() {@Overridepublic void onSuccess() {// login success}@Overridepublic void onError(int code, String desc) {// login error}});
API | Description |
call | Initiates a call |
answer | Answers the inbound call |
terminate | Ends the call |
sendDTMF | Sends Dual-Tone Multi-Frequency (DTMF) signals |
mute | Mute. |
unmute | Unmute. |
TCCCTypeDef.TCCCStartCallParams callParams =new TCCCTypeDef.TCCCStartCallParams();//Format <scheme> : <user> @<host>, such as sip:1343xxxx@1400xxxx.tccc.qcloud.com, where 1343xxxx is a mobile phone number, and 1400xxxx is your TCCC application IDcallParams.to = "sip:1343xxxx@1400xxxx.tccc.qcloud.com";// Initiate a calltcccSDK.call(callParams, new TXCallback() {@Overridepublic void onSuccess() {// call success}@Overridepublic void onError(int code, String desc) {// call error}});// End the calltcccSDK.terminate();
API | Description |
setAudioCaptureVolume | Sets the local audio capture volume. |
getAudioCaptureVolume | Obtains the local audio capture volume. |
setAudioPlayoutVolume | Sets the remote audio prompt volume. |
getAudioPlayoutVolume | Obtains the remote audio prompt volume. |
setAudioRoute | Sets audio routing. |
API | Description |
getSDKVersion | Get SDK version ID. |
setLogLevel | Sets the log output level. |
setConsoleEnabled | Enables/Disables console log print. |
callExperimentalAPI | Calls an experimental API. |
// Obtain SDK version numberTCCCWorkstation.getSDKVersion();
API | Description |
onError | Error event callback |
onWarning | Warning event callback |
tcccSDK.setListener(new TCCCListener() {/*** Error event callback* Error event, indicating that the SDK encounters an irrecoverable error, such as a failure of entering a room or a device startup failure* @param errCode //Error code* @param errMsg //Error message* @param extraInfo Additional information field. Some error codes may carry additional information to help locate problems.*/@Overridepublic void onError(int errCode, String errMsg, Bundle extraInfo) {super.onError(errCode, errMsg, extraInfo);}/*** Warning event callback* Warning event, indicating advisory issues thrown by the SDK, such as audio lag or high CPU utilization* @param warningCode Warning code* @param warningMsg Warning message* @param extraInfo Additional information field. Some warning codes may carry additional information to help locate problems.*/@Overridepublic void onWarning(int warningCode, String warningMsg, Bundle extraInfo) {super.onWarning(warningCode, warningMsg, extraInfo);}});
API | Description |
onNewSession | New session event, including inbound and outbound calls |
onEnded | Session End Event |
onAudioVolume | Callback for volume feedback |
onNetworkQuality | Real-time statistics callback of network quality |
tcccSDK.setListener(new TCCCListener() {@Overridepublic void onNewSession(TCCCTypeDef.ITCCCSessionInfo info) {super.onNewSession(info);// New session event, including inbound and outbound calls. The direction can be determined through info.sessionDirection}@Overridepublic void onEnded(int reason, String reasonMessage, String sessionId) {super.onEnded(reason, reasonMessage, sessionId);// End of session}@Overridepublic void onAccepted(String sessionId) {super.onAccepted(sessionId);// Counterpart answers}});
API | Description |
onConnectionLost | The connection between the SDK and the cloud has been disconnected. |
onTryToReconnect | The SDK is trying to reconnect to the cloud. |
onConnectionRecovery | The connection between the SDK and the cloud has been restored. |
tcccSDK.setListener(new TCCCListener() {/*** The connection between the SDK and the cloud has been disconnected.* The SDK triggers this event callback when it loses connection to the cloud, usually due to network issues or switching networks.* For example, this can happen if a user enters an elevator during a call. After that, the SDK will try to reconnect to the cloud.* During reconnection, SDK triggers **onTryToReconnect**, and once the connection is restored, it triggers **onConnectionRecovery**.* Therefore, SDK transitions between these three connection-related events in the following sequence:*/@Overridepublic void onConnectionLost(TCCCServerType serverType) {super.onConnectionLost(serverType);}/*** The SDK is trying to reconnect to the cloud* When the SDK's connection with the cloud is lost, it will throw onConnectionLost, after which it will strive to re-establish a connection with the cloud and throw this event.* After the connection is restored, onConnectionRecovery is thrown.*/@Overridepublic void onTryToReconnect(TCCCServerType serverType) {super.onTryToReconnect(serverType);}/*** The connection between the SDK and the cloud has been restored.* When the SDK's connection with the cloud is lost, it throws onConnectionLost, and then tries to re-establish a connection with the cloud and throws onTryToReconnect.* This callback is thrown when the connection is restored.*/@Overridepublic void onConnectionRecovery(TCCCServerType serverType) {super.onConnectionRecovery(serverType);}});
Symbol | Value | Meaning |
ERR_SIP_SUCCESS | 200 | Execution succeeded. |
ERR_UNRIGIST_FAILURE | 20001 | Login failed. |
ERR_ANSWER_FAILURE | 20002 | Failed to answer the call, usually because the TRTC failed to enter the room. |
ERR_SIPURI_WRONGFORMAT | 20003 | URI format error |
Symbol | Value | Meaning |
ERR_SIP_BAD_REQUEST | 400 | Error request |
ERR_SIP_UNAUTHORIZED | 401 | Unauthorized (username or password is incorrect) |
ERR_SIP_AUTHENTICATION_REQUIRED | 407 | Proxy authentication required. Please check whether the login API has been called. |
ERR_SIP_REQUESTTIMEOUT | 408 | Request timeout (network timeout) |
ERR_SIP_REQUEST_TERMINATED | 487 | Request termination (network error, in case of network interruption) |
ERR_SIP_SERVICE_UNAVAILABLE | 503 | Service unavailable |
ERR_SIP_SERVER_TIMEOUT | 504 | Service timeout |
Symbol | Value | Meaning |
ERR_MIC_START_FAIL | -1302 | Failed to start the microphone. The device's microphone configuration program (driver) is abnormal. Please disable and re-enable the device, restart the device, or update the configuration program. |
ERR_MIC_NOT_AUTHORIZED | -1317 | No access to the microphone. This usually occurs on mobile devices and may be because the user denied the access. |
ERR_MIC_SET_PARAM_FAIL | -1318 | Failed to set microphone parameters. |
ERR_MIC_OCCUPY | -1319 | The microphone is occupied. This occurs when, for example, the user is currently having a call on the mobile device. |
ERR_MIC_STOP_FAIL | -1320 | Failed to stop the microphone. |
ERR_SPEAKER_START_FAIL | -1321 | Failed to start the speaker, for example, on Windows or Mac. |
ERR_SPEAKER_SET_PARAM_FAIL | -1322 | Failed to set speaker parameters. |
ERR_SPEAKER_STOP_FAIL | -1323 | Failed to stop the speaker. |
ERR_UNSUPPORTED_SAMPLERATE | -1306 | Unsupported audio sample rate |
Symbol | Value | Meaning |
ERR_RTC_ENTER_ROOM_FAILED | -3301 | Failed to enter the room. Please check the error message corresponding to -3301 in onError to identify the cause of the failure. |
ERR_RTC_REQUEST_IP_TIMEOUT | -3307 | Request for IP and Sig timed out. Make sure the network is working and UDP is allowed through the firewall. |
ERR_RTC_CONNECT_SERVER_TIMEOUT | -3308 | Connection timed out. Check if the network is disconnected or a VPN is enabled. You can also try switching to 4G. |
ERR_RTC_ENTER_ROOM_REFUSED | -3340 | Room entry request was denied. Check if you're repeatedly calling enterRoom for the same room ID. |
Was this page helpful?