API | Description |
Creates an ITCCCWorkstation instance (singleton). | |
Destroys an ITCCCWorkstation instance (singleton). | |
Adds an ITCCCWorkstation event callback. | |
Removes an ITCCCWorkstation event callback. |
#include "TCCCSDK/tccc/include/ITCCCWorkstation.h"using namespace tccc;// Create an instance and set an event callbackITCCCWorkstation* tcccSDK = getTCCCShareInstance();// Set the callback. TCCCCallbackImpl needs to be derived from ITCCCCallbackclass TCCCCallbackImpl:public ITCCCCallback {public:TCCCCallbackImpl() {}~TCCCCallbackImpl() {}void onError(TCCCError errCode, const char* errMsg, void* extraInfo) {}void onWarning(TCCCCWarning warningCode, const char* warningMsg, void* extraInfo) {}void onNewSession(TCCCSessionInfo info) {}void onEnded(EndedReason reason, const char* reasonMessage, const char* sessionId) {}};TCCCCallbackImpl* tcccCallback = new TCCCCallbackImpl();tcccSDK->addCallback(tcccCallback);// Destroy the instancedestroyTCCCShareInstance();tcccSDK = nullptr;
API | Description |
SDK login | |
Checks whether the SDK is already logged in. | |
SDK logout |
// Callback class for loginclass TCCCLoginCallbackImpl : public ITXValueCallback<TCCCLoginInfo> {public:TCCCLoginCallbackImpl() {}~TCCCLoginCallbackImpl() override {}void OnSuccess(const TCCCLoginInfo &value) override {// Login succeeded}void OnError(TCCCError error_code, const char *error_message) override {// Login failed}};TCCCLoginCallbackImpl* loginCallBackImpl = nullptr;if (nullptr == loginCallBackImpl) {loginCallBackImpl = new TCCCLoginCallbackImpl();}TCCCLoginParams param;/// The agent ID for login, which is usually an email addressparam.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)param.token = "";/// Cloud Contact Center application ID, which usually starts with 1400param.sdkAppId = 0;// Must be the Agent modeparam.type = TCCCLoginType::Agent;// LogintcccSDK->login(param,loginCallBackImpl);// LogouttcccSDK->logout(nullptr);
class TCCCCommonCallback : public ITXCallback {private:NSString* mFunName;public:TCCCCommonCallback(NSString* funName) {mFunName = funName;}~TCCCCommonCallback() override {}void OnSuccess() override {// Succeeded}void OnError(TCCCError error_code, const char *error_message) override {std::string copyErrMsg = makeString(error_message);// Failed}};TCCCCommonCallback* startCallCallbackImpl = nullptr;if (nullptr == startCallCallbackImpl) {startCallCallbackImpl = new TCCCCommonCallback(@"startCall");}TCCCStartCallParams callParams;// Phone number for the callcallParams.to = "";// Initiate an outbound calltcccSDK->call(callParams, startCallCallbackImpl);// 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 numbertcccSDK->getSDKVersion();
// Set the callback. TCCCCallbackImpl needs to be derived from ITCCCCallbackclass TCCCCallbackImpl:public ITCCCCallback {public:TCCCCallbackImpl() {}~TCCCCallbackImpl() {}// Error event callbackvoid onError(TCCCError errCode, const char* errMsg, void* extraInfo) {}// Warning event callbackvoid onWarning(TCCCCWarning warningCode, const char* warningMsg, void* extraInfo) {}};TCCCCallbackImpl* tcccCallback = new TCCCCallbackImpl();tcccSDK->addCallback(tcccCallback);
API | Description |
New session event, including inbound and outbound calls | |
Session end event | |
Callback for volume feedback | |
Real-time statistics callback of network quality |
// Set the callback. TCCCCallbackImpl needs to be derived from ITCCCCallbackclass TCCCCallbackImpl:public ITCCCCallback {public:TCCCCallbackImpl() {}~TCCCCallbackImpl() {}// New session event, including inbound and outbound callsvoid onNewSession(TCCCSessionInfo info) {}// Session end eventvoid onEnded(EndedReason reason, const char* reasonMessage, const char* sessionId) {}};TCCCCallbackImpl* tcccCallback = new TCCCCallbackImpl();tcccSDK->addCallback(tcccCallback);
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. |
// Set the callback. TCCCCallbackImpl needs to be derived from ITCCCCallbackclass TCCCCallbackImpl:public ITCCCCallback {public:TCCCCallbackImpl() {}~TCCCCallbackImpl() {}// The connection between the SDK and the cloud has been disconnectedvoid onConnectionLost(TCCCServerType serverType) {}// The SDK is trying to reconnect to the cloudvoid onTryToReconnect(TCCCServerType serverType) {}// The SDK's connection with the cloud has been restoredvoid onConnectionRecovery(TCCCServerType serverType) {}};TCCCCallbackImpl* tcccCallback = new TCCCCallbackImpl();tcccSDK->addCallback(tcccCallback);
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. |
ERR_HTTP_REQUEST_FAILURE | -10001 | HTTP request failed. Please check your network connection. |
ERR_HTTP_TOKEN_ERROR | -10002 | The token login ticket is incorrect or has expired. |
ERR_HTTP_GETSIPINFO_ERROR | -10003 | Failed to obtain the agent configuration. Please contact us. |
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 not available. |
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?