API | Description |
Creates a TCCCWorkstation instance (singleton). | |
Destroys a TCCCWorkstation instance (singleton). | |
Sets a TCCCWorkstation event callback. |
// Create an instance and set an event callbackTCCCWorkstation tcccSDK = TCCCWorkstation.sharedInstance(getApplicationContext());tcccSDK.setListener(new TCCCListener() {});
API | Description |
SDK login | |
Checks whether the SDK is already logged in. | |
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}});
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 |
Sets the local audio capture volume. | |
Obtains the local audio capture volume. | |
Sets the remote audio playback volume. | |
Obtains the remote audio playback volume. | |
Sets audio routing. |
API | Description |
Obtains the SDK version. | |
Sets the log output level. | |
Enables/Disables console log print. | |
Calls an experimental API. |
// Obtain SDK version numberTCCCWorkstation.getSDKVersion();
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 |
New session event, including inbound and outbound calls | |
Session End Event | |
Callback for volume feedback | |
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 |
The connection between the SDK and the cloud has been disconnected. | |
The SDK is trying to reconnect to the cloud. | |
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 will issue this callback when its connection with the cloud is disconnected. The primary causes for the disconnection include the network being unavailable or a network switch.* For example, this event may occur when the user enters an elevator during a call. After this event is thrown, the SDK will attempt to re-establish a connection with the cloud.* During the reconnection process, onTryToReconnect will be thrown, and onConnectionRecovery will be thrown after the connection is restored.* Therefore, the SDK switches between the following three connection-related events in the following order:*/@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 view -3301 in onError to confirm the message for the reason of the failure. |
ERR_RTC_REQUEST_IP_TIMEOUT | -3307 | Request for IP and Sig timed out. Please check whether your network is functioning properly and whether UDP is unblocked in your network firewall. |
ERR_RTC_CONNECT_SERVER_TIMEOUT | -3308 | Request for room entry timed out. Please check your network connection or whether you are on a VPN. You can also try switching to 4G for confirmation. |
ERR_RTC_ENTER_ROOM_REFUSED | -3340 | Room entry request was denied. Please check whether you are continually calling enterRoom to enter the room of the same ID. |
Was this page helpful?