Display callee information (On: true, Off: false, Default: true)
Example:
<!DOCTYPE html>
<html lang="">
<head>
<script src="https://cc-sdk.itniotech.com/sip-sdk.js"></script>
</head>
<body>
<!-- sdk Component -->
<cc-sdk id="sdk"></cc-sdk>
<script type="module">
import http from 'axios'
//1. In order to ensure the security of authentication information, the customer system backend service needs to implement SDK authentication capabilities and expose the interface to the customer frontend for use. The customer backend system access authentication capability document can be seen (https://www.itniotech.com/api/call/ccsdkAuthentication/)
//2. The 'https://xxx.xx.cn/createAuth' path needs to be replaced with the customer system backend interface
//3. Overall request path description: [Customer system frontend]->[Customer backend interface]->[Our API interface]
//4. SDK registration only requires one line of code window.ccSdk.register({token:xxx}). The post request sent in the example below is only for reference. The purpose is to obtain token from the backend interface. The specific implementation logic can be customized
http.post('url', res => {
window.ccSdk.register({
token: res.data,
noWorkMode: false,
isRemark: true,
isInformation: true,
})
})
</script>
</body>
</html>
Listening to SDK Agent Status.
To listen to the status of the SDK agent, add an ID to the SDK component and use addEventListener to listen for the onSeatStatus callback, e.g.,
Called information (up to 1000 characters, truncated if exceeded)
Example:
<!DOCTYPE html>
<html lang="">
<head>
<script src="https://cc-sdk.itniotech.com/sip-sdk.js"></script>
</head>
<body>
<button id="call">Dial</button>
<!-- sdk Component -->
<cc-sdk id="sdk"></cc-sdk>
<script type="module">
import http from 'axios'
http.post('url', res => {
window.ccSdk.register({
token: res.data,
})
})
const sdk = document.getElementById('sdk')
const callButton = document.getElementById('call')
callButton.onclick = () => {
const data = {
phone: '13212345678', // Number to call
info: 'John Doe 20 years old 461385413131', // Called information
};
sdk.callPhone(data);
};
</script>
</body>
</html>
Event - Reconnect WebRTC
Reconnect WebRTC. Add an ID or ref to the SDK component and call the callPhone() method, for example:
id.reConnectWebrtc()
Friendly reminder: Call this method only when the WebRTC status is "not connected", i.e., when the onWebrtcStatus callback returns 0. It is also recommended to set a limit on the number of reconnection attempts.