TCCC Agent API
CInterface.h
1#pragma once
2#include <stdint.h>
3
4#ifdef _WIN32
5# if !defined(__cplusplus)
6# define TCCCSDK_API extern __declspec(dllexport)
7# else
8# define TCCCSDK_API extern "C" __declspec(dllexport)
9# endif
10# define TCCCSDK_CALL __cdecl
11#else
12# define TCCCSDK_API extern "C"
13# define TCCCSDK_CALL __cdecl
14#endif
15
16extern "C" {
17// 通用回调
18typedef void (*TCCCSDK_CALL TCCC_OnErrorHandler)(int err_code, const char* err_msg, void* extra_info);
19typedef void (*TCCCSDK_CALL TCCC_OnWarningHandler)(int warning_code, const char* warning_msg, void* extra_info);
20typedef void (*TCCCSDK_CALL TCCC_OnNewSessionHandler)(const char* sessionId, int sessionDirection, const char* toUserId,
21 const char* fromUserId);
22typedef void (*TCCCSDK_CALL TCCC_OnEndedHandler)(int reason, const char* reasonMessage, const char* sessionId);
23typedef void (*TCCCSDK_CALL TCCC_OnAcceptedHandler)(const char* sessionId);
24typedef void (*TCCCSDK_CALL TCCC_OnAudioVolumeHandler)(const char* userId, uint32_t volume);
25// remoteUserId 为null的时候,remoteQuality是没有意义的
26typedef void (*TCCCSDK_CALL TCCC_OnNetworkQualityHandler)(const char* localUserId, int localQuality,
27 const char* remoteUserId, int remoteQuality,
28 uint32_t remoteQualityCount);
29
30typedef void (*TCCCSDK_CALL TCCC_OnConnectionLost)(int serverType);
31typedef void (*TCCCSDK_CALL TCCC_OnTryToReconnect)(int serverType);
32typedef void (*TCCCSDK_CALL TCCC_OnConnectionRecovery)(int serverType);
33
34// 登录&呼叫相关的回调
35typedef void (*TCCCSDK_CALL TCCC_OnLoginHandler)(int err_code, const char* err_msg, const char* userId,
36 const char* userAor, const char* otherInfo);
37typedef void (*TCCCSDK_CALL TCCC_OnLogoutHandler)(int err_code, const char* err_msg);
38typedef void (*TCCCSDK_CALL TCCC_OnStartCallHandler)(int err_code, const char* err_msg);
39typedef void (*TCCCSDK_CALL TCCC_OnAnswerHandler)(int err_code, const char* err_msg);
40typedef void (*TCCCSDK_CALL TCCC_OnCheckLoginHandler)(int err_code, const char* err_msg);
41typedef void (*TCCCSDK_CALL TCCC_OnSendDTMFHandler)(int err_code, const char* err_msg);
42}
43// 参数只有Android需要,其他可以直接用null
44TCCCSDK_API void* TCCC_GetTCCCInstance(void* context);
45TCCCSDK_API void TCCC_DestroyTCCCInstance();
46
47TCCCSDK_API void TCCC_AddCallback(TCCC_OnErrorHandler onError, TCCC_OnWarningHandler onWarning,
48 TCCC_OnNewSessionHandler onNewSession, TCCC_OnEndedHandler onEnded,
49 TCCC_OnAcceptedHandler onAccepted, TCCC_OnAudioVolumeHandler onAudioVolume,
50 TCCC_OnNetworkQualityHandler onNetworkQuality, TCCC_OnConnectionLost onConnectionLost,
51 TCCC_OnTryToReconnect onTryToReconnect,
52 TCCC_OnConnectionRecovery onConnectionRecovery);
53TCCCSDK_API void TCCC_RemoveCallback();
54
55TCCCSDK_API void TCCC_Login(const char* userId, const char* password, uint32_t sdkAppId, int loginType,
56 TCCC_OnLoginHandler callback);
57TCCCSDK_API void TCCC_Logout(TCCC_OnLogoutHandler callback);
58
59TCCCSDK_API void TCCC_CheckLogin(TCCC_OnCheckLoginHandler callback);
60TCCCSDK_API void TCCC_ResetSip(bool isNeedCallReLogin);
61
62TCCCSDK_API void TCCC_Call(const char* to, const char* uui, int type, TCCC_OnStartCallHandler callback);
63TCCCSDK_API void TCCC_Terminate();
64TCCCSDK_API void TCCC_Answer(TCCC_OnAnswerHandler callback);
65TCCCSDK_API void TCCC_SendDTMF(const char digit, TCCC_OnSendDTMFHandler callback);
66TCCCSDK_API void TCCC_Mute();
67TCCCSDK_API void TCCC_Unmute();
68TCCCSDK_API const char* TCCC_GetSDKVersion();
69TCCCSDK_API void TCCC_CallExperimentalAPI(const char* commandType, const char* jsonStr);
70TCCCSDK_API void TCCC_StartPlayMusic(const char* path, int loopCount);
71TCCCSDK_API void TCCC_StopPlayMusic();
72TCCCSDK_API void TCCC_SetLogLevel(int level);
73TCCCSDK_API void TCCC_SetConsoleEnabled(bool enabled);
74TCCCSDK_API void TCCC_EnableAudioVolumeEvaluation(uint32_t interval, bool enable_vad);
75TCCCSDK_API void TCCC_SetLogDirectory(const char* path);
76// 设备
77TCCCSDK_API void TCCC_GetDeviceManager();
78TCCCSDK_API void TDEVICE_SetAudioCaptureVolume(int volume);
79TCCCSDK_API int TDEVICE_GetAudioCaptureVolume();
80TCCCSDK_API void TDEVICE_SetAudioPlayoutVolume(int volume);
81TCCCSDK_API int TDEVICE_GetAudioPlayoutVolume();
82
83TCCCSDK_API void TDEVICE_SetAudioRoute(int route);
84
85// for test ,callback的message返回token
86TCCCSDK_API void TCCC_GenTestTokenByUser(const char* secretId, const char* secretKey, const char* userId,
87 uint32_t sdkAppId, TCCC_OnLogoutHandler callback);
88// 仅仅移动端
89#if __ANDROID__ || (__APPLE__ && TARGET_OS_IOS)
90#endif
91// 仅仅pc端
92#if (__APPLE__ && TARGET_OS_MAC && !TARGET_OS_IPHONE) || _WIN32
93#endif