API | Description |
Creates an ITCCCWorkstation instance (singleton). | |
Destroys an ITCCCWorkstation instance (singleton). | |
Adds an ITCCCWorkstation event callback. | |
Removes an ITCCCWorkstation event callback. |
import TCCCSDKlet tcccSDK: TCCCWorkstation = {// Create an instance.return TCCCWorkstation.sharedInstance()}()// Set the TCCC event callbacktcccSDK.addTcccListener(self)// Remove the TCCC event callbacktcccSDK.removeTCCCListener(self)// Destroy the instanceTCCCWorkstation.destroySharedIntance()
// Import the OC header file#import "TCCCSDK/tccc/platform/apple/TCCCWorkstation.h"@property (strong, nonatomic) TCCCWorkstation *tcccSDK;- (TCCCWorkstation*)tcccSDK {if (!_tcccSDK) {// Create an instance._tcccSDK = [TCCCWorkstation sharedInstance];}return _tcccSDK;}// Set the TCCC event callback[self.tcccSDK addTcccListener:self];// Remove the TCCC event callback[self.tcccSDK removeTCCCListener:self];// Destroy the instance[TCCCWorkstation destroySharedIntance];_tcccSDK = nil;
#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 |
import TCCCSDKlet param = TXLoginParams()// 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;// Set to agent modeparam.type = .Agent;// LogintcccSDK.login(param) { info in// Login succeeded} fail: { code, message in// Login failed}// Check login statustcccSDK.checkLogin {// Logged in} fail: { code, message in// Not logged in or kicked out}// LogouttcccSDK.logout {// Exit succeeded} fail: { code, message in// Exit exception}
// Import the OC header file#import "TCCCSDK/tccc/platform/apple/TCCCWorkstation.h"TXLoginParams *param = [[TXLoginParams alloc] init];// 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;// Set to agent modeparam.type = Agent;[self.tcccSDK login:param succ:^(TXLoginInfo * _Nonnull info) {// Login succeeded} fail:^(int code, NSString * _Nonnull desc) {// Login failed}];// Check login status[self.tcccSDK checkLogin:^{// Logged in} fail:^(int code, NSString * _Nonnull desc) {// Not logged in or kicked out}];// Logout[self.tcccSDK logout:^{// Exit succeeded} fail:^(int code, NSString * _Nonnull desc) {// Exit exception}];
#include "TCCCSDK/tccc/include/ITCCCWorkstation.h"using namespace tccc;// 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;// Set to agent modeparam.type = TCCCLoginType::Agent;// LogintcccSDK->login(param,loginCallBackImpl);// LogouttcccSDK->logout(nullptr);
import TCCCSDKlet callParams = TXStartCallParams()// Called phone numbercallParams.to = "";// Number remarks, which will replace the number displayed in the call bar (optional)callParams.remark = "";// Initiate an outbound calltcccSDK.call(callParams) {// Call initiated successfully} fail: { code, message in// Call initiation failed}// End the calltcccSDK.terminate()
// Import the OC header file#import "TCCCSDK/tccc/platform/apple/TCCCWorkstation.h"TXStartCallParams *callParams = [[TXStartCallParams alloc] init];// Called phone numbercallParams.to = TO;// Number remarks, which will replace the number displayed in the call bar (optional)callParams.remark = @"testByIos";// Initiate an outbound call[self.tcccSDK call:callParams succ:^{// Call initiated successfully} fail:^(int code, NSString * _Nonnull desc) {// Call initiation failed}];// End the call[self.tcccSDK terminate];
#include "TCCCSDK/tccc/include/ITCCCWorkstation.h"using namespace tccc;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. |
import TCCCSDK// Switch to speakertcccSDK.getDeviceManager().setAudioRoute(.TCCCAudioRouteSpeakerphone)// MutetcccSDK.mute()// UnmutetcccSDK.unmute()
// Import the OC header file#import "TCCCSDK/tccc/platform/apple/TCCCWorkstation.h"// Switch to speaker[[self.tcccSDK getDeviceManager] setAudioRoute:TCCCAudioRouteSpeakerphone];// Mute[self.tcccSDK mute];// Unmute[self.tcccSDK unmute];
#include "TCCCSDK/tccc/include/ITCCCWorkstation.h"using namespace tccc;// Switch to speakertcccSDK->getDeviceManager()->setAudioRoute(TCCCAudioRoute::TCCCAudioRouteSpeakerphone);// MutetcccSDK->mute();// UnmutetcccSDK->unmute();
API | Description |
Obtains the SDK version. | |
Sets the log output level. | |
Enables/Disables console log print. | |
Calls an experimental API. |
import TCCCSDK// Obtain SDK version numberlet version = TCCCWorkstation.getSDKVersion()
// Import the OC header file#import "TCCCSDK/tccc/platform/apple/TCCCWorkstation.h"// Obtain SDK version numberNSString* version = [TCCCWorkstation getSDKVersion];
#include "TCCCSDK/tccc/include/ITCCCWorkstation.h"using namespace tccc;// Obtain SDK version numbertcccSDK->getSDKVersion();
import TCCCSDKfunc onError(_ errCode: TCCCErrorCode, errMsg: String, extInfo: [AnyHashable : Any]?) {// Error event callback}func onWarning(_ warningCode: TCCCCWarningCode, warningMsg: String, extInfo: [AnyHashable : Any]?) {// Warning event callback}// Set the TCCC event callbacktcccSDK.addTcccListener(self)
// Import the OC header file#import "TCCCSDK/tccc/platform/apple/TCCCWorkstation.h"#pragma mark - TCCCDelegate- (void)onError:(TCCCErrorCode)errCode errMsg:(NSString * _Nonnull)errMsg extInfo:(nullable NSDictionary *)extInfo {// Error event callback}- (void)onWarning:(TCCCCWarningCode)warningCode warningMsg:(NSString *_Nonnull)warningMsg extInfo:(nullable NSDictionary *)extInfo {// Warning event callback}// Set the TCCC event callback[self.tcccSDK addTcccListener:self];
#include "TCCCSDK/tccc/include/ITCCCWorkstation.h"using namespace tccc;// 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 |
import TCCCSDKfunc onNewSession(_ info: TXSessionInfo) {// New session event, including inbound and outbound calls}func onAccepted(_ sessionId: String) {// Remote party answered event}func onEnded(_ reason: TXEndedReason, reasonMessage: String, sessionId: String) {// Call end event}// Set the TCCC event callbacktcccSDK.addTcccListener(self)
// Import the OC header file#import "TCCCSDK/tccc/platform/apple/TCCCWorkstation.h"- (void)onNewSession:(TXSessionInfo *)info {// New session event, including inbound and outbound calls}- (void)onEnded:(TXEndedReason)reason reasonMessage:(NSString *_Nonnull)reasonMessage sessionId:(NSString *_Nonnull)sessionId {// Call end event}- (void)onAccepted:(NSString *_Nonnull)sessionId {// Remote party answered event}// Set the TCCC event callback[self.tcccSDK addTcccListener:self];
#include "TCCCSDK/tccc/include/ITCCCWorkstation.h"using namespace tccc;// 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. |
import TCCCSDKfunc onConnectionLost(_ serverType: TXServerType) {// The connection between the SDK and the cloud has been disconnected}func onConnectionRecovery(_ serverType: TXServerType) {// The SDK's connection with the cloud has been restored}func onTry(toReconnect serverType: TXServerType) {// The SDK is trying to reconnect to the cloud}// Set the TCCC event callbacktcccSDK.addTcccListener(self)
// Import the OC header file#import "TCCCSDK/tccc/platform/apple/TCCCWorkstation.h"- (void)onConnectionLost:(TXServerType)serverType {// The connection between the SDK and the cloud has been disconnected}- (void)onTryToReconnect:(TXServerType)serverType {// The SDK is trying to reconnect to the cloud}- (void)onConnectionRecovery:(TXServerType)serverType {// The SDK's connection with the cloud has been restored}// Set the TCCC event callback[self.tcccSDK addTcccListener:self];
#include "TCCCSDK/tccc/include/ITCCCWorkstation.h"using namespace tccc;// 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 |
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?